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 --- 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