[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZrH2WFeyZeFfk3K9@LQ3V64L9R2.home>
Date: Tue, 6 Aug 2024 11:09:28 +0100
From: Joe Damato <jdamato@...tly.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
pabeni@...hat.com, dxu@...uu.xyz, ecree.xilinx@...il.com,
przemyslaw.kitszel@...el.com, donald.hunter@...il.com,
gal.pressman@...ux.dev, tariqt@...dia.com,
willemdebruijn.kernel@...il.com
Subject: Re: [PATCH net-next v2 09/12] ethtool: rss: support dumping RSS
contexts
On Mon, Aug 05, 2024 at 02:59:33PM -0700, Jakub Kicinski wrote:
> On Sat, 3 Aug 2024 19:11:28 +0100 Joe Damato wrote:
> > > +struct rss_nl_dump_ctx {
> > > + unsigned long ifindex;
> > > + unsigned long ctx_idx;
> > > +
> > > + unsigned int one_ifindex;
> >
> > My apologies: I'm probably just not familiar enough with the code,
> > but I'm having a hard time understanding what the purpose of
> > one_ifindex is.
> >
> > I read both ethnl_rss_dump_start and ethnl_rss_dumpit, but I'm still
> > not following what this is used for; it'll probably be obvious in
> > retrospect once you explain it, but I suppose my feedback is that a
> > comment or something would be really helpful :)
>
> Better name would probably help, but can't think of any.
>
> User can (optionally) pass an ifindex/ifname to the dump, to dump
> contexts only for the specified ifindex. If they do we "preset"
> the ifindex and one_ifindex:
> + if (req_info.dev) {
> + ctx->one_ifindex = req_info.dev->ifindex;
> + ctx->ifindex = ctx->one_ifindex;
> + ethnl_parse_header_dev_put(&req_info);
> + req_info.dev = NULL;
> + }
>
> and then the iteration is stopped after first full pass:
>
> + rtnl_lock();
> + for_each_netdev_dump(net, dev, ctx->ifindex) {
> + if (ctx->one_ifindex && ctx->one_ifindex != ctx->ifindex)
> + break;
Ah, OK; that all makes sense. Thanks for the explanation.
> Unfortunately we don't have any best practice for handling filtering
> in dumps. I find this cleaner than approaches I previously tried, but
> we'll see if it stands the test of time.
>
> I'll add the following comment:
>
> /* User wants to dump contexts for one ifindex only */
Sounds good. If you like, you can also add:
Reviewed-by: Joe Damato <jdamato@...tly.com>
Powered by blists - more mailing lists