DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: Yuying Zhang <yuying.zhang@intel.com>
Cc: dev@dpdk.org, qi.z.zhang@intel.com, qiming.yang@intel.com,
	Ferruh Yigit <ferruh.yigit@intel.com>,
	arybchenko@solarflare.com
Subject: Re: [dpdk-dev] [PATCH v1] net: fix TSO packet checksum incorrect
Date: Tue, 28 Jul 2020 11:29:07 +0200	[thread overview]
Message-ID: <20200728092907.GT5869@platinum> (raw)
In-Reply-To: <20200728085531.204296-1-yuying.zhang@intel.com>

Hi,

On Tue, Jul 28, 2020 at 08:55:31AM +0000, Yuying Zhang wrote:
> The ol_flags check lacks of PKT_TX_IPV6 which causes checksum
> flag configuration error while IPv6/TCP TSO packet is sent.
> This patch fixes the issue using PKT_TX_OFFLOAD_MASK.
> 
> Fixes: 520059a41aa9 ("net: check fragmented headers in non-debug as well")
> 
> Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
> ---
>  lib/librte_net/rte_net.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h
> index 1edc283a4..4b617ab4c 100644
> --- a/lib/librte_net/rte_net.h
> +++ b/lib/librte_net/rte_net.h
> @@ -125,7 +125,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)
>  	 * Mainly it is required to avoid fragmented headers check if
>  	 * no offloads are requested.
>  	 */
> -	if (!(ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK)))
> +	if (!(ol_flags & PKT_TX_OFFLOAD_MASK))
>  		return 0;
>  
>  	if (ol_flags & (PKT_TX_OUTER_IPV4 | PKT_TX_OUTER_IPV6))
> -- 
> 2.25.1
> 

I think the PKT_TX_TCP_SEG flag is missing in the test above, it
should be like this:

 if (!(ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK | PKT_TX_TCP_SEG)))

It would be more precise than having the whole list of offload flags.

The reason is because in case of TSOv4, there is always the flag
PKT_TX_IP_CKSUM, so this test is always wrong and we continue in the
function. In case of TSOv6, there is neither PKT_TX_IP_CKSUM nor
PKT_TX_L4_TCP (which is not mandatory, the doc says that PKT_TX_TCP_SEG
implies PKT_TX_L4_TCP).

Thanks for spotting this. Can you please submit a v2 with
PKT_TX_TCP_SEG?

Olivier

  reply	other threads:[~2020-07-28  9:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-28  8:55 Yuying Zhang
2020-07-28  9:29 ` Olivier Matz [this message]
2020-07-29 15:58   ` Andrew Rybchenko
2020-07-28 17:09 ` [dpdk-dev] [PATCH v2 1/1] net: fix TSO packets " Yuying Zhang
2020-07-29  2:28   ` Xie, WeiX
2020-07-29  7:49   ` Olivier Matz
2020-07-29 16:00     ` Andrew Rybchenko
2020-07-29  8:54   ` David Marchand
2020-07-29 10:03     ` Ferruh Yigit
2020-07-30  2:00 ` [dpdk-dev] [PATCH v3 1/1] net: fix bad checksum in offloaded TSOv6 packets Yuying Zhang
2020-07-30  2:25   ` Zhang, Yuying

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=20200728092907.GT5869@platinum \
    --to=olivier.matz@6wind.com \
    --cc=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=yuying.zhang@intel.com \
    /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).