netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] rtnetlink: honor RTEXT_FILTER_SKIP_STATS in IFLA_STATS
@ 2025-10-23  8:34 Adrian Moreno
  2025-10-23 15:39 ` Nicolas Dichtel
  2025-10-24 14:20 ` Toke Høiland-Jørgensen
  0 siblings, 2 replies; 9+ messages in thread
From: Adrian Moreno @ 2025-10-23  8:34 UTC (permalink / raw)
  To: netdev
  Cc: toke, Adrian Moreno, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Kuniyuki Iwashima,
	Stanislav Fomichev, Xiao Liang, Nicolas Dichtel, Cong Wang,
	linux-kernel

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 &&
+	    rtnl_fill_stats(skb, dev))
 		goto nla_put_failure;
 
 	if (rtnl_fill_vf(skb, dev, ext_filter_mask))
-- 
2.51.0


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

* Re: [PATCH net-next] rtnetlink: honor RTEXT_FILTER_SKIP_STATS in IFLA_STATS
  2025-10-23  8:34 [PATCH net-next] rtnetlink: honor RTEXT_FILTER_SKIP_STATS in IFLA_STATS 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 14:20 ` Toke Høiland-Jørgensen
  1 sibling, 2 replies; 9+ messages in thread
From: Nicolas Dichtel @ 2025-10-23 15:39 UTC (permalink / raw)
  To: Adrian Moreno, netdev
  Cc: toke, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Kuniyuki Iwashima, Stanislav Fomichev, Xiao Liang,
	Cong Wang, linux-kernel

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().

> +	    rtnl_fill_stats(skb, dev))
>  		goto nla_put_failure;
>  
>  	if (rtnl_fill_vf(skb, dev, ext_filter_mask))


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

* Re: [PATCH net-next] rtnetlink: honor RTEXT_FILTER_SKIP_STATS in IFLA_STATS
  2025-10-23 15:39 ` Nicolas Dichtel
@ 2025-10-24  0:33   ` Jakub Kicinski
  2025-10-24  7:05   ` Adrián Moreno
  1 sibling, 0 replies; 9+ messages in thread
From: Jakub Kicinski @ 2025-10-24  0:33 UTC (permalink / raw)
  To: Nicolas Dichtel
  Cc: Adrian Moreno, netdev, toke, David S. Miller, Eric Dumazet,
	Paolo Abeni, Simon Horman, Kuniyuki Iwashima, Stanislav Fomichev,
	Xiao Liang, Cong Wang, linux-kernel

On Thu, 23 Oct 2025 17:39:09 +0200 Nicolas Dichtel wrote:
> > +	if (~ext_filter_mask & RTEXT_FILTER_SKIP_STATS &&  
> Maybe parentheses around this first condition?
> 
> The size could be adjusted accordingly in if_nlmsg_size().

Slight preference here for no brackets unless compiler complains 
(or needed for correctness, of course).

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

* Re: [PATCH net-next] rtnetlink: honor RTEXT_FILTER_SKIP_STATS in IFLA_STATS
  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
  1 sibling, 1 reply; 9+ messages in thread
From: Adrián Moreno @ 2025-10-24  7:05 UTC (permalink / raw)
  To: Nicolas Dichtel
  Cc: netdev, toke, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman, Kuniyuki Iwashima, Stanislav Fomichev,
	Xiao Liang, Cong Wang, linux-kernel

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.

Thanks.
Adrián

>
> > +	    rtnl_fill_stats(skb, dev))
> >  		goto nla_put_failure;
> >
> >  	if (rtnl_fill_vf(skb, dev, ext_filter_mask))
>


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

* Re: [PATCH net-next] rtnetlink: honor RTEXT_FILTER_SKIP_STATS in IFLA_STATS
  2025-10-24  7:05   ` Adrián Moreno
@ 2025-10-24  7:17     ` Nicolas Dichtel
  0 siblings, 0 replies; 9+ messages in thread
From: Nicolas Dichtel @ 2025-10-24  7:17 UTC (permalink / raw)
  To: Adrián Moreno
  Cc: netdev, toke, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman, Kuniyuki Iwashima, Stanislav Fomichev,
	Xiao Liang, Cong Wang, linux-kernel

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

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

* Re: [PATCH net-next] rtnetlink: honor RTEXT_FILTER_SKIP_STATS in IFLA_STATS
  2025-10-23  8:34 [PATCH net-next] rtnetlink: honor RTEXT_FILTER_SKIP_STATS in IFLA_STATS Adrian Moreno
  2025-10-23 15:39 ` Nicolas Dichtel
@ 2025-10-24 14:20 ` Toke Høiland-Jørgensen
  2025-10-24 14:35   ` Eric Dumazet
  1 sibling, 1 reply; 9+ messages in thread
From: Toke Høiland-Jørgensen @ 2025-10-24 14:20 UTC (permalink / raw)
  To: Adrian Moreno, netdev
  Cc: Adrian Moreno, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman, Kuniyuki Iwashima, Stanislav Fomichev,
	Xiao Liang, Nicolas Dichtel, Cong Wang, linux-kernel

Adrian Moreno <amorenoz@redhat.com> writes:

> 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 &&
> +	    rtnl_fill_stats(skb, dev))

Nit: I find this:

	if (!(ext_filter_mask & RTEXT_FILTER_SKIP_STATS) &&
	    rtnl_fill_stats(skb, dev))

more readable. It's a logical operation, so the bitwise negation is less
clear IMO.

-Toke


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

* Re: [PATCH net-next] rtnetlink: honor RTEXT_FILTER_SKIP_STATS in IFLA_STATS
  2025-10-24 14:20 ` Toke Høiland-Jørgensen
