Netdev List
 help / color / mirror / Atom feed
* [PATCH net] ip6_tunnel: do not use dst6_mtu() in ip4ip6_err() and ip6erspan_tunnel_xmit()
@ 2026-06-09  9:13 Eric Dumazet
  2026-06-11  6:27 ` Ido Schimmel
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Eric Dumazet @ 2026-06-09  9:13 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, Ido Schimmel, David Ahern, netdev, eric.dumazet,
	Eric Dumazet

This is a minor performance / conceptual fix.

1) ip6erspan_tunnel_xmit()

  ERSPAN tunnel can mirror both IPv4 and IPv6 traffic, skb
  (the packet being mirrored) can be an IPv4 packet,
  and thus dst can be an IPv4 destination entry

  Use dst_mtu() which contains generic logic for both families.

2) ip4ip6_err()

  skb2 has been prepared as an IPv4 packet, and its destination
  is an IPv4 route.

  dst6_mtu() is optimized for IPv6 destinations and uses INDIRECT_CALL_1
  to call ip6_mtu() directly if the ops match.

  We should use dst4_mtu() instead.

Fixes: b40f0130a23b ("ipv6: use dst6_mtu() instead of dst_mtu()")
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv6/ip6_gre.c    | 2 +-
 net/ipv6/ip6_tunnel.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 365b4059eb20354c256c491a16db0e606e0a9790..48039f00b4bc4321c1502714a98dbf209a7ea398 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -1058,7 +1058,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
 	/* TooBig packet may have updated dst->dev's mtu */
 	if (!t->parms.collect_md && dst) {
 		mtu = READ_ONCE(dst_dev(dst)->mtu);
-		if (dst6_mtu(dst) > mtu)
+		if (dst_mtu(dst) > mtu)
 			dst->ops->update_pmtu(dst, NULL, skb, mtu, false);
 	}
 	err = ip6_tnl_xmit(skb, dev, dsfield, &fl6, encap_limit, &mtu,
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 9d1037ac082f6aad36c152ffdbe0f30237b65fc3..bf5cd5d4adcdfa86eb7a3c0a27db3cadb69499ae 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -650,7 +650,7 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 
 	/* change mtu on this route */
 	if (rel_type == ICMP_DEST_UNREACH && rel_code == ICMP_FRAG_NEEDED) {
-		if (rel_info > dst6_mtu(skb_dst(skb2)))
+		if (rel_info > dst4_mtu(skb_dst(skb2)))
 			goto out;
 
 		skb_dst_update_pmtu_no_confirm(skb2, rel_info);
-- 
2.54.0.1064.gd145956f57-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] ip6_tunnel: do not use dst6_mtu() in ip4ip6_err() and ip6erspan_tunnel_xmit()
  2026-06-09  9:13 [PATCH net] ip6_tunnel: do not use dst6_mtu() in ip4ip6_err() and ip6erspan_tunnel_xmit() Eric Dumazet
@ 2026-06-11  6:27 ` Ido Schimmel
  2026-06-11  9:53 ` Paolo Abeni
  2026-06-11 13:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: Ido Schimmel @ 2026-06-11  6:27 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Simon Horman,
	David Ahern, netdev, eric.dumazet

On Tue, Jun 09, 2026 at 09:13:37AM +0000, Eric Dumazet wrote:
> This is a minor performance / conceptual fix.
> 
> 1) ip6erspan_tunnel_xmit()
> 
>   ERSPAN tunnel can mirror both IPv4 and IPv6 traffic, skb
>   (the packet being mirrored) can be an IPv4 packet,
>   and thus dst can be an IPv4 destination entry
> 
>   Use dst_mtu() which contains generic logic for both families.
> 
> 2) ip4ip6_err()
> 
>   skb2 has been prepared as an IPv4 packet, and its destination
>   is an IPv4 route.
> 
>   dst6_mtu() is optimized for IPv6 destinations and uses INDIRECT_CALL_1
>   to call ip6_mtu() directly if the ops match.
> 
>   We should use dst4_mtu() instead.
> 
> Fixes: b40f0130a23b ("ipv6: use dst6_mtu() instead of dst_mtu()")
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] ip6_tunnel: do not use dst6_mtu() in ip4ip6_err() and ip6erspan_tunnel_xmit()
  2026-06-09  9:13 [PATCH net] ip6_tunnel: do not use dst6_mtu() in ip4ip6_err() and ip6erspan_tunnel_xmit() Eric Dumazet
  2026-06-11  6:27 ` Ido Schimmel
