From: "Morten Brørup" <mb@smartsharesystems.com>
To: dev@dpdk.org, Maxime Coquelin <maxime.coquelin@redhat.com>,
Chenbo Xia <chenbox@nvidia.com>
Cc: "Morten Brørup" <mb@smartsharesystems.com>, stable@dpdk.org
Subject: [PATCH] net/vhost: fix SW checksum when zero
Date: Sat, 17 Oct 2026 16:59:52 +0000 [thread overview]
Message-ID: <20261017165952.3139535-1-mb@smartsharesystems.com> (raw)
Identifying UDP packets by masking the packet type with the L4 UDP packet
type value (0x00000200) also matched other L4 packet types with that bit
set; specifically IP fragments, IGMP packets, and certain non-fragments.
This meant that non-UDP packets followed the special UDP rule about
transmitting a checksum of zero as 0xffff instead.
Updated to mask the packet type with the L4 packet type mask and then
compare to the L4 UDP packet type, so only UDP packets follow the special
UDP checksum rule.
Fixes: 8ba1723783b2 ("net/vhost: perform SW checksum in Tx path")
Fixes: 8f1750f42e2d ("net/vhost: perform SW checksum in Rx path")
Cc: stable@dpdk.org
Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
---
drivers/net/vhost/rte_eth_vhost.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index f6ef997455..1f55ee9670 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -346,7 +346,7 @@ vhost_dev_tx_sw_csum(struct rte_mbuf *mbuf)
csum = ~csum;
/* See RFC768 */
- if (unlikely((mbuf->packet_type & RTE_PTYPE_L4_UDP) && csum == 0))
+ if (unlikely(csum == 0) && (mbuf->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_UDP)
csum = 0xffff;
if (rte_pktmbuf_data_len(mbuf) >= csum_offset + 1)
@@ -389,7 +389,7 @@ vhost_dev_rx_sw_csum(struct rte_mbuf *mbuf)
csum = ~csum;
/* See RFC768 */
- if (unlikely((ptype & RTE_PTYPE_L4_UDP) && csum == 0))
+ if (unlikely(csum == 0) && (ptype & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_UDP)
csum = 0xffff;
if (rte_pktmbuf_data_len(mbuf) >= csum_offset + 1)
--
2.43.0
next reply other threads:[~2026-10-17 17:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-17 16:59 Morten Brørup [this message]
2026-10-17 18:21 ` [PATCH v2] net/vhost: fix SW checksum when zero Morten Brørup
2026-10-18 9:20 ` [PATCH v3] " Morten Brørup
2026-10-19 20:12 ` Maxime Coquelin
2026-10-20 9:01 ` Morten Brørup
2026-10-20 11:19 ` Maxime Coquelin
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=20261017165952.3139535-1-mb@smartsharesystems.com \
--to=mb@smartsharesystems.com \
--cc=chenbox@nvidia.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
--cc=stable@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