From: Joe Damato <joe@dama.to>
To: netdev@vger.kernel.org, Michael Chan <michael.chan@broadcom.com>,
Pavan Chebbi <pavan.chebbi@broadcom.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Joe Damato <joe@dama.to>
Subject: [PATCH net] bnxt_en: Fix NIC lockup caused by stale NQ consumer index
Date: Fri, 4 Dec 2026 12:03:34 -0800 [thread overview]
Message-ID: <20261204200334.2294555-1-joe@dama.to> (raw)
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
reply other threads:[~2026-12-04 20:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261204200334.2294555-1-joe@dama.to \
--to=joe@dama.to \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.chebbi@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox