]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bnxt_en: Resize RSS contexts on channel count change
authorBjörn Töpel <bjorn@kernel.org>
Fri, 20 Mar 2026 08:58:23 +0000 (09:58 +0100)
committerJakub Kicinski <kuba@kernel.org>
Tue, 24 Mar 2026 00:59:54 +0000 (17:59 -0700)
bnxt_set_channels() previously rejected channel changes that alter the
RSS table size when RSS contexts exist, because non-default context
sizes were locked at creation.

Replace the rejection with the new resize helpers.

RSS table size only changes on P5 chips with older firmware; newer
firmware always uses the largest table size.

Signed-off-by: Björn Töpel <bjorn@kernel.org>
Link: https://patch.msgid.link/20260320085826.1957255-4-bjorn@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

index 48e8e3be70d386a9607930849d217a383ebbc732..b87ac2bb43dd358aa61a62f98d093f2912ce8826 100644 (file)
@@ -942,6 +942,7 @@ static int bnxt_set_channels(struct net_device *dev,
 {
        struct bnxt *bp = netdev_priv(dev);
        int req_tx_rings, req_rx_rings, tcs;
+       u32 new_tbl_size = 0, old_tbl_size;
        bool sh = false;
        int tx_xdp = 0;
        int rc = 0;
@@ -977,19 +978,33 @@ 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) || bp->num_rss_ctx)) {
-               netdev_warn(dev, "RSS table size change required, RSS table entries must be default (with no additional RSS contexts present) to proceed\n");
-               return -EINVAL;
-       }
-
        rc = bnxt_check_rings(bp, req_tx_rings, req_rx_rings, sh, tcs, tx_xdp);
        if (rc) {
                netdev_warn(dev, "Unable to allocate the requested rings\n");
                return rc;
        }
 
+       /* RSS table size only changes on P5 chips with older firmware;
+        * newer firmware always uses the largest table size.
+        */
+       if (bnxt_get_nr_rss_ctxs(bp, req_rx_rings) !=
+           bnxt_get_nr_rss_ctxs(bp, bp->rx_nr_rings)) {
+               new_tbl_size = bnxt_get_nr_rss_ctxs(bp, req_rx_rings) *
+                              BNXT_RSS_TABLE_ENTRIES_P5;
+               old_tbl_size = bnxt_get_rxfh_indir_size(dev);
+
+               if (!ethtool_rxfh_indir_can_resize(dev, bp->rss_indir_tbl,
+                                                  old_tbl_size,
+                                                  new_tbl_size)) {
+                       netdev_warn(dev, "RSS table resize not possible\n");
+                       return -EINVAL;
+               }
+
+               rc = ethtool_rxfh_ctxs_can_resize(dev, new_tbl_size);
+               if (rc)
+                       return rc;
+       }
+
        if (netif_running(dev)) {
                if (BNXT_PF(bp)) {
                        /* TODO CHIMP_FW: Send message to all VF's
@@ -999,6 +1014,12 @@ static int bnxt_set_channels(struct net_device *dev,
                bnxt_close_nic(bp, true, false);
        }
 
+       if (new_tbl_size) {
+               ethtool_rxfh_indir_resize(dev, bp->rss_indir_tbl,
+                                         old_tbl_size, new_tbl_size);
+               ethtool_rxfh_ctxs_resize(dev, new_tbl_size);
+       }
+
        if (sh) {
                bp->flags |= BNXT_FLAG_SHARED_RINGS;
                bp->rx_nr_rings = channel->combined_count;