[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251028183032.5350-1-fmancera@suse.de>
Date: Tue, 28 Oct 2025 19:30:31 +0100
From: Fernando Fernandez Mancera <fmancera@...e.de>
To: bpf@...r.kernel.org
Cc: netdev@...r.kernel.org,
magnus.karlsson@...el.com,
maciej.fijalkowski@...el.com,
sdf@...ichev.me,
kerneljasonxing@...il.com,
fw@...len.de,
Fernando Fernandez Mancera <fmancera@...e.de>
Subject: [PATCH 1/2 bpf v2] xdp: add XDP extension to skb
This patch adds a new skb extension for XDP representing the number of
cq descriptors and a linked list of umem addresses.
This is going to be used from the xsk skb destructor to put the umem
addresses onto pool's completion queue.
Signed-off-by: Fernando Fernandez Mancera <fmancera@...e.de>
---
Note: CC'ing Florian Westphal in case I have missed a relevant detail.
---
include/linux/skbuff.h | 3 +++
include/net/xdp_sock.h | 5 +++++
net/core/skbuff.c | 4 ++++
net/xdp/Kconfig | 1 +
4 files changed, 13 insertions(+)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index fb3fec9affaa..1c4a598b6564 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -4910,6 +4910,9 @@ enum skb_ext_id {
#endif
#if IS_ENABLED(CONFIG_INET_PSP)
SKB_EXT_PSP,
+#endif
+#if IS_ENABLED(CONFIG_XDP_SOCKETS)
+ SKB_EXT_XDP,
#endif
SKB_EXT_NUM, /* must be last */
};
diff --git a/include/net/xdp_sock.h b/include/net/xdp_sock.h
index ce587a225661..94c607093768 100644
--- a/include/net/xdp_sock.h
+++ b/include/net/xdp_sock.h
@@ -120,6 +120,11 @@ struct xsk_tx_metadata_ops {
void (*tmo_request_launch_time)(u64 launch_time, void *priv);
};
+struct xdp_skb_ext {
+ u32 num_descs;
+ struct list_head addrs_list;
+};
+
#ifdef CONFIG_XDP_SOCKETS
int xsk_generic_rcv(struct xdp_sock *xs, struct xdp_buff *xdp);
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 6be01454f262..f3966b8c61ee 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -81,6 +81,7 @@
#include <net/page_pool/helpers.h>
#include <net/psp/types.h>
#include <net/dropreason.h>
+#include <net/xdp_sock.h>
#include <linux/uaccess.h>
#include <trace/events/skb.h>
@@ -5066,6 +5067,9 @@ static const u8 skb_ext_type_len[] = {
#if IS_ENABLED(CONFIG_INET_PSP)
[SKB_EXT_PSP] = SKB_EXT_CHUNKSIZEOF(struct psp_skb_ext),
#endif
+#if IS_ENABLED(CONFIG_XDP_SOCKETS)
+ [SKB_EXT_XDP] = SKB_EXT_CHUNKSIZEOF(struct xdp_skb_ext),
+#endif
};
static __always_inline unsigned int skb_ext_total_length(void)
diff --git a/net/xdp/Kconfig b/net/xdp/Kconfig
index 71af2febe72a..89546c48ac2a 100644
--- a/net/xdp/Kconfig
+++ b/net/xdp/Kconfig
@@ -2,6 +2,7 @@
config XDP_SOCKETS
bool "XDP sockets"
depends on BPF_SYSCALL
+ select SKB_EXTENSIONS
default n
help
XDP sockets allows a channel between XDP programs and
--
2.51.0
Powered by blists - more mailing lists