mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 v9 05/10] bnge: add ethtool support to manage RSS contexts
Date: Tue, 24 Nov 2026 10:20:29 +0000	[thread overview]
Message-ID: <179551562988.3135.2859794460541679817@kernel.org> (raw)
In-Reply-To: <20261123100746.1975030-6-vikas.gupta@broadcom.com>

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

  reply	other threads:[~2026-11-24 10:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 10:07 [PATCH net-next v9 00/10] add features to bnge Vikas Gupta
2026-11-23 10:07 ` [PATCH net-next v9 01/10] bnge: restructure VNIC and filter code Vikas Gupta
2026-11-23 10:07 ` [PATCH net-next v9 02/10] bnge: add NTUPLE/ARFS VNIC Vikas Gupta
2026-11-24 10:20   ` netdev-bot+sashiko
2026-11-23 10:07 ` [PATCH net-next v9 03/10] bnge: add helper functions for multi RSS contexts Vikas Gupta
2026-11-23 10:07 ` [PATCH net-next v9 04/10] bnge: add RXFH ethtool support Vikas Gupta
2026-11-24 10:20   ` netdev-bot+sashiko
2026-11-23 10:07 ` [PATCH net-next v9 05/10] bnge: add ethtool support to manage RSS contexts Vikas Gupta
2026-11-24 10:20   ` netdev-bot+sashiko [this message]
2026-11-23 10:07 ` [PATCH net-next v9 06/10] bnge: remove refcount from L2 filter Vikas Gupta
2026-11-24 10:20   ` netdev-bot+sashiko
2026-11-23 10:07 ` [PATCH net-next v9 07/10] bnge: add NTUPLE filter infrastructure Vikas Gupta
2026-11-24 10:20   ` netdev-bot+sashiko
2026-11-23 10:07 ` [PATCH net-next v9 08/10] bnge: add NTUPLE filter support in ethtool Vikas Gupta
2026-11-24 10:20   ` netdev-bot+sashiko
2026-11-23 10:07 ` [PATCH net-next v9 09/10] bnge: add aRFS flow steering ndo support Vikas Gupta
2026-11-24 10:20   ` netdev-bot+sashiko
2026-11-23 10:07 ` [PATCH net-next v9 10/10] bnge: add cpu_rmap support for IRQ affinity Vikas Gupta
2026-11-24 10:20   ` netdev-bot+sashiko

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=179551562988.3135.2859794460541679817@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®