DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH] net: fix cksum calculation for odd-sized segment
Date: Mon, 17 Aug 2026 19:16:52 -0700	[thread overview]
Message-ID: <20260817191652.108068ac@phoenix.local> (raw)
In-Reply-To: <20260813202236.246588-1-eva.kurchatova@virtuozzo.com>

On Thu, 13 Aug 2026 23:22:35 +0300
Eva Kurchatova <eva.kurchatova@virtuozzo.com> wrote:

> The rte_raw_cksum_mbuf() performs rte_bswap16() on return value from
> __rte_raw_cksum() for odd-sized segments. However, __rte_raw_cksum()
> returns a 32-bit accumulator whose upper 16 bits may still contain
> carries that must be folded. Truncating those upper bits by passing to
> rte_bswap16() will produce an invalid checksum if they are non-zero.
> 
> This is surely a rare encounter in practice, as most NICs have hardware
> checksum offloads, and even then encountering an odd-sized SG segment
> is not common, but currently such a case would miscompute the checksum.
> 
> I found this issue by accident when comparing RVVM networking stack
> packet checksuming to DPDK, and noticed that this looked incorrect.
> 
> Fix this by folding the odd-sized segment checksum before bswap16.
> 
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

      reply	other threads:[~2026-08-18  2:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13 20:22 [PATCH] net: fix cksum calculation for odd-sized segment Eva Kurchatova
2026-08-18  2:16 ` Stephen Hemminger [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=20260817191652.108068ac@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=eva.kurchatova@virtuozzo.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