Skip to content

Commit 1ee581c

Browse files
Michael Chankuba-moo
authored andcommitted
bnxt_en: Adjust TX rings if reservation is less than requested
Before we accept an ethtool request to increase a resource (such as rings), we call the FW to check that the requested resource is likely available first before we commit. But it is still possible that the actual reservation or allocation can fail. The existing code is missing the logic to adjust the TX rings in case the reserved TX rings are less than requested. Add a warning message (a similar message for RX rings already exists) and add the logic to adjust the TX rings. Without this fix, the number of TX rings reported to the stack can exceed the actual TX rings and ethtool -l will report more than the actual TX rings. Fixes: 674f50a ("bnxt_en: Implement new method to reserve rings.") Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20250825175927.459987-3-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 2747328 commit 1ee581c

File tree

1 file changed

+12
-0
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8024,6 +8024,11 @@ static int __bnxt_reserve_rings(struct bnxt *bp)
80248024
hwr.rx = rx_rings << 1;
80258025
tx_cp = bnxt_num_tx_to_cp(bp, hwr.tx);
80268026
hwr.cp = sh ? max_t(int, tx_cp, rx_rings) : tx_cp + rx_rings;
8027+
if (hwr.tx != bp->tx_nr_rings) {
8028+
netdev_warn(bp->dev,
8029+
"Able to reserve only %d out of %d requested TX rings\n",
8030+
hwr.tx, bp->tx_nr_rings);
8031+
}
80278032
bp->tx_nr_rings = hwr.tx;
80288033

80298034
/* If we cannot reserve all the RX rings, reset the RSS map only
@@ -12879,6 +12884,13 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
1287912884
if (rc)
1288012885
return rc;
1288112886

12887+
/* Make adjustments if reserved TX rings are less than requested */
12888+
bp->tx_nr_rings -= bp->tx_nr_rings_xdp;
12889+
bp->tx_nr_rings_per_tc = bnxt_tx_nr_rings_per_tc(bp);
12890+
if (bp->tx_nr_rings_xdp) {
12891+
bp->tx_nr_rings_xdp = bp->tx_nr_rings_per_tc;
12892+
bp->tx_nr_rings += bp->tx_nr_rings_xdp;
12893+
}
1288212894
rc = bnxt_alloc_mem(bp, irq_re_init);
1288312895
if (rc) {
1288412896
netdev_err(bp->dev, "bnxt_alloc_mem err: %x\n", rc);

0 commit comments

Comments
 (0)