Skip to content

Commit 98ba1d9

Browse files
Pavan Chebbikuba-moo
Pavan Chebbi
authored andcommitted
bnxt_en: Fix RSS logic in __bnxt_reserve_rings()
In __bnxt_reserve_rings(), the existing code unconditionally sets the default RSS indirection table to default if netif_is_rxfh_configured() returns false. This used to be correct before we added RSS contexts support. For example, if the user is changing the number of ethtool channels, we will enter this path to reserve the new number of rings. We will then set the RSS indirection table to default to cover the new number of rings if netif_is_rxfh_configured() is false. Now, with RSS contexts support, if the user has added or deleted RSS contexts, we may now enter this path to reserve the new number of VNICs. However, netif_is_rxfh_configured() will not return the correct state if we are still in the middle of set_rxfh(). So the existing code may set the indirection table of the default RSS context to default by mistake. Fix it to check if the reservation of the RX rings is changing. Only check netif_is_rxfh_configured() if it is changing. RX rings will not change in the middle of set_rxfh() and this will fix the issue. Fixes: b3d0083 ("bnxt_en: Support RSS contexts in ethtool .{get|set}_rxfh()") Reported-and-tested-by: Jakub Kicinski <kuba@kernel.org> Link: https://lore.kernel.org/20240625010210.2002310-1-kuba@kernel.org Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com> Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20240724222106.147744-1-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 1722389 commit 98ba1d9

File tree

1 file changed

+4
-2
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+4
-2
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7649,8 +7649,8 @@ static int bnxt_get_avail_msix(struct bnxt *bp, int num);
76497649
static int __bnxt_reserve_rings(struct bnxt *bp)
76507650
{
76517651
struct bnxt_hw_rings hwr = {0};
7652+
int rx_rings, old_rx_rings, rc;
76527653
int cp = bp->cp_nr_rings;
7653-
int rx_rings, rc;
76547654
int ulp_msix = 0;
76557655
bool sh = false;
76567656
int tx_cp;
@@ -7684,6 +7684,7 @@ static int __bnxt_reserve_rings(struct bnxt *bp)
76847684
hwr.grp = bp->rx_nr_rings;
76857685
hwr.rss_ctx = bnxt_get_total_rss_ctxs(bp, &hwr);
76867686
hwr.stat = bnxt_get_func_stat_ctxs(bp);
7687+
old_rx_rings = bp->hw_resc.resv_rx_rings;
76877688

76887689
rc = bnxt_hwrm_reserve_rings(bp, &hwr);
76897690
if (rc)
@@ -7738,7 +7739,8 @@ static int __bnxt_reserve_rings(struct bnxt *bp)
77387739
if (!bnxt_rings_ok(bp, &hwr))
77397740
return -ENOMEM;
77407741

7741-
if (!netif_is_rxfh_configured(bp->dev))
7742+
if (old_rx_rings != bp->hw_resc.resv_rx_rings &&
7743+
!netif_is_rxfh_configured(bp->dev))
77427744
bnxt_set_dflt_rss_indir_tbl(bp, NULL);
77437745

77447746
if (!bnxt_ulp_registered(bp->edev) && BNXT_NEW_RM(bp)) {

0 commit comments

Comments
 (0)