Re: [PATCH net-next v10 05/10] bnge: add ethtool support to manage RSS contexts
From: netdev-bot+sashiko
Date: Sun Nov 29 2026 - 07:46:51 EST
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
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()
(drivers/net/ethernet/broadcom/bnge/bnge_vnic.c) calls…
--
bnge: add ethtool support to manage RSS contexts
This adds ethtool create/modify/remove callbacks for RSS contexts in the
bnge driver. Each context gets its own VNIC with its own indirection table
and hash key. When the RX ring count changes, user contexts whose tables
no longer fit are deleted, and contexts using the default table are
resized and refilled.
> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_resc.c b/drivers/net/ethernet/broadcom/bnge/bnge_resc.c
> index c1064e53cfbf8..18f01b41b8cc1 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_resc.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_resc.c
[ ... ]
> @@ -403,7 +422,8 @@ int bnge_reserve_rings(struct bnge_dev *bd)
> if (old_rx_rings != bd->hw_resc.resv_rx_rings || rx_changed) {
> if (!bd->netdev || indir_lost ||
> !netif_is_rxfh_configured(bd->netdev))
> - bnge_set_dflt_rss_indir_tbl(bd);
> + bnge_set_dflt_rss_indir_tbl(bd, NULL);
> + bnge_refill_dflt_rss_ctxs(bd);
> }
>
> /* Notify only now, so the notification reports the new ring count
[ ... ]
> 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
[ ... ]
> +void bnge_refill_dflt_rss_ctxs(struct bnge_dev *bd)
> +{
> + struct ethtool_rxfh_context *ctx;
> + unsigned long context;
> + bool resize = false;
> + u32 tbl_size;
> +
> + if (!bd->netdev)
> + return;
> +
> + tbl_size = bnge_get_rxfh_indir_size(bd);
> + mutex_lock(&bd->netdev->ethtool->rss_lock);
> + xa_for_each(&bd->netdev->ethtool->rss_ctx, context, ctx) {
> + if (ctx->indir_size != tbl_size) {
> + resize = true;
> + break;
> + }
> + }
> + mutex_unlock(&bd->netdev->ethtool->rss_lock);
> +
> + /* bnge_check_rss_ctxs_lost() already dropped every context with a
> + * user table when the table size changed, even if the table could
> + * have been folded. Only the default contexts are resized here.
> + */
> + 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]
Can netlink RSS listeners be left with a stale view of these contexts
after the ring count changes?
ethtool_rxfh_ctxs_resize() sends ETHTOOL_MSG_RSS_NTF for every context
as soon as it updates ctx->indir_size:
net/ethtool/common.c:ethtool_rxfh_ctxs_resize() {
...
xa_for_each(&dev->ethtool->rss_ctx, context, ctx) {
ethtool_rxfh_resize(ethtool_rxfh_context_indir(ctx),
ctx->indir_size, new_indir_size);
ctx->indir_size = new_indir_size;
}
mutex_unlock(&dev->ethtool->rss_lock);
xa_for_each(&dev->ethtool->rss_ctx, context, ctx)
ethtool_rss_notify(dev, ETHTOOL_MSG_RSS_NTF, context);
}
The message is built right away from the context's current table. A
shrink does not touch the data, so the notification still carries the old
i % old_rx_rings spread. That spread can name RX rings that no longer
exist.
The loop that follows then rewrites the default-table contexts with
i % bd->rx_nr_rings. No notification is sent for that final state.
The ring count can also change without crossing a table size boundary
(for example 8 -> 4 rings). In that case resize stays false, and these
contexts are rewritten with no notification at all.
bnge_reserve_rings() sends ethtool_rxfh_indir_lost() for context 0 only
after the table has been reset. Should the notifications for these
contexts also report the refilled tables?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125115434.2080590-1-vikas.gupta%40broadcom.com