bnxt_en: Resize RSS contexts on channel count change

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>
This commit is contained in:
Björn Töpel
2026-03-20 09:58:23 +01:00
committed by Jakub Kicinski
parent 02bcb20083
commit 57cdfe0dc7
@@ -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;