Re: [PATCH net-next v9 05/10] bnge: add ethtool support to manage RSS contexts

From: netdev-bot+sashiko

Date: Tue Nov 24 2026 - 05:20:36 EST


Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] bnge_refill_dflt_rss_ctxs() in
drivers/net/ethernet/broadcom/bnge/bnge_vnic.c calls…
- [Low] The commit message says a user RSS context is deleted only when
the RX ring count changes at open "and the RSS table size changes with…

--

bnge: add ethtool support to manage RSS contexts

This commit adds the ethtool create/modify/remove RSS context callbacks.
Each context gets its own VNIC with its own indirection table and hash
key. It also adds handling for a ring count change at open: user
contexts that no longer fit are deleted, and contexts that use the
default table are resized and refilled.

> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_vnic.c b/drivers/net/ethernet/broadcom/bnge/bnge_vnic.c
> index a44971a7c74d3..7d587290c33ab 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_vnic.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_vnic.c

[ ... ]

> @@ -201,6 +222,89 @@ void bnge_hwrm_realloc_rss_ctx_vnic(struct bnge_net *bn)

[ ... ]

> +void bnge_check_rss_ctxs_lost(struct bnge_dev *bd, u16 new_rx_rings)
> +{

[ ... ]

> + if (bnge_cal_nr_rss_ctxs(bd->rx_nr_rings) !=
> + bnge_cal_nr_rss_ctxs(new_rx_rings)) {
> + lost = true;
> + } else {
> + for (i = 0; i < ctx->indir_size; i++) {
> + if (indir[i] >= new_rx_rings) {
> + lost = true;
> + break;
> + }
> + }
> + }
> +
> + if (lost) {
> + bnge_del_one_rss_ctx(bn, rss_ctx, true);
> + ethtool_rxfh_context_lost(bd->netdev, rss_ctx->index);
> + }

[Severity: Low]
The commit message says:

When the number of RX rings changes at open and the RSS table size
changes with it, a user RSS context whose table does not fit is
deleted and reported with ethtool_rxfh_context_lost().

Does that match the else branch here? A user context is also deleted
when bnge_cal_nr_rss_ctxs() returns the same value for the old and new
ring counts, as long as any indir[i] >= new_rx_rings.

For example, say firmware grants 6 RX rings instead of 8 at open. The
table stays at 64 entries, but a user context that steers to ring 7 is
still deleted through:

bnge_open_core()->bnge_reserve_rings()->bnge_check_rss_ctxs_lost()

and userspace gets an ETHTOOL_MSG_RSS_DELETE_NTF.

Could the commit message cover this case as well?

> + }
> + mutex_unlock(&bd->netdev->ethtool->rss_lock);
> +}
> +
> +void bnge_refill_dflt_rss_ctxs(struct bnge_dev *bd)
> +{

[ ... ]

> + if (resize) {
> + if (ethtool_rxfh_ctxs_can_resize(bd->netdev, tbl_size)) {
> + dev_warn(bd->dev,
> + "RSS contexts cannot be resized to %u entries\n",
> + tbl_size);
> + return;
> + }
> + ethtool_rxfh_ctxs_resize(bd->netdev, tbl_size);
> + }
> +
> + mutex_lock(&bd->netdev->ethtool->rss_lock);
> + xa_for_each(&bd->netdev->ethtool->rss_ctx, context, ctx) {
> + if (!ctx->indir_user_size)
> + bnge_set_dflt_rss_indir_tbl(bd, ctx);
> + }
> + mutex_unlock(&bd->netdev->ethtool->rss_lock);

[Severity: Medium]
Do the RSS notifications sent from here show the final indirection
tables of the default-table contexts?

ethtool_rxfh_ctxs_resize() in net/ethtool/common.c sends a notification
for each context right after the resize:

xa_for_each(&dev->ethtool->rss_ctx, context, ctx)
ethtool_rss_notify(dev, ETHTOOL_MSG_RSS_NTF, context);

The contexts with !ctx->indir_user_size only get their i % rx_nr_rings
tables in the loop that follows. No notification is sent after that.

For example, a default-table context created with 100 rings has a
128-entry table. Firmware then grants 50 rings at open, so the table
shrinks to 64 entries. The notification carries entries 0..63 of the
old table, and entries 50..63 point at queues that no longer exist. The
table that actually gets programmed is i % 50.

Context 0 already gets this ordering right in bnge_reserve_rings():

/* Notify only now, so the notification reports the new ring count
* and the reset indirection table.
*/
if (indir_lost)
ethtool_rxfh_indir_lost(bd->netdev);

Should the extra contexts be refilled before the resize notification
goes out? Alternatively, they could be notified again after
bnge_set_dflt_rss_indir_tbl() runs.

> }
>
> void bnge_clear_rss_ctxs(struct bnge_net *bn)

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261123100746.1975030-1-vikas.gupta%40broadcom.com