Re: [PATCH] net: fix cksum calculation for odd-sized segment
Stephen Hemminger <[email protected]>
| Newsgroups | org.dpdk.dev |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 13 Aug 2026 23:22:35 +0300 Eva Kurchatova <[email protected]> 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 <[email protected]> Acked-by: Stephen Hemminger <[email protected]>