Skip to contentSkip to conversation

net: inline skb_add_rx_frag_netmem()

PATCH Applied Eric Dumazet 3 participants 3 messages Feb 26 – Feb 28

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: inline skb_add_rx_frag_netmem()

This critical helper (via skb_add_rx_frag()) is mostly used from drivers rx fast path.

It is time to inline it, this actually saves space in vmlinux:

size vmlinux.old vmlinux
text data bss dec hex filename

37350766        23092977        4846992 65290735        3e441ef vmlinux.old
37350600        23092977        4846992 65290569        3e44149 vmlinux
---
 include/linux/skbuff.h | 13 +++++++++++--
 net/core/skbuff.c      | 11 -----------
 2 files changed, 11 insertions(+), 13 deletions(-)
include/linux/skbuff.h +11 -2
index daa4e4944ce3f2184b193f43dbab88147ae2a7e4..9cc98f850f1d7cd01eed3fe9d17b59116b49958e 100644
@@ -2682,8 +2682,17 @@ static inline void skb_fill_page_desc_noacc(struct sk_buff *skb, int i,
 	shinfo->nr_frags = i + 1;
 }
 
-void skb_add_rx_frag_netmem(struct sk_buff *skb, int i, netmem_ref netmem,
-			    int off, int size, unsigned int truesize);
+static inline void skb_add_rx_frag_netmem(struct sk_buff *skb, int i,
+					  netmem_ref netmem, int off,
+					  int size, unsigned int truesize)
+{
+	DEBUG_NET_WARN_ON_ONCE(size > truesize);
+
+	skb_fill_netmem_desc(skb, i, netmem, off, size);
+	skb->len += size;
+	skb->data_len += size;
+	skb->truesize += truesize;
+}
 
 static inline void skb_add_rx_frag(struct sk_buff *skb, int i,
 				   struct page *page, int off, int size,
net/core/skbuff.c +0 -11
index dc47d3efc72ed86dce5e382d505eda7bc863669a..e3aa1612ef5dce5b96deb17731d0449d79adc34f 100644
@@ -891,17 +891,6 @@ struct sk_buff *napi_alloc_skb(struct napi_struct *napi, unsigned int len)
 }
 EXPORT_SYMBOL(napi_alloc_skb);
 
-void skb_add_rx_frag_netmem(struct sk_buff *skb, int i, netmem_ref netmem,
-			    int off, int size, unsigned int truesize)
-{
-	DEBUG_NET_WARN_ON_ONCE(size > truesize);
-
-	skb_fill_netmem_desc(skb, i, netmem, off, size);
-	skb->len += size;
-	skb->data_len += size;
-	skb->truesize += truesize;
-}
-EXPORT_SYMBOL(skb_add_rx_frag_netmem);
 
 void skb_coalesce_rx_frag(struct sk_buff *skb, int i, int size,
 			  unsigned int truesize)
Signature · 1 line
2.53.0.414.gf7e9f6c205-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Eric Dumazet

This critical helper (via skb_add_rx_frag()) is mostly used from drivers rx fast path.

Quoted 8 lines

It is time to inline it, this actually saves space in vmlinux:

size vmlinux.old vmlinux
text data bss dec hex filename

37350766        23092977        4846992 65290735        3e441ef vmlinux.old
37350600        23092977        4846992 65290569        3e44149 vmlinux
#2 lore raw
In reply to Eric Dumazet
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Thu, 26 Feb 2026 04:12:13 +0000 you wrote:

This critical helper (via skb_add_rx_frag()) is mostly used from drivers rx fast path.

It is time to inline it, this actually saves space in vmlinux:

size vmlinux.old vmlinux
text data bss dec hex filename

37350766        23092977        4846992 65290735        3e441ef vmlinux.old
37350600        23092977        4846992 65290569        3e44149 vmlinux

[...]

Here is the summary with links:
- [net-next] net: inline skb_add_rx_frag_netmem()

    https://git.kernel.org/netdev/net-next/c/6466441a5ecd

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html