[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAG=2xmOfirDS58uwj=eSsn1KDrkX3K936SN=cCU4ARw9WSaogQ@mail.gmail.com>
Date: Mon, 3 Nov 2025 10:29:34 -0500
From: Adrián Moreno <amorenoz@...hat.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, nicolas.dichtel@...nd.com, toke@...hat.com,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
Kuniyuki Iwashima <kuniyu@...gle.com>, Stanislav Fomichev <sdf@...ichev.me>, Xiao Liang <shaw.leon@...il.com>,
Cong Wang <cong.wang@...edance.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v2] rtnetlink: honor RTEXT_FILTER_SKIP_STATS in IFLA_STATS
On Thu, Oct 30, 2025 at 06:20:57PM -0700, Jakub Kicinski wrote:
> On Wed, 29 Oct 2025 09:01:52 +0100 Adrian Moreno wrote:
> > --- a/net/core/rtnetlink.c
> > +++ b/net/core/rtnetlink.c
> > @@ -1275,8 +1275,9 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev,
> > + nla_total_size(IFALIASZ) /* IFLA_IFALIAS */
> > + nla_total_size(IFNAMSIZ) /* IFLA_QDISC */
> > + nla_total_size_64bit(sizeof(struct rtnl_link_ifmap))
> > - + nla_total_size(sizeof(struct rtnl_link_stats))
> > - + nla_total_size_64bit(sizeof(struct rtnl_link_stats64))
> > + + ((ext_filter_mask & RTEXT_FILTER_SKIP_STATS) ? 0 :
> > + (nla_total_size(sizeof(struct rtnl_link_stats)) +
> > + nla_total_size_64bit(sizeof(struct rtnl_link_stats64))))
> > + nla_total_size(MAX_ADDR_LEN) /* IFLA_ADDRESS */
> > + nla_total_size(MAX_ADDR_LEN) /* IFLA_BROADCAST */
> > + nla_total_size(4) /* IFLA_TXQLEN */
>
> Forgive me but now I'm gonna nit pick ;)
> Please break this out into a proper if condition.
> It's quite hard to read.
>
> size_t size;
>
> size = NLMSG_ALIGN(sizeof(struct ifinfomsg))
> + /* .. litany .. */
>
> if (!(ext_filter_mask & RTEXT_FILTER_SKIP_STATS))
> size += nla_total_size(sizeof(struct rtnl_link_stats)) +
> nla_total_size_64bit(sizeof(struct rtnl_link_stats64));
>
> return size;
Sure, I'll send V3.
> --
> pw-bot: cr
>
Powered by blists - more mailing lists