[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ff8dea3e-ff4e-af27-4b96-3fcf1092cc52@gmail.com>
Date: Tue, 6 Aug 2024 15:24:50 +0100
From: Edward Cree <ecree.xilinx@...il.com>
To: Jakub Kicinski <kuba@...nel.org>, davem@...emloft.net
Cc: netdev@...r.kernel.org, edumazet@...gle.com, pabeni@...hat.com,
dxu@...uu.xyz, przemyslaw.kitszel@...el.com, donald.hunter@...il.com,
gal.pressman@...ux.dev, tariqt@...dia.com, willemdebruijn.kernel@...il.com,
jdamato@...tly.com
Subject: Re: [PATCH net-next v2 09/12] ethtool: rss: support dumping RSS
contexts
On 03/08/2024 05:26, Jakub Kicinski wrote:
> Now that we track RSS contexts in the core we can easily dump
> them. This is a major introspection improvement, as previously
> the only way to find all contexts would be to try all ids
> (of which there may be 2^32 - 1).
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
...
> + if (!ctx->ctx_idx) {
> + ret = rss_dump_one_ctx(skb, cb, dev, 0);
> + if (ret)
> + return ret;
> + ctx->ctx_idx++;
> + }
Maybe comment this block with something like "context 0 is
not stored in the XArray" to make clear why this is split
out from a loop that looks like it should be able to handle
it.
> +
> + for (; xa_find(&dev->ethtool->rss_ctx, &ctx->ctx_idx,
> + ULONG_MAX, XA_PRESENT); ctx->ctx_idx++) {
> + ret = rss_dump_one_ctx(skb, cb, dev, ctx->ctx_idx);
> + if (ret)
> + return ret;
> + }
> + ctx->ctx_idx = 0;
Feels like there has to be a way to do this with
xa_for_each_start()? Something like (untested):
struct ethtool_rxfh_context *rss_ctx;
xa_for_each_start(&dev->ethtool->rss_ctx, ctx->ctx_idx,
rss_ctx, ctx->ctx_idx) {
ret = rss_dump_one_ctx(skb, cb, dev, ctx->ctx_idx);
if (ret)
return ret;
}
ctx->ctx_idx = 0;
Powered by blists - more mailing lists