Re: [dpdk-dev] [PATCH v2] net: calculate checksums for packets with IPv4 options

2020-10-06 Thread Thomas Monjalon
06/10/2020 10:10, Olivier Matz: > On Mon, Oct 05, 2020 at 07:39:45PM -0700, Stephen Hemminger wrote: > > On Tue, 06 Oct 2020 00:55:19 +0200 > > Thomas Monjalon wrote: > > > > > > On 9/1/20 12:47 PM, Michael Pfeiffer wrote: > > > > Currently, rte_ipv4_cksum() and rte_ipv4_udptcp_cksum() assume all

Re: [dpdk-dev] [PATCH v2] net: calculate checksums for packets with IPv4 options

2020-10-06 Thread Michael Pfeiffer
Hi, On Tue, 2020-10-06 at 10:10 +0200, Olivier Matz wrote: > On Mon, Oct 05, 2020 at 07:39:45PM -0700, Stephen Hemminger wrote: > > On Tue, 06 Oct 2020 00:55:19 +0200 > > Thomas Monjalon wrote: > > > > > > On 9/1/20 12:47 PM, Michael Pfeiffer wrote: > > > > Currently, rte_ipv4_cksum() and rte_ip

Re: [dpdk-dev] [PATCH v2] net: calculate checksums for packets with IPv4 options

2020-10-06 Thread Olivier Matz
On Mon, Oct 05, 2020 at 07:39:45PM -0700, Stephen Hemminger wrote: > On Tue, 06 Oct 2020 00:55:19 +0200 > Thomas Monjalon wrote: > > > > On 9/1/20 12:47 PM, Michael Pfeiffer wrote: > > > Currently, rte_ipv4_cksum() and rte_ipv4_udptcp_cksum() assume all IPv4 > > > headers have sizeof(struct rte_ip

Re: [dpdk-dev] [PATCH v2] net: calculate checksums for packets with IPv4 options

2020-10-05 Thread Stephen Hemminger
On Tue, 06 Oct 2020 00:55:19 +0200 Thomas Monjalon wrote: > > - cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct rte_ipv4_hdr)); > > + cksum = rte_raw_cksum(ipv4_hdr, (ipv4_hdr->version_ihl & 0xf) * 4); > > > > Truly naive questions: > - doesn't it deserve a static inline function rt

Re: [dpdk-dev] [PATCH v2] net: calculate checksums for packets with IPv4 options

2020-10-05 Thread Thomas Monjalon
> - cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct rte_ipv4_hdr)); > + cksum = rte_raw_cksum(ipv4_hdr, (ipv4_hdr->version_ihl & 0xf) * 4); Truly naive questions: - doesn't it deserve a static inline function rte_ipv4_hdr_len()? - how generated code for "* 4" compares with "<< 2"?

Re: [dpdk-dev] [PATCH v2] net: calculate checksums for packets with IPv4 options

2020-09-07 Thread Andrew Rybchenko
On 9/1/20 12:47 PM, Michael Pfeiffer wrote: > Currently, rte_ipv4_cksum() and rte_ipv4_udptcp_cksum() assume all IPv4 > headers have sizeof(struct rte_ipv4_hdr) bytes. This is not true for > those (rare) packets with IPv4 options. Thus, both IPv4 and TCP/UDP > checksums are calculated wrong. > > T

[dpdk-dev] [PATCH v2] net: calculate checksums for packets with IPv4 options

2020-09-01 Thread Michael Pfeiffer
Currently, rte_ipv4_cksum() and rte_ipv4_udptcp_cksum() assume all IPv4 headers have sizeof(struct rte_ipv4_hdr) bytes. This is not true for those (rare) packets with IPv4 options. Thus, both IPv4 and TCP/UDP checksums are calculated wrong. This patch fixes the issue by using the actual IPv4 heade