@ 2026-06-11  9:53 ` Paolo Abeni
  2026-06-11 11:17   ` Eric Dumazet
  2026-06-11 13:50 ` patchwork-bot+netdevbpf
  2 siblings, 1 reply; 5+ messages in thread
From: Paolo Abeni @ 2026-06-11  9:53 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski
  Cc: Simon Horman, Ido Schimmel, David Ahern, netdev, eric.dumazet

On 6/9/26 11:13 AM, Eric Dumazet wrote:
> This is a minor performance / conceptual fix.
> 
> 1) ip6erspan_tunnel_xmit()
> 
>   ERSPAN tunnel can mirror both IPv4 and IPv6 traffic, skb
>   (the packet being mirrored) can be an IPv4 packet,
>   and thus dst can be an IPv4 destination entry
> 
>   Use dst_mtu() which contains generic logic for both families.
> 
> 2) ip4ip6_err()
> 
>   skb2 has been prepared as an IPv4 packet, and its destination
>   is an IPv4 route.
> 
>   dst6_mtu() is optimized for IPv6 destinations and uses INDIRECT_CALL_1
>   to call ip6_mtu() directly if the ops match.
> 
>   We should use dst4_mtu() instead.
> 
> Fixes: b40f0130a23b ("ipv6: use dst6_mtu() instead of dst_mtu()")
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Any strong opinon vs redirecting this one to the net-next tree? We are
trying (with limited success :( to keep the amount of changes in net
under control, and this looks like a minor performance optimization to me.

If there is agreement, I can apply the patch there stripping the fixes
tag without a repost.

Thanks,

Paolo


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] ip6_tunnel: do not use dst6_mtu() in ip4ip6_err() and ip6erspan_tunnel_xmit()
  2026-06-11  9:53 ` Paolo Abeni
@ 2026-06-11 11:17   ` Eric Dumazet
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2026-06-11 11:17 UTC (permalink / raw)
  To: Paolo Abeni
  Cc: David S . Miller, Jakub Kicinski, Simon Horman, Ido Schimmel,
	David Ahern, netdev, eric.dumazet

On Thu, Jun 11, 2026 at 2:53 AM Paolo Abeni <pabeni@redhat.com> wrote:
>
> On 6/9/26 11:13 AM, Eric Dumazet wrote:
> > This is a minor performance / conceptual fix.
> >
> > 1) ip6erspan_tunnel_xmit()
> >
> >   ERSPAN tunnel can mirror both IPv4 and IPv6 traffic, skb
> >   (the packet being mirrored) can be an IPv4 packet,
> >   and thus dst can be an IPv4 destination entry
> >
> >   Use dst_mtu() which contains generic logic for both families.
> >
> > 2) ip4ip6_err()
> >
> >   skb2 has been prepared as an IPv4 packet, and its destination
> >   is an IPv4 route.
> >
> >   dst6_mtu() is optimized for IPv6 destinations and uses INDIRECT_CALL_1
> >   to call ip6_mtu() directly if the ops match.
> >
> >   We should use dst4_mtu() instead.
> >
> > Fixes: b40f0130a23b ("ipv6: use dst6_mtu() instead of dst_mtu()")
> > Signed-off-by: Eric Dumazet <edumazet@google.com>
>
> Any strong opinon vs redirecting this one to the net-next tree? We are
> trying (with limited success :( to keep the amount of changes in net
> under control, and this looks like a minor performance optimization to me.
>
> If there is agreement, I can apply the patch there stripping the fixes
> tag without a repost.

Absolutely fine.

Paolo, feel free to use your own judgement on these minor things, you
do not have to ask for my permission.

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] ip6_tunnel: do not use dst6_mtu() in ip4ip6_err() and ip6erspan_tunnel_xmit()
  2026-06-09  9:13 [PATCH net] ip6_tunnel: do not use dst6_mtu() in ip4ip6_err() and ip6erspan_tunnel_xmit() Eric Dumazet
  2026-06-11  6:27 ` Ido Schimmel
  2026-06-11  9:53 ` Paolo Abeni
@ 2026-06-11 13:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-06-11 13:50 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: davem, kuba, pabeni, horms, idosch, dsahern, netdev, eric.dumazet

Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Tue,  9 Jun 2026 09:13:37 +0000 you wrote:
> This is a minor performance / conceptual fix.
> 
> 1) ip6erspan_tunnel_xmit()
> 
>   ERSPAN tunnel can mirror both IPv4 and IPv6 traffic, skb
>   (the packet being mirrored) can be an IPv4 packet,
>   and thus dst can be an IPv4 destination entry
> 
> [...]

Here is the summary with links:
  - [net] ip6_tunnel: do not use dst6_mtu() in ip4ip6_err() and ip6erspan_tunnel_xmit()
    https://git.kernel.org/netdev/net-next/c/6e12a8894e02

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-06-11 13:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-09  9:13 [PATCH net] ip6_tunnel: do not use dst6_mtu() in ip4ip6_err() and ip6erspan_tunnel_xmit() Eric Dumazet
2026-06-11  6:27 ` Ido Schimmel
2026-06-11  9:53 ` Paolo Abeni
2026-06-11 11:17   ` Eric Dumazet
2026-06-11 13:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox