[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d99387ab-7883-43a3-99de-fea37026cfb1@intel.com>
Date: Tue, 6 Aug 2024 12:44:28 +0200
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: Jakub Kicinski <kuba@...nel.org>, Joe Damato <jdamato@...tly.com>
CC: <davem@...emloft.net>, <netdev@...r.kernel.org>, <edumazet@...gle.com>,
<pabeni@...hat.com>, <dxu@...uu.xyz>, <ecree.xilinx@...il.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 8/5/24 23:59, 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.
perhaps:
ifindex -> if_iter
one_ifindex -> if_requested
(I would also like 'ifc' instead of 'if', for the obvious reasons)
>
> 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;
>
> 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.
This code is clean, but by just looking at the struct one could not
expect it though :/ Perhaps a rename could help, or just wait until
people learn it (I remember you have recently explained this dump
scheme to me :))
>
> I'll add the following comment:
>
> /* User wants to dump contexts for one ifindex only */
Powered by blists - more mailing lists