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

From: Vikas Gupta

Date: Sun Dec 06 2026 - 03:39:14 EST


On Sat, Dec 5, 2026 at 8:16 PM <netdev-bot+sashiko@xxxxxxxxxx> wrote:
>
> 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] In bnge_refill_dflt_rss_ctxs()
> (drivers/net/ethernet/broadcom/bnge/bnge_vnic.c), the driver calls…
>
> --
>
> bnge: add ethtool support to manage RSS contexts
>
> This patch adds create, modify and remove ethtool callbacks for additional
> RSS contexts. Each context is backed by its own VNIC with its own
> indirection table and hash key. When the RX ring count changes at open,
> contexts with user tables 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
>
> [ ... ]
>
> > +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]
> Will user space get a stale indirection table in the RSS notification
> here?
>
> ethtool_rxfh_ctxs_resize() sends ETHTOOL_MSG_RSS_NTF for every context
> before it returns. At that point each table has only been resized in
> place:
>
> 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);
> }
>
> rss_prepare_ctx() copies ethtool_rxfh_context_indir(ctx) into the message
> when it is built. So listeners receive the table as spread over the old
> ring count.
>
> The loop after the resize then rewrites the default-table contexts with
> ethtool_rxfh_indir_default(i, bd->rx_nr_rings) and sends no further
> notification. bnge_hwrm_realloc_rss_ctx_vnic() programs the hardware from
> the refilled table, so the last RSS_NTF matches neither the context state
> nor the device.
>
> For example, if RX rings drop from 100 to 60, the table shrinks from 128 to
> 64 entries. The notified table holds entries 0..63 of the i % 100 spread,
> and entries 60..63 name RX queues that no longer exist.
>
> bnge_reserve_rings() already follows the opposite order for context 0:
>
> /* 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);
>
> A related case: when the ring count changes but the table size does not,
> no resize happens. The default contexts are then rewritten without any
> notification.
>
> Would it work to refill the default contexts under rss_lock before calling
> ethtool_rxfh_ctxs_resize()? The other option is to send a fresh RSS_NTF
> after the refill.

This isn't something the driver should handle — it belongs in the generic/core
layer rather than in individual drivers.

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

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature