DPDK usage discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Julien Castets <castets.j@gmail.com>
Cc: users@dpdk.org, dev@dpdk.org
Subject: Re: [dpdk-users] Invalid TCP/UDP checksum for IPV4 packets
Date: Wed, 07 Jun 2017 16:39:49 +0200	[thread overview]
Message-ID: <2411222.g8kaCR81iN@xps> (raw)
In-Reply-To: <CADF714Y-eLGjjV3CLmGNvE=fu9YKh7EeZspMK6WfyP2hU3qR2A@mail.gmail.com>

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.

      reply	other threads:[~2017-06-07 14:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31  8:16 Julien Castets
2017-06-07 14:39 ` Thomas Monjalon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2411222.g8kaCR81iN@xps \
    --to=thomas@monjalon.net \
    --cc=castets.j@gmail.com \
    --cc=dev@dpdk.org \
    --cc=users@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).