From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f202.google.com (mail-qk1-f202.google.com [209.85.222.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30FED38332A for ; Tue, 9 Jun 2026 09:13:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780996421; cv=none; b=clJzrN+CfwPt/IR/H630PTdbH64x6wzU9R3kiBOCUmiCH6unacSsNzBWvxcL7w9UIQu1N/pX2cZwbA6B+PuvzQHwR7avqUWQ6Z5xq4sb5TvMOIkGhdRC947Uu4pd8LeqRrsHvhninF3tVGrBYlAwTr4Q48sNcdtk3j8e+zlaJNM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780996421; c=relaxed/simple; bh=JBliuMMBBb835k2RTsRIXglL3AXPaSzhQ3dz/EuTtAA=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=CzEkDzIeaUB3G0ox7qNjaZlalZXu/4zDErqwhuLbYShCBGmeT0V4jvarcoPEzvrN8AVQoFavW7miaSy/XLnBUIM39whwA/1WvG1r7h0yO+xiLpeQobfYdxrK2qzBAE/Ytfsyby7pPC/KG7vd8RuvU3NVC0UtjnivO+QfHlG+I1E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=u7LKDy3S; arc=none smtp.client-ip=209.85.222.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="u7LKDy3S" Received: by mail-qk1-f202.google.com with SMTP id af79cd13be357-915767b341eso613602285a.3 for ; Tue, 09 Jun 2026 02:13:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780996419; x=1781601219; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=PI2wLMpJY+rqjtRmr0TC4yuW+obsBoJePrE49LptRDA=; b=u7LKDy3S+dJsMuFvm6HJxMKtJvBG1Msuykq5fM+h86+VKWOOP1uGQhJehonCO3gbjM KNb5D4sMENr38+S/hmGhvizVmq64SNN74NSTgSArN5/rEETMz9j7BHJURV/BUmTb1Ude /ujO8TfJdD/Sjz3ODqS3kIIRpNlqy8UFrZyyIaBTk1GU+LLFQA15HkcynkP1W0S2LYbh Hpx1FHdxdYO4IsqNSHHx6/lV2aK47OgMymnkca72Vnpk9rbfIz5HG9vZPdgnHqheAncP jmNSXp4OvPxePplWKGPIEr8ZDKJUy9Px+fJ11/H1HTLJj04cy8d49OOS+R1thE8tKwlH g7XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780996419; x=1781601219; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=PI2wLMpJY+rqjtRmr0TC4yuW+obsBoJePrE49LptRDA=; b=UP3128F7XeD1pdyqq1fyreziOMgnv0QB+QlIXPk8oM2lLaSZCCCHGK9mtjwsGRtL5d 62mR+r0wio7MkKkpOXl9iQCXVsqctIJiDiPQCO1f03XYyzr5j9FMBOHVb2vah2bXA6Qo IFIqNRfJb714/rR4jph8YYlVtzzkt2zgWO4TaAfFhLqMb9iJXBCszJY4t2S6AWKSCAZc 6pfdyyb1UcpWBX06vRyehmui4HBGTbmhZXH8rGQ65AUnEp1tMhLfp1/nNTsvHsIze8eu wjza+ak2+wP8kpcqQIKzBXNzlJ4Q9WC8v1Lohr7Qtbyv0Gt+mI2QRmJJ5YOLdSGiU6jx L4rA== X-Forwarded-Encrypted: i=1; AFNElJ+1wd8oplgbxPSIG29YyTAyOu2O80wzXeNi0ZrtlKLS+gGOQ28EO+UlEIF3L9uy4ibOTab/Usk=@vger.kernel.org X-Gm-Message-State: AOJu0Yy2JotA+D7k00Rv4r8WgDnwfZa0zSiSNQjaC2ysZI0Gd4Q5R5H1 H9QNjx5kHUeGtSdlqYPM2x1oxHgpbIsyNuB15eEavyrLcZpXi7Q9u/5bgwttQvxBHJi8sp89854 pL2hOge+fZSt6ZQ== X-Received: from qkf18.prod.google.com ([2002:a05:620a:a212:b0:915:786a:4300]) (user=edumazet job=prod-delivery.src-stubby-dispatcher) by 2002:a05:620a:2a05:b0:915:8f08:5fa7 with SMTP id af79cd13be357-915a9db4f9amr3078237885a.52.1780996418725; Tue, 09 Jun 2026 02:13:38 -0700 (PDT) Date: Tue, 9 Jun 2026 09:13:37 +0000 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.54.0.1064.gd145956f57-goog Message-ID: <20260609091337.2672441-1-edumazet@google.com> Subject: [PATCH net] ip6_tunnel: do not use dst6_mtu() in ip4ip6_err() and ip6erspan_tunnel_xmit() From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: Simon Horman , Ido Schimmel , David Ahern , netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet Content-Type: text/plain; charset="UTF-8" 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 --- 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