Netdev List
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>, David Ahern <dsahern@kernel.org>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com
Subject: Re: [PATCH v2 net-next 2/2] ipv6: frags: cleanup __IP6_INC_STATS() confusion
Date: Wed, 27 May 2026 10:44:35 +0300	[thread overview]
Message-ID: <20260527074435.GB434943@shredder> (raw)
In-Reply-To: <20260526145529.3587126-3-edumazet@google.com>

On Tue, May 26, 2026 at 02:55:29PM +0000, Eric Dumazet wrote:
> After commits e1ae5c2ea478 ("vrf: Increment Icmp6InMsgs on the original
> netdev") and bdb7cc643fc9 ("ipv6: Count interface receive statistics
> on the ingress netdev") net/ipv6/reassembly.c uses three different
> ways to reach idev in various __IP6_INC_STATS() calls.
> 
> - ip6_dst_idev(skb_dst(skb))
> - __in6_dev_get_safely(skb->dev)
> - __in6_dev_stats_get(skb->dev)
> 
> Lets centralize this from ipv6_frag_rcv() and use __in6_dev_stats_get().
> 
> Note that ipv6_frag_rcv() tests if skb->dev could be NULL already, so
> I chose to also guard against NULL, but we probably can remove the
> tests in a followup patch, because I do not think skb->dev could be NULL.
> 
> iif = skb->dev ? skb->dev->ifindex : 0;
> 
> idev can be NULL, __IP6_INC_STATS() deals with this possibility.
> 
> Small code size reduction as a bonus.
> 
> $ scripts/bloat-o-meter -t vmlinux.old vmlinux.new
> add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-145 (-145)
> Function                                     old     new   delta
> ipv6_frag_rcv                               2399    2362     -37
> ip6_frag_reasm                               705     597    -108
> Total: Before=31455552, After=31455407, chg -0.00%
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

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

  reply	other threads:[~2026-05-27  7:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26 14:55 [PATCH v2 net-next 0/2] ipv6: frags: adopt __in6_dev_stats_get() a bit more Eric Dumazet
2026-05-26 14:55 ` [PATCH v2 net-next 1/2] ipv6: guard against possible NULL deref in __in6_dev_stats_get() Eric Dumazet
2026-05-27  7:44   ` Ido Schimmel
2026-05-26 14:55 ` [PATCH v2 net-next 2/2] ipv6: frags: cleanup __IP6_INC_STATS() confusion Eric Dumazet
2026-05-27  7:44   ` Ido Schimmel [this message]
2026-05-28  0:40 ` [PATCH v2 net-next 0/2] ipv6: frags: adopt __in6_dev_stats_get() a bit more patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260527074435.GB434943@shredder \
    --to=idosch@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox