Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ipv6: move ip6_dst_hoplimit() to net/ipv6/ip6_output.c

Move ip6_dst_hoplimit() to net/ipv6/ip6_output.c so that compiler
can (auto)inline it from ip6_xmit().

$ scripts/bloat-o-meter -t vmlinux.0 vmlinux.1
add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-11 (-11)
Function old new delta
ip6_xmit 1684 1673 -11
Total: Before=29655407, After=29655396, chg -0.00%

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260331174722.4128061-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
63081dec f1359c24

+21 -23
+21
net/ipv6/ip6_output.c
··· 259 259 return inet6_test_bit(AUTOFLOWLABEL, sk); 260 260 } 261 261 262 + int ip6_dst_hoplimit(struct dst_entry *dst) 263 + { 264 + int hoplimit = dst_metric_raw(dst, RTAX_HOPLIMIT); 265 + 266 + rcu_read_lock(); 267 + if (hoplimit == 0) { 268 + struct net_device *dev = dst_dev_rcu(dst); 269 + struct inet6_dev *idev; 270 + 271 + idev = __in6_dev_get(dev); 272 + if (idev) 273 + hoplimit = READ_ONCE(idev->cnf.hop_limit); 274 + else 275 + hoplimit = READ_ONCE(dev_net(dev)->ipv6.devconf_all->hop_limit); 276 + } 277 + rcu_read_unlock(); 278 + 279 + return hoplimit; 280 + } 281 + EXPORT_SYMBOL(ip6_dst_hoplimit); 282 + 262 283 /* 263 284 * xmit an sk_buff (used by TCP and SCTP) 264 285 * Note : socket lock is not held for SYNACK packets, but might be modified
-23
net/ipv6/output_core.c
··· 100 100 } 101 101 EXPORT_SYMBOL(ip6_find_1stfragopt); 102 102 103 - #if IS_ENABLED(CONFIG_IPV6) 104 - int ip6_dst_hoplimit(struct dst_entry *dst) 105 - { 106 - int hoplimit = dst_metric_raw(dst, RTAX_HOPLIMIT); 107 - 108 - rcu_read_lock(); 109 - if (hoplimit == 0) { 110 - struct net_device *dev = dst_dev_rcu(dst); 111 - struct inet6_dev *idev; 112 - 113 - idev = __in6_dev_get(dev); 114 - if (idev) 115 - hoplimit = READ_ONCE(idev->cnf.hop_limit); 116 - else 117 - hoplimit = READ_ONCE(dev_net(dev)->ipv6.devconf_all->hop_limit); 118 - } 119 - rcu_read_unlock(); 120 - 121 - return hoplimit; 122 - } 123 - EXPORT_SYMBOL(ip6_dst_hoplimit); 124 - #endif 125 - 126 103 int __ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb) 127 104 { 128 105 ipv6_set_payload_len(ipv6_hdr(skb), skb->len - sizeof(struct ipv6hdr));