* [PATCH net-next] ipv6: move ip6_dst_hoplimit() to net/ipv6/ip6_output.c
@ 2026-02-23 15:33 Eric Dumazet
2026-02-23 15:59 ` Fernando Fernandez Mancera
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Eric Dumazet @ 2026-02-23 15:33 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: Simon Horman, Kuniyuki Iwashima, David Ahern, netdev,
eric.dumazet, Eric Dumazet
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.old vmlinux.new
add/remove: 0/0 grow/shrink: 1/0 up/down: 47/0 (47)
Function old new delta
ip6_xmit 1481 1528 +47
Total: Before=25076476, After=25076523, chg +0.00%
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/ipv6/ip6_output.c | 21 +++++++++++++++++++++
net/ipv6/output_core.c | 23 -----------------------
2 files changed, 21 insertions(+), 23 deletions(-)
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 769c39fed1f38dd507d907a43ca21a2023245999..b5f2a3881a3fcd1d680f8914725ba2a6ca9e2b26 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -259,6 +259,27 @@ bool ip6_autoflowlabel(struct net *net, const struct sock *sk)
return inet6_test_bit(AUTOFLOWLABEL, sk);
}
+int ip6_dst_hoplimit(struct dst_entry *dst)
+{
+ int hoplimit = dst_metric_raw(dst, RTAX_HOPLIMIT);
+
+ rcu_read_lock();
+ if (hoplimit == 0) {
+ struct net_device *dev = dst_dev_rcu(dst);
+ struct inet6_dev *idev;
+
+ idev = __in6_dev_get(dev);
+ if (idev)
+ hoplimit = READ_ONCE(idev->cnf.hop_limit);
+ else
+ hoplimit = READ_ONCE(dev_net(dev)->ipv6.devconf_all->hop_limit);
+ }
+ rcu_read_unlock();
+
+ return hoplimit;
+}
+EXPORT_SYMBOL(ip6_dst_hoplimit);
+
/*
* xmit an sk_buff (used by TCP and SCTP)
* Note : socket lock is not held for SYNACK packets, but might be modified
diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c
index cba1684a3f30ff98517d873ddb8e97f32adc9791..64b1eeb79b572b8b412c60f832c4a7984ac8276f 100644
--- a/net/ipv6/output_core.c
+++ b/net/ipv6/output_core.c
@@ -100,29 +100,6 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
}
EXPORT_SYMBOL(ip6_find_1stfragopt);
-#if IS_ENABLED(CONFIG_IPV6)
-int ip6_dst_hoplimit(struct dst_entry *dst)
-{
- int hoplimit = dst_metric_raw(dst, RTAX_HOPLIMIT);
-
- rcu_read_lock();
- if (hoplimit == 0) {
- struct net_device *dev = dst_dev_rcu(dst);
- struct inet6_dev *idev;
-
- idev = __in6_dev_get(dev);
- if (idev)
- hoplimit = READ_ONCE(idev->cnf.hop_limit);
- else
- hoplimit = READ_ONCE(dev_net(dev)->ipv6.devconf_all->hop_limit);
- }
- rcu_read_unlock();
-
- return hoplimit;
-}
-EXPORT_SYMBOL(ip6_dst_hoplimit);
-#endif
-
int __ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
{
ipv6_set_payload_len(ipv6_hdr(skb), skb->len - sizeof(struct ipv6hdr));
--
2.53.0.345.g96ddfc5eaa-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH net-next] ipv6: move ip6_dst_hoplimit() to net/ipv6/ip6_output.c
2026-02-23 15:33 [PATCH net-next] ipv6: move ip6_dst_hoplimit() to net/ipv6/ip6_output.c Eric Dumazet
@ 2026-02-23 15:59 ` Fernando Fernandez Mancera
2026-02-23 19:01 ` Kuniyuki Iwashima
2026-02-25 1:49 ` Jakub Kicinski
2 siblings, 0 replies; 6+ messages in thread
From: Fernando Fernandez Mancera @ 2026-02-23 15:59 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: Simon Horman, Kuniyuki Iwashima, David Ahern, netdev,
eric.dumazet
On 2/23/26 4:33 PM, Eric Dumazet wrote:
> 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.old vmlinux.new
> add/remove: 0/0 grow/shrink: 1/0 up/down: 47/0 (47)
> Function old new delta
> ip6_xmit 1481 1528 +47
> Total: Before=25076476, After=25076523, chg +0.00%
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
> net/ipv6/ip6_output.c | 21 +++++++++++++++++++++
> net/ipv6/output_core.c | 23 -----------------------
> 2 files changed, 21 insertions(+), 23 deletions(-)
Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] ipv6: move ip6_dst_hoplimit() to net/ipv6/ip6_output.c
2026-02-23 15:33 [PATCH net-next] ipv6: move ip6_dst_hoplimit() to net/ipv6/ip6_output.c Eric Dumazet
2026-02-23 15:59 ` Fernando Fernandez Mancera
@ 2026-02-23 19:01 ` Kuniyuki Iwashima
2026-02-25 1:49 ` Jakub Kicinski
2 siblings, 0 replies; 6+ messages in thread
From: Kuniyuki Iwashima @ 2026-02-23 19:01 UTC (permalink / raw)
To: Eric Dumazet
Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Simon Horman,
David Ahern, netdev, eric.dumazet
On Mon, Feb 23, 2026 at 7:33 AM Eric Dumazet <edumazet@google.com> wrote:
>
> 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.old vmlinux.new
> add/remove: 0/0 grow/shrink: 1/0 up/down: 47/0 (47)
> Function old new delta
> ip6_xmit 1481 1528 +47
> Total: Before=25076476, After=25076523, chg +0.00%
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] ipv6: move ip6_dst_hoplimit() to net/ipv6/ip6_output.c
2026-02-23 15:33 [PATCH net-next] ipv6: move ip6_dst_hoplimit() to net/ipv6/ip6_output.c Eric Dumazet
2026-02-23 15:59 ` Fernando Fernandez Mancera
2026-02-23 19:01 ` Kuniyuki Iwashima
@ 2026-02-25 1:49 ` Jakub Kicinski
2026-02-25 1:52 ` Eric Dumazet
2 siblings, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2026-02-25 1:49 UTC (permalink / raw)
To: Eric Dumazet
Cc: David S . Miller, Paolo Abeni, Simon Horman, Kuniyuki Iwashima,
David Ahern, netdev, eric.dumazet
On Mon, 23 Feb 2026 15:33:42 +0000 Eric Dumazet wrote:
> 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.old vmlinux.new
> add/remove: 0/0 grow/shrink: 1/0 up/down: 47/0 (47)
> Function old new delta
> ip6_xmit 1481 1528 +47
> Total: Before=25076476, After=25076523, chg +0.00%
allmodconfig is not happy:
ld.lld: error: undefined symbol: ip6_dst_hoplimit
>>> referenced by xfrm_output.c:348 (/srv/nipa-poller/net-next/wt-0/build_clang/../net/xfrm/xfrm_output.c:348)
>>> vmlinux.o:(xfrm_outer_mode_output)
--
pw-bot: cr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] ipv6: move ip6_dst_hoplimit() to net/ipv6/ip6_output.c
2026-02-25 1:49 ` Jakub Kicinski
@ 2026-02-25 1:52 ` Eric Dumazet
2026-02-25 2:05 ` Jakub Kicinski
0 siblings, 1 reply; 6+ messages in thread
From: Eric Dumazet @ 2026-02-25 1:52 UTC (permalink / raw)
To: Jakub Kicinski
Cc: David S . Miller, Paolo Abeni, Simon Horman, Kuniyuki Iwashima,
David Ahern, netdev, eric.dumazet
On Wed, Feb 25, 2026 at 2:49 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Mon, 23 Feb 2026 15:33:42 +0000 Eric Dumazet wrote:
> > 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.old vmlinux.new
> > add/remove: 0/0 grow/shrink: 1/0 up/down: 47/0 (47)
> > Function old new delta
> > ip6_xmit 1481 1528 +47
> > Total: Before=25076476, After=25076523, chg +0.00%
>
> allmodconfig is not happy:
>
> ld.lld: error: undefined symbol: ip6_dst_hoplimit
> >>> referenced by xfrm_output.c:348 (/srv/nipa-poller/net-next/wt-0/build_clang/../net/xfrm/xfrm_output.c:348)
> >>> vmlinux.o:(xfrm_outer_mode_output)
> --
Oh well, this maze of config options...
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] ipv6: move ip6_dst_hoplimit() to net/ipv6/ip6_output.c
2026-02-25 1:52 ` Eric Dumazet
@ 2026-02-25 2:05 ` Jakub Kicinski
0 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2026-02-25 2:05 UTC (permalink / raw)
To: Eric Dumazet
Cc: David S . Miller, Paolo Abeni, Simon Horman, Kuniyuki Iwashima,
David Ahern, netdev, eric.dumazet
On Wed, 25 Feb 2026 02:52:55 +0100 Eric Dumazet wrote:
> On Wed, Feb 25, 2026 at 2:49 AM Jakub Kicinski <kuba@kernel.org> wrote:
> >
> > On Mon, 23 Feb 2026 15:33:42 +0000 Eric Dumazet wrote:
> > > 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.old vmlinux.new
> > > add/remove: 0/0 grow/shrink: 1/0 up/down: 47/0 (47)
> > > Function old new delta
> > > ip6_xmit 1481 1528 +47
> > > Total: Before=25076476, After=25076523, chg +0.00%
> >
> > allmodconfig is not happy:
> >
> > ld.lld: error: undefined symbol: ip6_dst_hoplimit
>
> Oh well, this maze of config options...
I don't recall last time we discussed removing support for IPV6=m
but maybe we should consider it?
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-02-25 2:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23 15:33 [PATCH net-next] ipv6: move ip6_dst_hoplimit() to net/ipv6/ip6_output.c Eric Dumazet
2026-02-23 15:59 ` Fernando Fernandez Mancera
2026-02-23 19:01 ` Kuniyuki Iwashima
2026-02-25 1:49 ` Jakub Kicinski
2026-02-25 1:52 ` Eric Dumazet
2026-02-25 2:05 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox