Netdev List
 help / color / mirror / Atom feed
* [PATCH net] bnxt_en: Fix NIC lockup caused by stale NQ consumer index
@ 2026-12-04 20:03 Joe Damato
  2026-12-04 22:22 ` Michael Chan
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Damato @ 2026-12-04 20:03 UTC (permalink / raw)
  To: netdev, Michael Chan, Pavan Chebbi, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Joe Damato

On a BCM57504 running firmware 238.1.138.6 or 232.0.159.4, the NIC can
lock up when the NQ consumer index goes stale. This can be reproduced
with iperf3 TCP traffic and hard IRQ deferral enabled:

  echo 2      > /sys/class/net/eth0/napi_defer_hard_irqs
  echo 200000 > /sys/class/net/eth0/gro_flush_timeout
  iperf3 -c $PEER -P 4 -t 300 &
  iperf3 -c $PEER -P 4 -t 300 -R &

Traffic stops within seconds. On FW 238.1.138.6 the TX watchdog then
fires and the driver's reset fails (RING_FREE fails and ring allocation
fails on open).

In that state, devlink reload, FLR, and host reboot all fail to recover
the NIC; only removing power from the NIC recovers the device. The same
test did not reproduce the lockup with firmware 225.0.154.0 or
225.0.157.0.

The driver does not update the NQ consumer index when
napi_complete_done() returns false, for example when IRQ deferral is
enabled as above, or when a busy polling socket owns the NAPI.

Fix this by writing the NQ consumer index, without arming the NQ, when
napi_complete_done() returns false. Skip the write if the index has not
moved, to avoid an extra MMIO write while busy polling an idle NAPI.

Fixes: 0fcec9854ab4 ("bnxt_en: Add new NAPI poll function for 57500 chips.")
Signed-off-by: Joe Damato <joe@dama.to>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 85ce4b2e297e..f5cc273b97a5 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -3397,6 +3397,7 @@ static int bnxt_poll_p5(struct napi_struct *napi, int budget)
 	struct bnxt *bp = bnapi->bp;
 	struct nqe_cn *nqcmp;
 	int work_done = 0;
+	bool nq_moved;
 	u32 cons;
 
 	if (unlikely(test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state))) {
@@ -3419,10 +3420,18 @@ static int bnxt_poll_p5(struct napi_struct *napi, int budget)
 
 			__bnxt_poll_cqs_done(bp, bnapi, DBR_TYPE_CQ_ARMALL,
 					     budget);
+			nq_moved = raw_cons != cpr->cp_raw_cons;
 			cpr->cp_raw_cons = raw_cons;
-			if (napi_complete_done(napi, work_done))
+			if (napi_complete_done(napi, work_done)) {
 				BNXT_DB_NQ_ARM_P5(&cpr->cp_db,
 						  cpr->cp_raw_cons);
+			} else if (nq_moved) {
+				/* NAPI stays scheduled (IRQ deferral or busy
+				 * poll) and the NQ is not re-armed, but the
+				 * HW must still learn how far it was consumed.
+				 */
+				BNXT_DB_NQ_P5(&cpr->cp_db, cpr->cp_raw_cons);
+			}
 			goto poll_done;
 		}
 

base-commit: e9d78fc6741ac06d438cf64e314c28e57014432a
-- 
2.53.1-Meta


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-04 22:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 20:03 [PATCH net] bnxt_en: Fix NIC lockup caused by stale NQ consumer index Joe Damato
2026-12-04 22:22 ` Michael Chan
2026-12-04 22:58   ` Joe Damato

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox