* [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
* Re: [PATCH net] bnxt_en: Fix NIC lockup caused by stale NQ consumer index
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
0 siblings, 1 reply; 3+ messages in thread
From: Michael Chan @ 2026-12-04 22:22 UTC (permalink / raw)
To: Joe Damato
Cc: netdev, Pavan Chebbi, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
[-- Attachment #1: Type: text/plain, Size: 1390 bytes --]
On Fri, Dec 4, 2026 at 12:03 PM Joe Damato <joe@dama.to> wrote:
> @@ -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);
I will check with the HW/FW teams to understand why this is needed.
If we finish polling within budget, the completion rings should be
armed and our NQ should be big enough for any new entries without
updating the NQ doorbell. I'll get back to you in a few days.
Thanks.
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5469 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] bnxt_en: Fix NIC lockup caused by stale NQ consumer index
2026-12-04 22:22 ` Michael Chan
@ 2026-12-04 22:58 ` Joe Damato
0 siblings, 0 replies; 3+ messages in thread
From: Joe Damato @ 2026-12-04 22:58 UTC (permalink / raw)
To: Michael Chan
Cc: netdev, Pavan Chebbi, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
On Fri, Dec 04, 2026 at 02:22:49PM -0800, Michael Chan wrote:
> On Fri, Dec 4, 2026 at 12:03 PM Joe Damato <joe@dama.to> wrote:
>
> > @@ -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);
>
> I will check with the HW/FW teams to understand why this is needed.
> If we finish polling within budget, the completion rings should be
> armed and our NQ should be big enough for any new entries without
> updating the NQ doorbell. I'll get back to you in a few days.
> Thanks.
Thanks for taking a look and following up internally.
I agree that a single poll can't overflow the NQ. The problem is that many
polls in a row can skip the NQ doorbell write.
With defer_hard_irqs, any poll with work_done > 0 resets the defer
count, so napi_complete_done() keeps returning false under steady
traffic. Busy poll always returns false. Each of those polls re-arms
the CQs and consumes the new NQEs, but the consumer index the HW sees
never moves.
The end-of-loop write doesn't help a TX-heavy NAPI. TX completions
don't count toward the budget, so a TCP sender, whose only RX is
ACKs, stays under budget and never reaches it.
FWIW, FW 225 didn't seem to reproduce this issue so it is possible that
something changed between FW 225 and the more recent FWs or that maybe my test
on FW 225 wasn't right for some reason. Not sure.
In any case, I'd encourage the folks on your side to test the reproducer on
different FW versions and see if you can repro.
I tested it a few times on FW 238 and it repro'd every time within seconds.
^ permalink raw reply [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