Skip to content

Commit e72d4c5

Browse files
committed
Merge branch 'bnxt_en-add-rss-context-resource-check'
Michael Chan says: ==================== bnxt_en: Add RSS context resource check Add missing logic to check that we have enough RSS contexts. This will make the recent change to increase the use of RSS contexts for a larger RSS indirection table more complete. ==================== Link: https://patch.msgid.link/20260207235118.1987301-1-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents e5e2e43 + b9355ad commit e72d4c5

1 file changed

Lines changed: 32 additions & 15 deletions

File tree

  • drivers/net/ethernet/broadcom/bnxt

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

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7951,13 +7951,28 @@ static int bnxt_get_total_vnics(struct bnxt *bp, int rx_rings)
79517951
return 1;
79527952
}
79537953

7954+
static void bnxt_get_total_resources(struct bnxt *bp, struct bnxt_hw_rings *hwr)
7955+
{
7956+
hwr->cp = bnxt_nq_rings_in_use(bp);
7957+
hwr->cp_p5 = 0;
7958+
if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS)
7959+
hwr->cp_p5 = bnxt_cp_rings_in_use(bp);
7960+
hwr->tx = bp->tx_nr_rings;
7961+
hwr->rx = bp->rx_nr_rings;
7962+
hwr->grp = hwr->rx;
7963+
hwr->vnic = bnxt_get_total_vnics(bp, hwr->rx);
7964+
hwr->rss_ctx = bnxt_get_total_rss_ctxs(bp, hwr);
7965+
if (bp->flags & BNXT_FLAG_AGG_RINGS)
7966+
hwr->rx <<= 1;
7967+
hwr->stat = bnxt_get_func_stat_ctxs(bp);
7968+
}
7969+
79547970
static bool bnxt_need_reserve_rings(struct bnxt *bp)
79557971
{
79567972
struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
7957-
int cp = bnxt_cp_rings_in_use(bp);
7958-
int nq = bnxt_nq_rings_in_use(bp);
7959-
int rx = bp->rx_nr_rings, stat;
7960-
int vnic, grp = rx;
7973+
struct bnxt_hw_rings hwr;
7974+
7975+
bnxt_get_total_resources(bp, &hwr);
79617976

79627977
/* Old firmware does not need RX ring reservations but we still
79637978
* need to setup a default RSS map when needed. With new firmware
@@ -7967,25 +7982,27 @@ static bool bnxt_need_reserve_rings(struct bnxt *bp)
79677982
if (!BNXT_NEW_RM(bp))
79687983
bnxt_check_rss_tbl_no_rmgr(bp);
79697984

7970-
if (hw_resc->resv_tx_rings != bp->tx_nr_rings &&
7971-
bp->hwrm_spec_code >= 0x10601)
7985+
if (hw_resc->resv_tx_rings != hwr.tx && bp->hwrm_spec_code >= 0x10601)
79727986
return true;
79737987

79747988
if (!BNXT_NEW_RM(bp))
79757989
return false;
79767990

7977-
vnic = bnxt_get_total_vnics(bp, rx);
7978-
7979-
if (bp->flags & BNXT_FLAG_AGG_RINGS)
7980-
rx <<= 1;
7981-
stat = bnxt_get_func_stat_ctxs(bp);
7982-
if (hw_resc->resv_rx_rings != rx || hw_resc->resv_cp_rings != cp ||
7983-
hw_resc->resv_vnics != vnic || hw_resc->resv_stat_ctxs != stat ||
7984-
(hw_resc->resv_hw_ring_grps != grp &&
7991+
if (hw_resc->resv_rx_rings != hwr.rx ||
7992+
hw_resc->resv_vnics != hwr.vnic ||
7993+
hw_resc->resv_stat_ctxs != hwr.stat ||
7994+
hw_resc->resv_rsscos_ctxs != hwr.rss_ctx ||
7995+
(hw_resc->resv_hw_ring_grps != hwr.grp &&
79857996
!(bp->flags & BNXT_FLAG_CHIP_P5_PLUS)))
79867997
return true;
7998+
if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) {
7999+
if (hw_resc->resv_cp_rings != hwr.cp_p5)
8000+
return true;
8001+
} else if (hw_resc->resv_cp_rings != hwr.cp) {
8002+
return true;
8003+
}
79878004
if ((bp->flags & BNXT_FLAG_CHIP_P5_PLUS) && BNXT_PF(bp) &&
7988-
hw_resc->resv_irqs != nq)
8005+
hw_resc->resv_irqs != hwr.cp)
79898006
return true;
79908007
return false;
79918008
}

0 commit comments

Comments
 (0)