|
Thomas Bogendoerfer |
bfb351 |
From: Michael Chan <michael.chan@broadcom.com>
|
|
Thomas Bogendoerfer |
bfb351 |
Date: Fri, 10 Feb 2023 12:31:55 -0500
|
|
Thomas Bogendoerfer |
bfb351 |
Subject: bnxt_en: Fix mqprio and XDP ring checking logic
|
|
Thomas Bogendoerfer |
bfb351 |
Patch-mainline: v6.2
|
|
Thomas Bogendoerfer |
bfb351 |
Git-commit: 2038cc592811209de20c4e094ca08bfb1e6fbc6c
|
|
Thomas Bogendoerfer |
bfb351 |
References: bsc#1209079
|
|
Thomas Bogendoerfer |
bfb351 |
|
|
Thomas Bogendoerfer |
bfb351 |
In bnxt_reserve_rings(), there is logic to check that the number of TX
|
|
Thomas Bogendoerfer |
bfb351 |
rings reserved is enough to cover all the mqprio TCs, but it fails to
|
|
Thomas Bogendoerfer |
bfb351 |
account for the TX XDP rings. So the check will always fail if there
|
|
Thomas Bogendoerfer |
bfb351 |
are mqprio TCs and TX XDP rings. As a result, the driver always fails
|
|
Thomas Bogendoerfer |
bfb351 |
to initialize after the XDP program is attached and the device will be
|
|
Thomas Bogendoerfer |
bfb351 |
brought down. A subsequent ifconfig up will also fail because the
|
|
Thomas Bogendoerfer |
bfb351 |
number of TX rings is set to an inconsistent number. Fix the check to
|
|
Thomas Bogendoerfer |
bfb351 |
properly account for TX XDP rings. If the check fails, set the number
|
|
Thomas Bogendoerfer |
bfb351 |
of TX rings back to a consistent number after calling netdev_reset_tc().
|
|
Thomas Bogendoerfer |
bfb351 |
|
|
Thomas Bogendoerfer |
bfb351 |
Fixes: 674f50a5b026 ("bnxt_en: Implement new method to reserve rings.")
|
|
Thomas Bogendoerfer |
bfb351 |
Reviewed-by: Hongguang Gao <hongguang.gao@broadcom.com>
|
|
Thomas Bogendoerfer |
bfb351 |
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
|
|
Thomas Bogendoerfer |
bfb351 |
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
Thomas Bogendoerfer |
bfb351 |
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
|
|
Thomas Bogendoerfer |
bfb351 |
---
|
|
Thomas Bogendoerfer |
bfb351 |
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 8 ++++++--
|
|
Thomas Bogendoerfer |
bfb351 |
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
Thomas Bogendoerfer |
bfb351 |
|
|
Thomas Bogendoerfer |
bfb351 |
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
|
|
Thomas Bogendoerfer |
bfb351 |
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
|
|
Thomas Bogendoerfer |
bfb351 |
@@ -9239,10 +9239,14 @@ int bnxt_reserve_rings(struct bnxt *bp,
|
|
Thomas Bogendoerfer |
bfb351 |
netdev_err(bp->dev, "ring reservation/IRQ init failure rc: %d\n", rc);
|
|
Thomas Bogendoerfer |
bfb351 |
return rc;
|
|
Thomas Bogendoerfer |
bfb351 |
}
|
|
Thomas Bogendoerfer |
bfb351 |
- if (tcs && (bp->tx_nr_rings_per_tc * tcs != bp->tx_nr_rings)) {
|
|
Thomas Bogendoerfer |
bfb351 |
+ if (tcs && (bp->tx_nr_rings_per_tc * tcs !=
|
|
Thomas Bogendoerfer |
bfb351 |
+ bp->tx_nr_rings - bp->tx_nr_rings_xdp)) {
|
|
Thomas Bogendoerfer |
bfb351 |
netdev_err(bp->dev, "tx ring reservation failure\n");
|
|
Thomas Bogendoerfer |
bfb351 |
netdev_reset_tc(bp->dev);
|
|
Thomas Bogendoerfer |
bfb351 |
- bp->tx_nr_rings_per_tc = bp->tx_nr_rings;
|
|
Thomas Bogendoerfer |
bfb351 |
+ if (bp->tx_nr_rings_xdp)
|
|
Thomas Bogendoerfer |
bfb351 |
+ bp->tx_nr_rings_per_tc = bp->tx_nr_rings_xdp;
|
|
Thomas Bogendoerfer |
bfb351 |
+ else
|
|
Thomas Bogendoerfer |
bfb351 |
+ bp->tx_nr_rings_per_tc = bp->tx_nr_rings;
|
|
Thomas Bogendoerfer |
bfb351 |
return -ENOMEM;
|
|
Thomas Bogendoerfer |
bfb351 |
}
|
|
Thomas Bogendoerfer |
bfb351 |
return 0;
|