On P5 and newer chips, NAPI tells the device how far it read the NQ
with a doorbell. Currently, a poll that finds the NQ empty does so
only with the IRQ re-arm, after napi_complete_done() returns true. It
returns false while busy polling or deferring IRQs, so a NAPI that
completes without re-arming never frees the notifications it reads.
Once the NQ is full, the device stops notifying of RX and TX
completions. TX times out, the reset fails to free and allocate rings,
and the device stays down.
Acknowledge what was read before completing NAPI, while the poll still
owns it. In IRQ mode the re-arm follows with the same index.
Found from the console logs of a BCM57504 in real use. Normal traffic
with deferred IRQs, e.g napi_defer_hard_irqs 100, gro_flush_timeout
200000, lost the device in 19 seconds at 0.1 Mpps of 1500B UDP to one
queue. Also seen on the WIP AF_XDP series running preferred busy
polling. Both pass with this patch.
Fixes: 0fcec9854ab4 ("bnxt_en: Add new NAPI poll function for 57500 chips.")
Signed-off-by: Björn Töpel <bjo…@kernel.org>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 85ce4b2e297e..9f8ceca047f7 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -3419,7 +3419,14 @@ static int bnxt_poll_p5(struct napi_struct *napi, int budget)
__bnxt_poll_cqs_done(bp, bnapi, DBR_TYPE_CQ_ARMALL,
budget);
- cpr->cp_raw_cons = raw_cons;
+ /* Busy polling and deferred IRQs keep the NQ disarmed.
+ * Free what was read while the NAPI is still ours, or
+ * the NQ fills up and the device stops notifying.
+ */
+ if (raw_cons != cpr->cp_raw_cons) {
+ cpr->cp_raw_cons = raw_cons;
+ BNXT_DB_NQ_P5(&cpr->cp_db, raw_cons);
+ }
if (napi_complete_done(napi, work_done))
BNXT_DB_NQ_ARM_P5(&cpr->cp_db,
cpr->cp_raw_cons);
base-commit: 7c13d5d5afb4ba2e8634fe5aa0a9f2bca235cb4b
--
2.53.1