DPDK usage discussions
 help / color / mirror / Atom feed
* [dpdk-users] Invalid TCP/UDP checksum for IPV4 packets
@ 2017-05-31  8:16 Julien Castets
  2017-06-07 14:39 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Julien Castets @ 2017-05-31  8:16 UTC (permalink / raw)
  To: users

I had a running application on DPDK 2.2.0 which offloads IP/TCP/UDP
checksums to the NIC. A few days ago, I started the migration to 17.02
and started to see invalid TCP/UDP checksum.

I called the new API rte_eth_tx_prepare() but checksums were still invalid.

After digging for a few hours in DPDK source code, I discovered the
flag PKT_TX_IPV4 needs to be set in ol_flags.

Basically, the function rte_net_intel_cksum_flags_prepare of rte_net.h
(http://dpdk.org/doc/api/rte__net_8h_source.html) does the following:

if (offload TCP checksum flag is set) {
  if (PKT_TX_IPV4 in ol_flags) {
     // compute ipv4 checksum
   }
   else {
     // compute ipv6 checksum
   }
}

Because I didn't set PKT_TX_IPV4 in ol_flags, I was going into the
"else" clause and the checksum was computed as if my packet was an
IPV6 packet.

Don't you think it would be preferable to assert instead of
considering a non-explicitely-declared-IPV4-packet as being an IPV6
packet?

-- 
Julien Castets
+33 (0)6.85.20.10.03

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-users] Invalid TCP/UDP checksum for IPV4 packets
  2017-05-31  8:16 [dpdk-users] Invalid TCP/UDP checksum for IPV4 packets Julien Castets
@ 2017-06-07 14:39 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2017-06-07 14:39 UTC (permalink / raw)
  To: Julien Castets; +Cc: users, dev

Hi,

31/05/2017 10:16, Julien Castets:
> I had a running application on DPDK 2.2.0 which offloads IP/TCP/UDP
> checksums to the NIC. A few days ago, I started the migration to 17.02
> and started to see invalid TCP/UDP checksum.
> 
> I called the new API rte_eth_tx_prepare() but checksums were still invalid.
> 
> After digging for a few hours in DPDK source code, I discovered the
> flag PKT_TX_IPV4 needs to be set in ol_flags.
> 
> Basically, the function rte_net_intel_cksum_flags_prepare of rte_net.h
> (http://dpdk.org/doc/api/rte__net_8h_source.html) does the following:
> 
> if (offload TCP checksum flag is set) {
>   if (PKT_TX_IPV4 in ol_flags) {
>      // compute ipv4 checksum
>    }
>    else {
>      // compute ipv6 checksum
>    }
> }
> 
> Because I didn't set PKT_TX_IPV4 in ol_flags, I was going into the
> "else" clause and the checksum was computed as if my packet was an
> IPV6 packet.
> 
> Don't you think it would be preferable to assert instead of
> considering a non-explicitely-declared-IPV4-packet as being an IPV6
> packet?

Yes, you're right.
I think we were avoiding wasting 1 cycle here.
Usability was the cost for best performance.
A good trade-off may be to use RTE_ASSERT which will be triggered only
in debug mode.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-07 14:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-31  8:16 [dpdk-users] Invalid TCP/UDP checksum for IPV4 packets Julien Castets
2017-06-07 14:39 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).