git: a8622eac118a - main - if_bnxt: Restore Rx CQ doorbell skip-when-idle optimization on P5

From: Sumit Saxena <ssaxena_at_FreeBSD.org>
Date: Fri, 09 Oct 2026 10:12:49 UTC
The branch main has been updated by ssaxena:

URL: https://cgit.FreeBSD.org/src/commit/?id=a8622eac118a31187be02f4dd1a53f58fc6ec35a

commit a8622eac118a31187be02f4dd1a53f58fc6ec35a
Author:     Sumit Saxena <sumit.saxena@broadcom.com>
AuthorDate: 2026-07-31 15:55:56 +0000
Commit:     Sumit Saxena <ssaxena@FreeBSD.org>
CommitDate: 2026-10-09 08:24:44 +0000

    if_bnxt: Restore Rx CQ doorbell skip-when-idle optimization on P5
    
    The unconditional-doorbell fix for Whp/older NICs (always ring the Rx
    CQ doorbell after processing Rx interrupts) had also been applied to
    P5+ chips, discarding process_nq()'s work-done signal entirely and
    losing the doorbell-skip optimization on P5+ when process_nq() finds
    no CQ notification to act on.
    
    Make process_nq() return whether it saw a CQ notification, and only
    skip the Rx CQ doorbell on P5+ when it didn't; non-P5+ chips continue
    to always ring it, since process_nq() isn't used on that path.
    
    Reviewed by:    gallatin
    MFC after:      2 weeks
    Sponsored by:   Broadcom Inc.
    Differential Revision:  https://reviews.freebsd.org/D58613
---
 sys/dev/bnxt/bnxt_en/bnxt_sysctl.c |  2 +-
 sys/dev/bnxt/bnxt_en/if_bnxt.c     | 18 +++++++++++++-----
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/sys/dev/bnxt/bnxt_en/bnxt_sysctl.c b/sys/dev/bnxt/bnxt_en/bnxt_sysctl.c
index cc72c4214cba..fad3982f5581 100644
--- a/sys/dev/bnxt/bnxt_en/bnxt_sysctl.c
+++ b/sys/dev/bnxt/bnxt_en/bnxt_sysctl.c
@@ -115,7 +115,7 @@ static const int mpc_cmp_counters_count = sizeof(mpc_cmp_counters) / sizeof(mpc_
 DEFINE_MUTEX(tmp_mutex); /* mutex lock for driver */
 extern void bnxt_fw_reset(struct bnxt_softc *bp);
 extern void bnxt_queue_sp_work(struct bnxt_softc *bp);
-extern void
+extern bool
 process_nq(struct bnxt_softc *softc, uint16_t nqid);
 /*
  * We want to create:
diff --git a/sys/dev/bnxt/bnxt_en/if_bnxt.c b/sys/dev/bnxt/bnxt_en/if_bnxt.c
index 25b535a67af8..6566c1e8f442 100644
--- a/sys/dev/bnxt/bnxt_en/if_bnxt.c
+++ b/sys/dev/bnxt/bnxt_en/if_bnxt.c
@@ -202,7 +202,7 @@ static const pci_vendor_info_t bnxt_vendor_info_array[] =
 SLIST_HEAD(softc_list, bnxt_softc_list) pf_list;
 int bnxt_num_pfs = 0;
 
-void
+bool
 process_nq(struct bnxt_softc *softc, uint16_t nqid);
 static void *bnxt_register(device_t dev);
 
@@ -4385,7 +4385,7 @@ bnxt_process_async_msg(struct bnxt_cp_ring *cpr, tx_cmpl_t *cmpl)
 	}
 }
 
-void
+bool
 process_nq(struct bnxt_softc *softc, uint16_t nqid)
 {
 	struct bnxt_cp_ring *cpr = &softc->nq_rings[nqid];
@@ -4396,6 +4396,7 @@ process_nq(struct bnxt_softc *softc, uint16_t nqid)
 	uint32_t cons = cpr->cons;
 	uint32_t raw_cons = cpr->raw_cons;
 	uint16_t nq_type, nqe_cnt = 0;
+	bool rx_cqe = false;
 
 	while (1) {
 		if (!NQ_VALID(&cmp[cons], v_bit)) {
@@ -4409,6 +4410,7 @@ process_nq(struct bnxt_softc *softc, uint16_t nqid)
 		} else {
 			tx_cpr->toggle = NQE_CN_TOGGLE(cmp[cons].type);
 			rx_cpr->toggle = NQE_CN_TOGGLE(cmp[cons].type);
+			rx_cqe = true;
 		}
 
 		NEXT_CP_CONS_V(&cpr->ring, cons, v_bit);
@@ -4421,6 +4423,8 @@ done:
 		cpr->raw_cons = raw_cons;
 		cpr->v_bit = v_bit;
 	}
+
+	return rx_cqe;
 }
 
 static int
@@ -4429,10 +4433,14 @@ bnxt_rx_queue_intr_enable(if_ctx_t ctx, uint16_t qid)
 	struct bnxt_softc *softc = iflib_get_softc(ctx);
 
 	if (BNXT_CHIP_P5_PLUS(softc)) {
-		process_nq(softc, qid);
+		bool ret = false;
+		ret = process_nq(softc, qid);
 		softc->db_ops.bnxt_db_nq(&softc->nq_rings[qid], 1);
-	}
-	softc->db_ops.bnxt_db_rx_cq(&softc->rx_cp_rings[qid], 1);
+		if (ret)
+			softc->db_ops.bnxt_db_rx_cq(&softc->rx_cp_rings[qid], 1);
+	} else
+		softc->db_ops.bnxt_db_rx_cq(&softc->rx_cp_rings[qid], 1);
+
         return 0;
 }