Skip to contentSkip to conversation

udp: move udp6_csum_init() back to net/ipv6/udp.c

PATCH Applied Eric Dumazet 3 participants 3 messages Feb 23 – Feb 25

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

PATCH 1/1 udp: move udp6_csum_init() back to net/ipv6/udp.c

This function has a single caller in net/ipv6/udp.c.

Move it there so that the compiler can decide to (auto)inline it if he prefers to. IBT glue is removed anyway.

With clang, we can see it was able to inline it and also inlined one other helper at the same time.

UDPLITE removal will also help.

$ scripts/bloat-o-meter -t vmlinux.old vmlinux.new
add/remove: 0/2 grow/shrink: 1/0 up/down: 840/-785 (55)
Function                                     old     new   delta
__udp6_lib_rcv                              1247    2087    +840
__pfx_udp6_csum_init                          16       -     -16
udp6_csum_init                               769       -    -769
Total: Before=25074399, After=25074454, chg +0.00%
---
 include/net/ip6_checksum.h |  2 --
 net/ipv6/ip6_checksum.c    | 47 --------------------------------------
 net/ipv6/udp.c             | 46 +++++++++++++++++++++++++++++++++++++
 3 files changed, 46 insertions(+), 49 deletions(-)
include/net/ip6_checksum.h +0 -2
index c8a96b8882772b66b902a2f5ad654f2dc8b62180..6677b3cc397261875661dd7521e75908a89cc6d9 100644
@@ -82,6 +82,4 @@ static inline __sum16 udp_v6_check(int len,
 void udp6_set_csum(bool nocheck, struct sk_buff *skb,
 		   const struct in6_addr *saddr,
 		   const struct in6_addr *daddr, int len);
-
-int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto);
 #endif
net/ipv6/ip6_checksum.c +0 -47

53 lines not on this page · raw message

net/ipv6/udp.c +46 -0

52 lines not on this page · raw message

Signature · 1 line
2.53.0.345.g96ddfc5eaa-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Eric Dumazet

This function has a single caller in net/ipv6/udp.c.

Move it there so that the compiler can decide to (auto)inline it if he prefers to. IBT glue is removed anyway.

With clang, we can see it was able to inline it and also inlined one other helper at the same time.

UDPLITE removal will also help.

$ scripts/bloat-o-meter -t vmlinux.old vmlinux.new
add/remove: 0/2 grow/shrink: 1/0 up/down: 840/-785 (55)
Function                                     old     new   delta
__udp6_lib_rcv                              1247    2087    +840
__pfx_udp6_csum_init                          16       -     -16
udp6_csum_init                               769       -    -769
Total: Before=25074399, After=25074454, chg +0.00%
Quoted 1 line
#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 9 lines · On Mon, 23 Feb 2026 09:34:45 +0000 you wrote:

This function has a single caller in net/ipv6/udp.c.

Move it there so that the compiler can decide to (auto)inline it if he prefers to. IBT glue is removed anyway.

With clang, we can see it was able to inline it and also inlined one other helper at the same time.

[...]

Here is the summary with links:
- [net-next] udp: move udp6_csum_init() back to net/ipv6/udp.c

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

You are awesome, thank you!

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