patches for DPDK stable branches
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Ferruh Yigit" <ferruh.yigit@amd.com>,
	"Stephen Hemminger" <stephen@networkplumber.org>,
	"Kaiwen Deng" <kaiwenx.deng@intel.com>
Cc: <dev@dpdk.org>, <stable@dpdk.org>, <qiming.yang@intel.com>,
	<yidingx.zhou@intel.com>,
	"Aman Singh" <aman.deep.singh@intel.com>,
	"Yuying Zhang" <yuying.zhang@intel.com>,
	"Olivier Matz" <olivier.matz@6wind.com>,
	"Pablo de Lara" <pablo.de.lara.guarch@intel.com>
Subject: RE: [PATCH] app/test-pmd: fix L4 checksum with padding data
Date: Fri, 17 Nov 2023 13:11:50 +0100	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9F03B@smartserver.smartshare.dk> (raw)
In-Reply-To: <1effba02-7a4c-47bd-8097-a158832c45d7@amd.com>

> From: Ferruh Yigit [mailto:ferruh.yigit@amd.com]
> Sent: Friday, 17 November 2023 10.30
> 
> On 11/17/2023 3:28 AM, Stephen Hemminger wrote:
> > On Fri, 17 Nov 2023 00:50:16 +0000
> > Ferruh Yigit <ferruh.yigit@amd.com> wrote:
> >
> >>>> Hi Kaiwen,
> >>>>
> >>>> I am trying to understand the problem, what is the testcase that
> has
> >>>> checksum error?
> >>>>
> >>>> Are the received mbuf data_len & pkt_len wrong? Instead of trying
> to fix
> >>>> the mbuf during forwarding, can we fix where packet generated?
> >>>
> >>> The root cause is that get_udptcp_cksum_mbuf is using m->pkt_len
> >>> which maybe larger than the actual data. The real issue is there
> and
> >>> in rte_ip.h checksum code. The correct fix would be to use l3_len
> instead.
> >>>
> >>
> >> I see, you are right.
> >>
> >> In 'rte_ipv4_udptcp_cksum_mbuf()',
> >> as payload length "mbuf->pkt_len - l4_off" is used, which includes
> >> padding and if padding is not zero it will end up producing wrong
> checksum.
> >>
> >>
> >> I agree using 'l3_len' instead is correct fix.
> >>
> >> But this requires ABI/API change,
> >> plus do we have any reason to keep the padding, discarding it as
> this
> >> patch does is also simpler alternative.
> >
> >
> > Possibly an API version to change the args would work to fix.
> >
> 
> rte_ipv4_udptcp_cksum_mbuf() and rte_ipv6_udptcp_cksum_mbuf() are
> inline
> functions, unfortunately we can't version them.
> 
> But those functions already gets IP header as parameter, can't we use
> IP
> header to get the payload size? If so this can be fixed without
> updating
> API.

If rte_ipv4_udptcp_cksum_mbuf() - or any other function in the DPDK Network Headers library - includes Ethernet padding (which may be non-zero) when calculating the TCP/UDP checksum of an IPv4 packet, it is a bug, and must be fixed there.

Our test cases should use random padding to catch bugs like this.

And I just realized that Ethernet padding may be added to any IP packet, so don't assume that this bug only applies to small packets.


  reply	other threads:[~2023-11-17 12:11 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-04  8:28 Kaiwen Deng
2023-11-02 19:20 ` Ferruh Yigit
2023-11-03  2:49   ` Deng, KaiwenX
2023-11-03  4:03     ` Ferruh Yigit
2023-11-14  2:19       ` Deng, KaiwenX
2023-11-14 19:09         ` Ferruh Yigit
2023-11-16  7:02           ` Deng, KaiwenX
2023-11-16 22:58   ` Stephen Hemminger
2023-11-17  0:50     ` Ferruh Yigit
2023-11-17  3:28       ` Stephen Hemminger
2023-11-17  9:29         ` Ferruh Yigit
2023-11-17 12:11           ` Morten Brørup [this message]
2023-11-17 16:23             ` Stephen Hemminger
2023-11-17 16:22           ` Stephen Hemminger
2023-11-20 10:47             ` Ferruh Yigit
2023-11-20  9:21       ` Deng, KaiwenX
2023-11-20 10:46         ` Ferruh Yigit
2023-11-22  3:04           ` Deng, KaiwenX
2023-11-17  1:13 ` Ferruh Yigit
2023-11-20  9:52   ` Deng, KaiwenX
2023-12-07  8:53 ` [PATCH v2] app/test-pmd: fix tcp/udp cksum " Kaiwen Deng
2023-12-07 14:35   ` Ferruh Yigit
2023-12-12  2:16   ` [PATCH v3] lib/net: " Kaiwen Deng
2023-12-12  8:10     ` Morten Brørup
2023-12-13  4:37     ` [PATCH v4] " Kaiwen Deng
2023-12-13  7:36       ` Morten Brørup
2023-12-14  9:22       ` [PATCH v5] " Kaiwen Deng
2023-12-14 11:20         ` Morten Brørup
2024-02-19  1:10           ` Thomas Monjalon

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=98CBD80474FA8B44BF855DF32C47DC35E9F03B@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=aman.deep.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=kaiwenx.deng@intel.com \
    --cc=olivier.matz@6wind.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=yidingx.zhou@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).