Skip to content

Commit c0a0c26

Browse files
Fernando Fernandez ManceraKernel Patches Daemon
authored andcommitted
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 <[email protected]>
1 parent 6593a90 commit c0a0c26

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

include/linux/skbuff.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4910,6 +4910,9 @@ enum skb_ext_id {
49104910
#endif
49114911
#if IS_ENABLED(CONFIG_INET_PSP)
49124912
SKB_EXT_PSP,
4913+
#endif
4914+
#if IS_ENABLED(CONFIG_XDP_SOCKETS)
4915+
SKB_EXT_XDP,
49134916
#endif
49144917
SKB_EXT_NUM, /* must be last */
49154918
};

include/net/xdp_sock.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ struct xsk_tx_metadata_ops {
120120
void (*tmo_request_launch_time)(u64 launch_time, void *priv);
121121
};
122122

123+
struct xdp_skb_ext {
124+
u32 num_descs;
125+
struct list_head addrs_list;
126+
};
127+
123128
#ifdef CONFIG_XDP_SOCKETS
124129

125130
int xsk_generic_rcv(struct xdp_sock *xs, struct xdp_buff *xdp);

net/core/skbuff.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
#include <net/page_pool/helpers.h>
8282
#include <net/psp/types.h>
8383
#include <net/dropreason.h>
84+
#include <net/xdp_sock.h>
8485

8586
#include <linux/uaccess.h>
8687
#include <trace/events/skb.h>
@@ -5066,6 +5067,9 @@ static const u8 skb_ext_type_len[] = {
50665067
#if IS_ENABLED(CONFIG_INET_PSP)
50675068
[SKB_EXT_PSP] = SKB_EXT_CHUNKSIZEOF(struct psp_skb_ext),
50685069
#endif
5070+
#if IS_ENABLED(CONFIG_XDP_SOCKETS)
5071+
[SKB_EXT_XDP] = SKB_EXT_CHUNKSIZEOF(struct xdp_skb_ext),
5072+
#endif
50695073
};
50705074

50715075
static __always_inline unsigned int skb_ext_total_length(void)

net/xdp/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
config XDP_SOCKETS
33
bool "XDP sockets"
44
depends on BPF_SYSCALL
5+
select SKB_EXTENSIONS
56
default n
67
help
78
XDP sockets allows a channel between XDP programs and

0 commit comments

Comments
 (0)