[PATCH v3 19/27] net/bnx2x: convert from rte_atomic32 to stdatomic
Stephen Hemminger
stephen at networkplumber.org
Sat May 23 21:56:33 CEST 2026
Replace the legacy rte_atomic32_* API on sc->scan_fp with the
equivalent rte_atomic_*_explicit C11 helpers, ahead of the
deprecation of rte_atomicNN_t and its associated wrappers.
All accesses use rte_memory_order_seq_cst, matching the semantics
of the legacy API. No functional change.
The scan_fp field is a notification flag between the slow-path
command poster (bnx2x_sp_post) and the fastpath task that reaps
ramrod completions (bnx2x_handle_fp_tq), also cleared from
ecore_state_wait on success, panic, and timeout.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
drivers/net/bnx2x/bnx2x.c | 6 +++---
drivers/net/bnx2x/bnx2x.h | 2 +-
drivers/net/bnx2x/ecore_sp.c | 6 +++---
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 8790c858d5..027a0a50d5 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -1098,7 +1098,7 @@ bnx2x_sp_post(struct bnx2x_softc *sc, int command, int cid, uint32_t data_hi,
* Ask bnx2x_intr_intr() to process RAMROD
* completion whenever it gets scheduled.
*/
- rte_atomic32_set(&sc->scan_fp, 1);
+ rte_atomic_store_explicit(&sc->scan_fp, 1, rte_memory_order_seq_cst);
bnx2x_sp_prod_update(sc);
return 0;
@@ -4575,7 +4575,7 @@ static void bnx2x_handle_fp_tq(struct bnx2x_fastpath *fp)
/* update the fastpath index */
bnx2x_update_fp_sb_idx(fp);
- if (rte_atomic32_read(&sc->scan_fp) == 1) {
+ if (rte_atomic_load_explicit(&sc->scan_fp, rte_memory_order_seq_cst)) {
if (bnx2x_has_rx_work(fp)) {
more_rx = bnx2x_rxeof(sc, fp);
}
@@ -4586,7 +4586,7 @@ static void bnx2x_handle_fp_tq(struct bnx2x_fastpath *fp)
return;
}
/* We have completed slow path completion, clear the flag */
- rte_atomic32_set(&sc->scan_fp, 0);
+ rte_atomic_store_explicit(&sc->scan_fp, 0, rte_memory_order_seq_cst);
}
bnx2x_ack_sb(sc, fp->igu_sb_id, USTORM_ID,
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index 35206b4758..c5de4b71aa 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -1043,7 +1043,7 @@ struct bnx2x_softc {
#define PERIODIC_STOP 0
#define PERIODIC_GO 1
volatile unsigned long periodic_flags;
- rte_atomic32_t scan_fp;
+ RTE_ATOMIC(uint32_t) scan_fp;
struct bnx2x_fastpath fp[MAX_RSS_CHAINS];
struct bnx2x_sp_objs sp_objs[MAX_RSS_CHAINS];
diff --git a/drivers/net/bnx2x/ecore_sp.c b/drivers/net/bnx2x/ecore_sp.c
index c6c3857778..33a40dea6e 100644
--- a/drivers/net/bnx2x/ecore_sp.c
+++ b/drivers/net/bnx2x/ecore_sp.c
@@ -299,21 +299,21 @@ static int ecore_state_wait(struct bnx2x_softc *sc, int state,
#ifdef ECORE_STOP_ON_ERROR
ECORE_MSG(sc, "exit (cnt %d)", 5000 - cnt);
#endif
- rte_atomic32_set(&sc->scan_fp, 0);
+ rte_atomic_store_explicit(&sc->scan_fp, 0, rte_memory_order_seq_cst);
return ECORE_SUCCESS;
}
ECORE_WAIT(sc, delay_us);
if (sc->panic) {
- rte_atomic32_set(&sc->scan_fp, 0);
+ rte_atomic_store_explicit(&sc->scan_fp, 0, rte_memory_order_seq_cst);
return ECORE_IO;
}
}
/* timeout! */
PMD_DRV_LOG(ERR, sc, "timeout waiting for state %d", state);
- rte_atomic32_set(&sc->scan_fp, 0);
+ rte_atomic_store_explicit(&sc->scan_fp, 0, rte_memory_order_seq_cst);
#ifdef ECORE_STOP_ON_ERROR
ecore_panic();
#endif
--
2.53.0
More information about the dev
mailing list