]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xsk: fix XDP_UMEM_SG_FLAG issues
authorMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Thu, 2 Apr 2026 15:49:53 +0000 (17:49 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 7 Apr 2026 01:43:51 +0000 (18:43 -0700)
Currently xp_assign_dev_shared() is missing XDP_USE_SG being propagated
to flags so set it in order to preserve mtu check that is supposed to be
done only when no multi-buffer setup is in picture.

Also, this flag has the same value as XDP_UMEM_TX_SW_CSUM so we could
get unexpected SG setups for software Tx checksums. Since csum flag is
UAPI, modify value of XDP_UMEM_SG_FLAG.

Fixes: d609f3d228a8 ("xsk: add multi-buffer support for sockets sharing umem")
Reviewed-by: Björn Töpel <bjorn@kernel.org>
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Link: https://patch.msgid.link/20260402154958.562179-4-maciej.fijalkowski@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/xdp_sock.h
net/xdp/xsk_buff_pool.c

index 23e8861e8b25e673c2fb0f6b6629d2bff7fd2bcb..ebac60a3d8a17b418f2bc17dbdf8820c827198bc 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/mm.h>
 #include <net/sock.h>
 
-#define XDP_UMEM_SG_FLAG (1 << 1)
+#define XDP_UMEM_SG_FLAG BIT(3)
 
 struct net_device;
 struct xsk_queue;
index 37b7a68b89b3d3bfc67605d5cc4bca8a9e4df093..729602a3cec0e8dfbe3be4dc208428d378dc74eb 100644 (file)
@@ -247,6 +247,10 @@ int xp_assign_dev_shared(struct xsk_buff_pool *pool, struct xdp_sock *umem_xs,
        struct xdp_umem *umem = umem_xs->umem;
 
        flags = umem->zc ? XDP_ZEROCOPY : XDP_COPY;
+
+       if (umem->flags & XDP_UMEM_SG_FLAG)
+               flags |= XDP_USE_SG;
+
        if (umem_xs->pool->uses_need_wakeup)
                flags |= XDP_USE_NEED_WAKEUP;