@ 2025-10-24 14:35   ` Eric Dumazet
  2025-10-24 14:59     ` Nicolas Dichtel
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Dumazet @ 2025-10-24 14:35 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen
  Cc: Adrian Moreno, netdev, David S. Miller, Jakub Kicinski,
	Paolo Abeni, Simon Horman, Kuniyuki Iwashima, Stanislav Fomichev,
	Xiao Liang, Nicolas Dichtel, Cong Wang, linux-kernel

On Fri, Oct 24, 2025 at 7:20 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>
> Adrian Moreno <amorenoz@redhat.com> writes:
>
> > 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 &&
> > +         rtnl_fill_stats(skb, dev))
>
> Nit: I find this:
>
>         if (!(ext_filter_mask & RTEXT_FILTER_SKIP_STATS) &&
>             rtnl_fill_stats(skb, dev))
>
> more readable. It's a logical operation, so the bitwise negation is less
> clear IMO.
>

Same for me. I guess it is copy/pasted from line 1162 (in rtnl_vfinfo_size())

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

* Re: [PATCH net-next] rtnetlink: honor RTEXT_FILTER_SKIP_STATS in IFLA_STATS
  2025-10-24 14:35   ` Eric Dumazet
@ 2025-10-24 14:59     ` Nicolas Dichtel
  2025-10-24 15:24       ` Adrián Moreno
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Dichtel @ 2025-10-24 14:59 UTC (permalink / raw)
  To: Eric Dumazet, Toke Høiland-Jørgensen
  Cc: Adrian Moreno, netdev, David S. Miller, Jakub Kicinski,
	Paolo Abeni, Simon Horman, Kuniyuki Iwashima, Stanislav Fomichev,
	Xiao Liang, Cong Wang, linux-kernel



Le 24/10/2025 à 16:35, Eric Dumazet a écrit :
> On Fri, Oct 24, 2025 at 7:20 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>>
>> Adrian Moreno <amorenoz@redhat.com> writes:
>>
>>> 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 &&
>>> +         rtnl_fill_stats(skb, dev))
>>
>> Nit: I find this:
>>
>>         if (!(ext_filter_mask & RTEXT_FILTER_SKIP_STATS) &&
>>             rtnl_fill_stats(skb, dev))
>>
>> more readable. It's a logical operation, so the bitwise negation is less
>> clear IMO.
>>
> 
> Same for me. I guess it is copy/pasted from line 1162 (in rtnl_vfinfo_size())
I agree. I didn't point it out because there are several occurrences in this
file (line 1599 / rtnl_fill_vfinfo()).

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

* Re: [PATCH net-next] rtnetlink: honor RTEXT_FILTER_SKIP_STATS in IFLA_STATS
  2025-10-24 14:59     ` Nicolas Dichtel
@ 2025-10-24 15:24       ` Adrián Moreno
  0 siblings, 0 replies; 9+ messages in thread
From: Adrián Moreno @ 2025-10-24 15:24 UTC (permalink / raw)
  To: Nicolas Dichtel
  Cc: Eric Dumazet, Toke Høiland-Jørgensen, netdev,
	David S. Miller, Jakub Kicinski, Paolo Abeni, Simon Horman,
	Kuniyuki Iwashima, Stanislav Fomichev, Xiao Liang, Cong Wang,
	linux-kernel

On Fri, Oct 24, 2025 at 04:59:26PM +0200, Nicolas Dichtel wrote:
>
>
> Le 24/10/2025 à 16:35, Eric Dumazet a écrit :
> > On Fri, Oct 24, 2025 at 7:20 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
> >>
> >> Adrian Moreno <amorenoz@redhat.com> writes:
> >>
> >>> 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 &&
> >>> +         rtnl_fill_stats(skb, dev))
> >>
> >> Nit: I find this:
> >>
> >>         if (!(ext_filter_mask & RTEXT_FILTER_SKIP_STATS) &&
> >>             rtnl_fill_stats(skb, dev))
> >>
> >> more readable. It's a logical operation, so the bitwise negation is less
> >> clear IMO.
> >>
> >
> > Same for me. I guess it is copy/pasted from line 1162 (in rtnl_vfinfo_size())
> I agree. I didn't point it out because there are several occurrences in this
> file (line 1599 / rtnl_fill_vfinfo()).
>

I glanced through this file and assumed it was the agreed style but
looking at other flags, RTEXT_FILTER_SKIP_STATS seems to be the
exception.

I'll change it, and also send another patch changing the style of the
other ocurrances.

Thanks.
Adrián


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

end of thread, other threads:[~2025-10-24 15:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-23  8:34 [PATCH net-next] rtnetlink: honor RTEXT_FILTER_SKIP_STATS in IFLA_STATS 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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).