Skip to content

Commit 523384a

Browse files
Michael Chankuba-moo
authored andcommitted
bnxt_en: Fix RSS table entries calculation for P5_PLUS chips
The existing formula used in the driver to calculate the number of RSS table entries is to round up the number of RX rings to the next integer multiples of 64 (e.g. 64, 128, 192, ..). This is incorrect. The valid values supported by the chip are 64, 128, 256, 512 only (power of 2 starting from 64). When the number of RX rings is greater than 128, the entry size will likely be wrong. Firmware will round down the invalid value (e.g. 192 rounded down to 128) provided by the driver, causing some RSS rings to not receive any packets. We already have an existing function bnxt_calc_nr_ring_pages() to do this calculation. Use it in bnxt_get_nr_rss_ctxs() to calculate the number of RSS contexts correctly for P5_PLUS chips. Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com> Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com> Fixes: 7b3af4f ("bnxt_en: Add RSS support for 57500 chips.") Signed-off-by: Michael Chan <michael.chan@broadcom.com> Link: https://lore.kernel.org/r/20240117234515.226944-4-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 2ad8e57 commit 523384a

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5935,8 +5935,12 @@ static u16 bnxt_get_max_rss_ring(struct bnxt *bp)
59355935

59365936
int bnxt_get_nr_rss_ctxs(struct bnxt *bp, int rx_rings)
59375937
{
5938-
if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS)
5939-
return DIV_ROUND_UP(rx_rings, BNXT_RSS_TABLE_ENTRIES_P5);
5938+
if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) {
5939+
if (!rx_rings)
5940+
return 0;
5941+
return bnxt_calc_nr_ring_pages(rx_rings - 1,
5942+
BNXT_RSS_TABLE_ENTRIES_P5);
5943+
}
59405944
if (BNXT_CHIP_TYPE_NITRO_A0(bp))
59415945
return 2;
59425946
return 1;
@@ -7001,10 +7005,11 @@ __bnxt_hwrm_reserve_pf_rings(struct bnxt *bp, int tx_rings, int rx_rings,
70017005

70027006
req->num_rx_rings = cpu_to_le16(rx_rings);
70037007
if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) {
7008+
u16 rss_ctx = bnxt_get_nr_rss_ctxs(bp, ring_grps);
7009+
70047010
req->num_cmpl_rings = cpu_to_le16(tx_rings + ring_grps);
70057011
req->num_msix = cpu_to_le16(cp_rings);
7006-
req->num_rsscos_ctxs =
7007-
cpu_to_le16(DIV_ROUND_UP(ring_grps, 64));
7012+
req->num_rsscos_ctxs = cpu_to_le16(rss_ctx);
70087013
} else {
70097014
req->num_cmpl_rings = cpu_to_le16(cp_rings);
70107015
req->num_hw_ring_grps = cpu_to_le16(ring_grps);
@@ -7051,8 +7056,10 @@ __bnxt_hwrm_reserve_vf_rings(struct bnxt *bp, int tx_rings, int rx_rings,
70517056
req->num_tx_rings = cpu_to_le16(tx_rings);
70527057
req->num_rx_rings = cpu_to_le16(rx_rings);
70537058
if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) {
7059+
u16 rss_ctx = bnxt_get_nr_rss_ctxs(bp, ring_grps);
7060+
70547061
req->num_cmpl_rings = cpu_to_le16(tx_rings + ring_grps);
7055-
req->num_rsscos_ctxs = cpu_to_le16(DIV_ROUND_UP(ring_grps, 64));
7062+
req->num_rsscos_ctxs = cpu_to_le16(rss_ctx);
70567063
} else {
70577064
req->num_cmpl_rings = cpu_to_le16(cp_rings);
70587065
req->num_hw_ring_grps = cpu_to_le16(ring_grps);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1574,7 +1574,8 @@ u32 bnxt_get_rxfh_indir_size(struct net_device *dev)
15741574
struct bnxt *bp = netdev_priv(dev);
15751575

15761576
if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS)
1577-
return ALIGN(bp->rx_nr_rings, BNXT_RSS_TABLE_ENTRIES_P5);
1577+
return bnxt_get_nr_rss_ctxs(bp, bp->rx_nr_rings) *
1578+
BNXT_RSS_TABLE_ENTRIES_P5;
15781579
return HW_HASH_INDEX_SIZE;
15791580
}
15801581

0 commit comments

Comments
 (0)