git: b43c4d84c8d1 - main - if_bnxt: fix powerpc build of the MPC ring code
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 13 Oct 2026 14:29:37 UTC
The branch main has been updated by ssaxena:
URL: https://cgit.FreeBSD.org/src/commit/?id=b43c4d84c8d172858fc4bbf59e07888bfb8ac472
commit b43c4d84c8d172858fc4bbf59e07888bfb8ac472
Author: Sumit Saxena <ssaxena@FreeBSD.org>
AuthorDate: 2026-10-13 08:28:03 +0000
Commit: Sumit Saxena <ssaxena@FreeBSD.org>
CommitDate: 2026-10-13 14:28:51 +0000
if_bnxt: fix powerpc build of the MPC ring code
powerpc has no 16-bit acquire/release atomics, so the
atomic_load_acq_16() and atomic_store_rel_16() calls on the MPC TX
ring indices fail to build there. Make the producer and consumer
indices 32 bits wide and use the 32-bit primitives.
Reviewed by: gallatin, chandrakanth.patil_broadcom.com
Sponsored by: Broadcom Inc
MFC after: 1 week
Fixes: 088a42c0ff76 ("if_bnxt: add MPC (Mid-Path Channel) ring infrastructure")
Differential Revision: https://reviews.freebsd.org/D60698
---
sys/dev/bnxt/bnxt_en/bnxt.h | 4 ++--
sys/dev/bnxt/bnxt_en/bnxt_mpc.c | 15 +++++++--------
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/sys/dev/bnxt/bnxt_en/bnxt.h b/sys/dev/bnxt/bnxt_en/bnxt.h
index 7c5b357ec7ac..847967853cd3 100644
--- a/sys/dev/bnxt/bnxt_en/bnxt.h
+++ b/sys/dev/bnxt/bnxt_en/bnxt.h
@@ -672,8 +672,8 @@ struct bnxt_ring {
uint8_t mpc_chnl_type; /* valid when queue_id == BNXT_MPC_QUEUE_ID */
struct iflib_dma_info ring_mem; /* manual DMA alloc for driver-private rings (MPC) */
struct bnxt_cp_ring *cp_ring; /* completion ring this TX ring reports to (MPC) */
- uint16_t prod; /* MPC TX ring producer index */
- uint16_t cons; /* MPC TX ring consumer index */
+ uint32_t prod; /* MPC TX ring producer index */
+ uint32_t cons; /* MPC TX ring consumer index */
struct mtx tx_lock; /* MPC TX ring lock */
union {
struct bnxt_sw_tx_bd *tx_buf_ring;
diff --git a/sys/dev/bnxt/bnxt_en/bnxt_mpc.c b/sys/dev/bnxt/bnxt_en/bnxt_mpc.c
index 1182a5baede5..3a3e6f519c9b 100644
--- a/sys/dev/bnxt/bnxt_en/bnxt_mpc.c
+++ b/sys/dev/bnxt/bnxt_en/bnxt_mpc.c
@@ -844,8 +844,8 @@ static inline uint32_t bnxt_tx_avail(struct bnxt_softc *softc,
{
uint32_t used, prod, cons;
- prod = atomic_load_acq_16(&txr->prod);
- cons = atomic_load_acq_16(&txr->cons);
+ prod = atomic_load_acq_32(&txr->prod);
+ cons = atomic_load_acq_32(&txr->cons);
if (prod >= cons)
used = prod - cons;
@@ -907,9 +907,8 @@ int bnxt_start_xmit_mpc(struct bnxt_softc *softc, struct bnxt_ring *txr,
}
memcpy(txbd, data, len);
prod = ADVANCE_TX_BY(txr, prod, bds);
- /* Release-store pairs with the atomic_load_acq_16(&txr->prod) in
- * bnxt_tx_avail() and bnxt_adv_mpc_cons(). */
- atomic_store_rel_16(&txr->prod, prod);
+ /* Pairs with the acquire load of prod in bnxt_tx_avail(). */
+ atomic_store_rel_32(&txr->prod, prod);
softc->db_ops.bnxt_db_tx(txr, prod);
@@ -952,9 +951,9 @@ static void bnxt_adv_mpc_cons(struct bnxt_softc *softc, struct bnxt_ring *txr)
}
}
tx_cons = ADVANCE_TX_BY(txr, tx_cons, mpc_buf->inline_bds);
- /* Pairs with bnxt_tx_avail()'s atomic_load_acq_16(&txr->cons). */
- atomic_store_rel_16(&txr->cons, tx_cons);
- if (tx_cons == atomic_load_acq_16(&txr->prod))
+ /* Pairs with the acquire load in bnxt_tx_avail(). */
+ atomic_store_rel_32(&txr->cons, tx_cons);
+ if (tx_cons == atomic_load_acq_32(&txr->prod))
break;
mpc_buf = &txr->tx_mpc_buf_ring[tx_cons];
} while (mpc_buf->handle == BNXT_INV_MPC_HDL);