All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Björn Töpel" <bjorn@kernel.org>
To: Michael Chan <michael.chan@broadcom.com>,
	Pavan Chebbi <pavan.chebbi@broadcom.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	linux-kselftest@vger.kernel.org
Cc: "Björn Töpel" <bjorn@kernel.org>,
	"Willem de Bruijn" <willemb@google.com>
Subject: [PATCH net-next 2/5] bnxt_en: Resize RSS contexts on channel count change
Date: Tue,  3 Mar 2026 19:15:30 +0100	[thread overview]
Message-ID: <20260303181535.2671734-3-bjorn@kernel.org> (raw)
In-Reply-To: <20260303181535.2671734-1-bjorn@kernel.org>

bnxt_set_channels() rejects channel changes that alter the RSS table
size when IFF_RXFH_CONFIGURED is set, because non-default context
sizes were locked at creation.

Replace the rejection with the new resize helpers. All validation runs
before any mutation:

 1. ethtool_rxfh_indir_can_resize() checks context 0.
 2. ethtool_rxfh_contexts_resize_all() validates and resizes
    all non-default contexts (all-or-none).
 3. ethtool_rxfh_indir_resize() applies context 0 changes.

When context 0 uses defaults (!IFF_RXFH_CONFIGURED), steps 1 and 3 are
skipped; the driver regenerates the table via
bnxt_set_dflt_rss_indir_tbl().

Signed-off-by: Björn Töpel <bjorn@kernel.org>
---
 .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 23 +++++++++++++++----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index 26fcd52c8a61..7608e5d95630 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -977,11 +977,24 @@ static int bnxt_set_channels(struct net_device *dev,
 		tx_xdp = req_rx_rings;
 	}
 
-	if (bnxt_get_nr_rss_ctxs(bp, req_rx_rings) !=
-	    bnxt_get_nr_rss_ctxs(bp, bp->rx_nr_rings) &&
-	    netif_is_rxfh_configured(dev)) {
-		netdev_warn(dev, "RSS table size change required, RSS table entries must be default to proceed\n");
-		return -EINVAL;
+	if (bnxt_get_nr_rss_ctxs(bp, req_rx_rings) != bnxt_get_nr_rss_ctxs(bp, bp->rx_nr_rings)) {
+		u32 new_size = bnxt_get_nr_rss_ctxs(bp, req_rx_rings) * BNXT_RSS_TABLE_ENTRIES_P5;
+		u32 old_size = bnxt_get_rxfh_indir_size(dev);
+
+		/* Validate context 0 can be resized before mutating anything */
+		if (netif_is_rxfh_configured(dev) &&
+		    ethtool_rxfh_indir_can_resize(bp->rss_indir_tbl, old_size, new_size)) {
+			netdev_warn(dev, "RSS table size change not supported with current indirection table\n");
+			return -EINVAL;
+		}
+
+		rc = ethtool_rxfh_contexts_resize_all(dev, new_size);
+		if (rc)
+			return rc;
+
+		/* All validated; apply context 0 resize */
+		if (netif_is_rxfh_configured(dev))
+			ethtool_rxfh_indir_resize(bp->rss_indir_tbl, old_size, new_size);
 	}
 
 	rc = bnxt_check_rings(bp, req_tx_rings, req_rx_rings, sh, tcs, tx_xdp);
-- 
2.53.0


  parent reply	other threads:[~2026-03-03 18:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-03 18:15 [PATCH net-next 0/5] ethtool: Dynamic RSS context indirection table resizing Björn Töpel
2026-03-03 18:15 ` [PATCH net-next 1/5] ethtool: Add RSS indirection table resize helpers Björn Töpel
2026-03-04  0:03   ` Jakub Kicinski
2026-03-04 11:37     ` Björn Töpel
2026-03-04 17:09       ` Jakub Kicinski
2026-03-03 18:15 ` Björn Töpel [this message]
2026-03-03 19:20   ` [PATCH net-next 2/5] bnxt_en: Resize RSS contexts on channel count change Michael Chan
2026-03-04 11:38     ` Björn Töpel
2026-03-04  0:05   ` Jakub Kicinski
2026-03-04 11:39     ` Björn Töpel
2026-03-03 18:15 ` [PATCH net-next 3/5] netdevsim: Add RSS context support with dynamic table sizing Björn Töpel
2026-03-04  0:07   ` Jakub Kicinski
2026-03-04 11:40     ` Björn Töpel
2026-03-03 18:15 ` [PATCH net-next 4/5] selftests: netdevsim: Add RSS indirection table resize test Björn Töpel
2026-03-04  0:07   ` Jakub Kicinski
2026-03-03 18:15 ` [PATCH net-next 5/5] selftests: rss_drv: Add RSS indirection table resize tests Björn Töpel
2026-03-04  0:16   ` Jakub Kicinski
2026-03-04  8:23 ` [PATCH net-next 0/5] ethtool: Dynamic RSS context indirection table resizing Pavan Chebbi

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=20260303181535.2671734-3-bjorn@kernel.org \
    --to=bjorn@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    --cc=willemb@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.