From: netdev-bot+sashiko@kernel.org
To: vikas.gupta@broadcom.com
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
bhargava.marreddy@broadcom.com, rahul-rg.gupta@broadcom.com,
vsrama-krishna.nemani@broadcom.com,
rajashekar.hudumula@broadcom.com, dharmender.garg@broadcom.com,
ajit.khaparde@broadcom.com
Subject: Re: [PATCH net-next v11 05/10] bnge: add ethtool support to manage RSS contexts
Date: Tue, 01 Dec 2026 06:39:40 +0000 [thread overview]
Message-ID: <179610718092.3146.10172007538898640839@kernel.org> (raw)
In-Reply-To: <20261130055736.2306367-6-vikas.gupta@broadcom.com>
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 drivers/net/ethernet/broadcom/bnge/bnge_vnic.c,
bnge_refill_dflt_rss_ctxs() sends RSS notifications with the wrong…
--
bnge: add ethtool support to manage RSS contexts
This patch adds ethtool callbacks to create, modify and remove RSS
contexts. Each context gets its own VNIC with its own indirection table
and hash key. When the RX ring count changes, contexts whose user tables
no longer fit are deleted. Contexts that use 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);
> }
[ ... ]
> 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]
Does this send RSS notifications that carry the wrong indirection table
for contexts using the default table?
ethtool_rxfh_ctxs_resize() in net/ethtool/common.c replicates the old
entries into the new size and then notifies each context:
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 ETHTOOL_MSG_RSS_NTF payload is built right away from
ethtool_rxfh_context_indir(ctx), so it contains the old ring layout
stretched to the new size.
Only after that does bnge_refill_dflt_rss_ctxs() overwrite the table
with i % bd->rx_nr_rings for the new ring count.
bnge_fill_hw_rss_tbl() later programs that rewritten table into the
VNIC. No second notification is sent.
For example, going from 64 to 128 entries, the notified entry 64 is the
old tbl[0] == 0. The stored and programmed value is 64 % M, where M is
the new ring count.
When the ring count changes but bnge_get_rxfh_indir_size() stays the
same, there is no resize at all. The default context tables are
rewritten and no notification goes out.
In both cases, a listener such as ethtool --monitor ends up with a table
that matches neither the kernel state nor the hardware. Could the
default contexts be refilled first, with the notifications sent after
the final table is written?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130055736.2306367-1-vikas.gupta%40broadcom.com
next prev parent reply other threads:[~2026-12-01 6:39 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 5:57 [PATCH net-next v11 00/10] add features to bnge Vikas Gupta
2026-11-30 5:57 ` [PATCH net-next v11 01/10] bnge: restructure VNIC and filter code Vikas Gupta
2026-11-30 5:57 ` [PATCH net-next v11 02/10] bnge: add NTUPLE/ARFS VNIC Vikas Gupta
2026-12-01 6:39 ` netdev-bot+sashiko
2026-11-30 5:57 ` [PATCH net-next v11 03/10] bnge: add helper functions for multi RSS contexts Vikas Gupta
2026-12-01 6:39 ` netdev-bot+sashiko
2026-11-30 5:57 ` [PATCH net-next v11 04/10] bnge: add RXFH ethtool support Vikas Gupta
2026-12-01 6:39 ` netdev-bot+sashiko
2026-11-30 5:57 ` [PATCH net-next v11 05/10] bnge: add ethtool support to manage RSS contexts Vikas Gupta
2026-12-01 6:39 ` netdev-bot+sashiko [this message]
2026-11-30 5:57 ` [PATCH net-next v11 06/10] bnge: remove refcount from L2 filter Vikas Gupta
2026-11-30 5:57 ` [PATCH net-next v11 07/10] bnge: add NTUPLE filter infrastructure Vikas Gupta
2026-12-01 6:39 ` netdev-bot+sashiko
2026-11-30 5:57 ` [PATCH net-next v11 08/10] bnge: add NTUPLE filter support in ethtool Vikas Gupta
2026-12-01 6:39 ` netdev-bot+sashiko
2026-11-30 5:57 ` [PATCH net-next v11 09/10] bnge: add aRFS flow steering ndo support Vikas Gupta
2026-12-01 6:39 ` netdev-bot+sashiko
2026-11-30 5:57 ` [PATCH net-next v11 10/10] bnge: add cpu_rmap support for IRQ affinity Vikas Gupta
2026-12-01 6:39 ` netdev-bot+sashiko
2026-12-01 10:12 ` Vikas Gupta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179610718092.3146.10172007538898640839@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=ajit.khaparde@broadcom.com \
--cc=andrew+netdev@lunn.ch \
--cc=bhargava.marreddy@broadcom.com \
--cc=davem@davemloft.net \
--cc=dharmender.garg@broadcom.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rahul-rg.gupta@broadcom.com \
--cc=rajashekar.hudumula@broadcom.com \
--cc=vikas.gupta@broadcom.com \
--cc=vsrama-krishna.nemani@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®