* FAILED: patch "[PATCH] xsk: defer software checksum until the skb is complete" failed to apply to 6.12-stable tree
@ 2026-11-25 8:47 gregkh
2026-11-25 14:40 ` [PATCH 6.12.y] xsk: defer software checksum until the skb is complete Sasha Levin
0 siblings, 1 reply; 2+ messages in thread
From: gregkh @ 2026-11-25 8:47 UTC (permalink / raw)
To: testwrzwrz, kerneljasonxing, maciej.fijalkowski, pabeni, sdf; +Cc: stable
The patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x f2eddafbfcc004098425fee7c5664adbe29152d7
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026112511-clergyman-gulf-c3af@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From f2eddafbfcc004098425fee7c5664adbe29152d7 Mon Sep 17 00:00:00 2001
From: Rongzheng Wang <testwrzwrz@gmail.com>
Date: Wed, 4 Nov 2026 11:48:08 +0800
Subject: [PATCH] xsk: defer software checksum until the skb is complete
When XDP_UMEM_TX_SW_CSUM is used with multi-buffer TX, xsk_skb_metadata()
calls skb_checksum_help() while only the first descriptor has been added to
the skb. The checksum therefore covers just the first fragment, and
skb_checksum_help() sets ip_summed to CHECKSUM_NONE, so the remaining
fragments are never included in the checksum.
Move the software checksum calculation to the point where the last
descriptor has been added to the skb.
On a checksum failure the packet is now dropped instead of being returned
to the application for a retry. This path is not reachable with the
existing metadata validation, but the behavior change is intentional.
Fixes: 11614723af26 ("xsk: Add option to calculate TX checksum in SW")
Cc: stable@vger.kernel.org
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
Signed-off-by: Rongzheng Wang <testwrzwrz@gmail.com>
Link: https://patch.msgid.link/20261104034809.24545-2-testwrzwrz@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
index 28b3075eef85..f22f9a2cdbbe 100644
--- a/net/xdp/xsk.c
+++ b/net/xdp/xsk.c
@@ -1012,14 +1012,6 @@ static int xsk_skb_metadata(struct sk_buff *skb, void *buffer,
skb->csum_start = hr + csum_start;
skb->csum_offset = csum_offset;
skb->ip_summed = CHECKSUM_PARTIAL;
-
- if (unlikely(pool->tx_sw_csum)) {
- int err;
-
- err = skb_checksum_help(skb);
- if (err)
- return err;
- }
}
if (flags & XDP_TXMD_FLAGS_LAUNCH_TIME)
@@ -1031,6 +1023,15 @@ static int xsk_skb_metadata(struct sk_buff *skb, void *buffer,
return 0;
}
+static int xsk_skb_sw_csum(struct sk_buff *skb, struct xsk_buff_pool *pool)
+{
+ if (unlikely(pool->tx_sw_csum &&
+ skb->ip_summed == CHECKSUM_PARTIAL))
+ return skb_checksum_help(skb);
+
+ return 0;
+}
+
static struct sk_buff *xsk_build_skb_zerocopy(struct xdp_sock *xs,
struct xdp_desc *desc)
{
@@ -1278,6 +1279,12 @@ static int __xsk_generic_xmit(struct sock *sk)
continue;
}
+ err = xsk_skb_sw_csum(skb, xs->pool);
+ if (unlikely(err)) {
+ xsk_drop_skb(skb);
+ goto out;
+ }
+
err = __dev_direct_xmit(skb, xs->queue_id);
if (err == NETDEV_TX_BUSY) {
/* Tell user-space to retry the send */
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 6.12.y] xsk: defer software checksum until the skb is complete
2026-11-25 8:47 FAILED: patch "[PATCH] xsk: defer software checksum until the skb is complete" failed to apply to 6.12-stable tree gregkh
@ 2026-11-25 14:40 ` Sasha Levin
0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2026-11-25 14:40 UTC (permalink / raw)
To: stable
Cc: Rongzheng Wang, Maciej Fijalkowski, Stanislav Fomichev,
Jason Xing, Paolo Abeni, Sasha Levin
From: Rongzheng Wang <testwrzwrz@gmail.com>
[ Upstream commit f2eddafbfcc004098425fee7c5664adbe29152d7 ]
When XDP_UMEM_TX_SW_CSUM is used with multi-buffer TX, xsk_skb_metadata()
calls skb_checksum_help() while only the first descriptor has been added to
the skb. The checksum therefore covers just the first fragment, and
skb_checksum_help() sets ip_summed to CHECKSUM_NONE, so the remaining
fragments are never included in the checksum.
Move the software checksum calculation to the point where the last
descriptor has been added to the skb.
On a checksum failure the packet is now dropped instead of being returned
to the application for a retry. This path is not reachable with the
existing metadata validation, but the behavior change is intentional.
Fixes: 11614723af26 ("xsk: Add option to calculate TX checksum in SW")
Cc: stable@vger.kernel.org
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
Signed-off-by: Rongzheng Wang <testwrzwrz@gmail.com>
Link: https://patch.msgid.link/20261104034809.24545-2-testwrzwrz@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ sashal: Open-coded the final-descriptor software checksum call in the xmit loop and removed the early one inline, since there is no metadata helper split, and drop uses cancel-reservation semantics. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/xdp/xsk.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
index 1bc966669ec96..028791b80fbbc 100644
--- a/net/xdp/xsk.c
+++ b/net/xdp/xsk.c
@@ -952,12 +952,6 @@ static struct sk_buff *xsk_build_skb(struct xdp_sock *xs,
skb->csum_start = hr + csum_start;
skb->csum_offset = csum_offset;
skb->ip_summed = CHECKSUM_PARTIAL;
-
- if (unlikely(xs->pool->tx_sw_csum)) {
- err = skb_checksum_help(skb);
- if (err)
- goto free_err;
- }
}
}
}
@@ -1052,6 +1046,15 @@ static int __xsk_generic_xmit(struct sock *sk)
continue;
}
+ if (unlikely(xs->pool->tx_sw_csum &&
+ skb->ip_summed == CHECKSUM_PARTIAL)) {
+ err = skb_checksum_help(skb);
+ if (unlikely(err)) {
+ xsk_drop_skb(skb);
+ goto out;
+ }
+ }
+
err = __dev_direct_xmit(skb, xs->queue_id);
if (err == NETDEV_TX_BUSY) {
/* Tell user-space to retry the send */
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-25 14:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 8:47 FAILED: patch "[PATCH] xsk: defer software checksum until the skb is complete" failed to apply to 6.12-stable tree gregkh
2026-11-25 14:40 ` [PATCH 6.12.y] xsk: defer software checksum until the skb is complete Sasha Levin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.