mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: "Adrián Moreno" <amorenoz@redhat.com>
Cc: netdev@vger.kernel.org, toke@redhat.com,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Kuniyuki Iwashima <kuniyu@google.com>,
	Stanislav Fomichev <sdf@fomichev.me>,
	Xiao Liang <shaw.leon@gmail.com>,
	Cong Wang <cong.wang@bytedance.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] rtnetlink: honor RTEXT_FILTER_SKIP_STATS in IFLA_STATS
Date: Fri, 24 Oct 2025 09:17:38 +0200	[thread overview]
Message-ID: <475d1b3a-53d2-4778-ab56-0df25847c50a@6wind.com> (raw)
In-Reply-To: <CAG=2xmNBZ1V7kh7Y0425NPTLJCVyhLB82zNC6GpUN6cXJoyBMw@mail.gmail.com>

Le 24/10/2025 à 09:05, Adrián Moreno a écrit :
> On Thu, Oct 23, 2025 at 05:39:09PM +0200, Nicolas Dichtel wrote:
>> Le 23/10/2025 à 10:34, Adrian Moreno a écrit :
>>> Gathering interface statistics can be a relatively expensive operation
>>> on certain systems as it requires iterating over all the cpus.
>>>
>>> RTEXT_FILTER_SKIP_STATS was first introduced [1] to skip AF_INET6
>>> statistics from interface dumps and it was then extended [2] to
>>> also exclude IFLA_VF_INFO.
>>>
>>> The semantics of the flag does not seem to be limited to AF_INET
>>> or VF statistics and having a way to query the interface status
>>> (e.g: carrier, address) without retrieving its statistics seems
>>> reasonable. So this patch extends the use RTEXT_FILTER_SKIP_STATS
>>> to also affect IFLA_STATS.
>>>
>>> [1] https://lore.kernel.org/all/20150911204848.GC9687@oracle.com/
>>> [2] https://lore.kernel.org/all/20230611105108.122586-1-gal@nvidia.com/
>>>
>>> Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
>>> ---
>>>  net/core/rtnetlink.c | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
>>> index 8040ff7c356e..88d52157ef1c 100644
>>> --- a/net/core/rtnetlink.c
>>> +++ b/net/core/rtnetlink.c
>>> @@ -2123,7 +2123,8 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb,
>>>  	if (rtnl_phys_switch_id_fill(skb, dev))
>>>  		goto nla_put_failure;
>>>
>>> -	if (rtnl_fill_stats(skb, dev))
>>> +	if (~ext_filter_mask & RTEXT_FILTER_SKIP_STATS &&
>> Maybe parentheses around this first condition?
>>
>> The size could be adjusted accordingly in if_nlmsg_size().
> 
> Good point! I'll adjust the size. Regarding the parentheses, I can wait
> a bit to see if someone else weights in. I don't have a very strong
> opinion about it.
No pb on my side. I was asking myself what the preference is on netdev :)

Thansk,
Nicolas

  reply	other threads:[~2025-10-24  7:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-23  8:34 Adrian Moreno
2025-10-23 15:39 ` Nicolas Dichtel
2025-10-24  0:33   ` Jakub Kicinski
2025-10-24  7:05   ` Adrián Moreno
2025-10-24  7:17     ` Nicolas Dichtel [this message]
2025-10-24 14:20 ` Toke Høiland-Jørgensen
2025-10-24 14:35   ` Eric Dumazet
2025-10-24 14:59     ` Nicolas Dichtel
2025-10-24 15:24       ` Adrián Moreno

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=475d1b3a-53d2-4778-ab56-0df25847c50a@6wind.com \
    --to=nicolas.dichtel@6wind.com \
    --cc=amorenoz@redhat.com \
    --cc=cong.wang@bytedance.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=shaw.leon@gmail.com \
    --cc=toke@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

all inboxes | Powered by JetHome®