Skip to content

Commit 2038cc5

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Fix mqprio and XDP ring checking logic
In bnxt_reserve_rings(), there is logic to check that the number of TX rings reserved is enough to cover all the mqprio TCs, but it fails to account for the TX XDP rings. So the check will always fail if there are mqprio TCs and TX XDP rings. As a result, the driver always fails to initialize after the XDP program is attached and the device will be brought down. A subsequent ifconfig up will also fail because the number of TX rings is set to an inconsistent number. Fix the check to properly account for TX XDP rings. If the check fails, set the number of TX rings back to a consistent number after calling netdev_reset_tc(). Fixes: 674f50a ("bnxt_en: Implement new method to reserve rings.") Reviewed-by: Hongguang Gao <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9b55d3f commit 2038cc5

File tree

1 file changed

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

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9274,10 +9274,14 @@ int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init)
92749274
netdev_err(bp->dev, "ring reservation/IRQ init failure rc: %d\n", rc);
92759275
return rc;
92769276
}
9277-
if (tcs && (bp->tx_nr_rings_per_tc * tcs != bp->tx_nr_rings)) {
9277+
if (tcs && (bp->tx_nr_rings_per_tc * tcs !=
9278+
bp->tx_nr_rings - bp->tx_nr_rings_xdp)) {
92789279
netdev_err(bp->dev, "tx ring reservation failure\n");
92799280
netdev_reset_tc(bp->dev);
9280-
bp->tx_nr_rings_per_tc = bp->tx_nr_rings;
9281+
if (bp->tx_nr_rings_xdp)
9282+
bp->tx_nr_rings_per_tc = bp->tx_nr_rings_xdp;
9283+
else
9284+
bp->tx_nr_rings_per_tc = bp->tx_nr_rings;
92819285
return -ENOMEM;
92829286
}
92839287
return 0;

0 commit comments

Comments
 (0)