From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Gaetan Rivet <grive@u256.net>
Subject: [PATCH v5 05/24] net/failsafe: convert to stdatomic
Date: Fri, 19 Jun 2026 19:28:30 -0700 [thread overview]
Message-ID: <20260620023134.42877-6-stephen@networkplumber.org> (raw)
In-Reply-To: <20260620023134.42877-1-stephen@networkplumber.org>
The functions rte_atomic64 are deprecated, convert this
code to use stdatomic for reference count. Use the memory
order implied by naming P/V.
No need for initialization since refcnt is in space
allocated with rte_zmalloc().
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/failsafe/failsafe_ops.c | 12 +++++-----
drivers/net/failsafe/failsafe_private.h | 29 ++++++++++++++-----------
drivers/net/failsafe/failsafe_rxtx.c | 2 +-
3 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
index ddc8808ebe..fcb0051777 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -11,7 +11,7 @@
#endif
#include <rte_debug.h>
-#include <rte_atomic.h>
+#include <rte_stdatomic.h>
#include <ethdev_driver.h>
#include <rte_malloc.h>
#include <rte_flow.h>
@@ -440,14 +440,13 @@ fs_rx_queue_setup(struct rte_eth_dev *dev,
}
rxq = rte_zmalloc(NULL,
sizeof(*rxq) +
- sizeof(rte_atomic64_t) * PRIV(dev)->subs_tail,
+ sizeof(uint64_t) * PRIV(dev)->subs_tail,
RTE_CACHE_LINE_SIZE);
if (rxq == NULL) {
fs_unlock(dev, 0);
return -ENOMEM;
}
- FOREACH_SUBDEV(sdev, i, dev)
- rte_atomic64_init(&rxq->refcnt[i]);
+
rxq->qid = rx_queue_id;
rxq->socket_id = socket_id;
rxq->info.mp = mb_pool;
@@ -617,14 +616,13 @@ fs_tx_queue_setup(struct rte_eth_dev *dev,
}
txq = rte_zmalloc("ethdev TX queue",
sizeof(*txq) +
- sizeof(rte_atomic64_t) * PRIV(dev)->subs_tail,
+ sizeof(uint64_t) * PRIV(dev)->subs_tail,
RTE_CACHE_LINE_SIZE);
if (txq == NULL) {
fs_unlock(dev, 0);
return -ENOMEM;
}
- FOREACH_SUBDEV(sdev, i, dev)
- rte_atomic64_init(&txq->refcnt[i]);
+
txq->qid = tx_queue_id;
txq->socket_id = socket_id;
txq->info.conf = *tx_conf;
diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index babea6016e..89b06f9756 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -10,7 +10,7 @@
#include <sys/queue.h>
#include <pthread.h>
-#include <rte_atomic.h>
+#include <rte_stdatomic.h>
#include <dev_driver.h>
#include <ethdev_driver.h>
#include <rte_devargs.h>
@@ -75,7 +75,7 @@ struct rxq {
int event_fd;
unsigned int enable_events:1;
struct rte_eth_rxq_info info;
- rte_atomic64_t refcnt[];
+ RTE_ATOMIC(uint64_t) refcnt[];
};
struct txq {
@@ -83,7 +83,7 @@ struct txq {
uint16_t qid;
unsigned int socket_id;
struct rte_eth_txq_info info;
- rte_atomic64_t refcnt[];
+ RTE_ATOMIC(uint64_t) refcnt[];
};
struct rte_flow {
@@ -320,33 +320,36 @@ extern int failsafe_mac_from_arg;
*/
/**
- * a: (rte_atomic64_t)
+ * a: _Atomic uint64_t
*/
#define FS_ATOMIC_P(a) \
- rte_atomic64_set(&(a), 1)
+ rte_atomic_exchange_explicit(&(a), 1, rte_memory_order_acquire)
/**
- * a: (rte_atomic64_t)
+ * a: _Atomic uint64_t
*/
#define FS_ATOMIC_V(a) \
- rte_atomic64_set(&(a), 0)
+ rte_atomic_store_explicit(&(a), 0, rte_memory_order_release)
/**
* s: (struct sub_device *)
* i: uint16_t qid
*/
#define FS_ATOMIC_RX(s, i) \
- rte_atomic64_read( \
- &((struct rxq *) \
- (fs_dev(s)->data->rx_queues[i]))->refcnt[(s)->sid])
+ rte_atomic_load_explicit( \
+ &((struct rxq *) \
+ (fs_dev(s)->data->rx_queues[i]))->refcnt[(s)->sid], \
+ rte_memory_order_seq_cst)
+
/**
* s: (struct sub_device *)
* i: uint16_t qid
*/
#define FS_ATOMIC_TX(s, i) \
- rte_atomic64_read( \
- &((struct txq *) \
- (fs_dev(s)->data->tx_queues[i]))->refcnt[(s)->sid])
+ rte_atomic_load_explicit( \
+ &((struct txq *) \
+ (fs_dev(s)->data->tx_queues[i]))->refcnt[(s)->sid], \
+ rte_memory_order_seq_cst)
#ifdef RTE_EXEC_ENV_FREEBSD
#define FS_THREADID_TYPE void*
diff --git a/drivers/net/failsafe/failsafe_rxtx.c b/drivers/net/failsafe/failsafe_rxtx.c
index fe67293299..500483bda3 100644
--- a/drivers/net/failsafe/failsafe_rxtx.c
+++ b/drivers/net/failsafe/failsafe_rxtx.c
@@ -3,7 +3,7 @@
* Copyright 2017 Mellanox Technologies, Ltd
*/
-#include <rte_atomic.h>
+#include <rte_stdatomic.h>
#include <rte_debug.h>
#include <rte_mbuf.h>
#include <ethdev_driver.h>
--
2.53.0
next prev parent reply other threads:[~2026-06-20 2:32 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <https://inbox.dpdk.org/dev/20260521042043.1590536-1-stephen@networkplumber.org>
2026-06-20 2:28 ` [PATCH v5 00/24] deprecate rte_atomic functions Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 01/24] bpf: use C11 atomics in BPF_ST_ATOMIC_REG Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 02/24] net/bonding: use stdatomic Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 03/24] net/nbl: remove unused rte_atomic16 field Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 04/24] net/ena: replace use of rte_atomicNN Stephen Hemminger
2026-06-20 2:28 ` Stephen Hemminger [this message]
2026-06-20 2:28 ` [PATCH v5 06/24] net/enic: do not use deprecated rte_atomic64 Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 07/24] net/pfe: use ethdev linkstatus helpers Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 08/24] net/sfc: replace rte_atomic with stdatomic Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 09/24] crypto/ccp: replace use of rte_atomic64 " Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 10/24] bus/dpaa: replace rte_atomic16 " Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 11/24] drivers: " Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 12/24] net/netvsc: replace rte_atomic32 " Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 13/24] event/sw: convert from rte_atomic32 to stdatomic Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 14/24] bus/vmbus: convert from rte_atomic " Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 15/24] common/dpaax: use stdatomic instead of rte_atomic Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 16/24] net/bnx2x: convert from rte_atomic32 to stdatomic Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 17/24] bus/fslmc: replace rte_atomic32 with stdatomic Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 18/24] drivers/event: replace rte_atomic32 in selftests Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 19/24] net/hinic: replace rte_atomic32 with stdatomic Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 20/24] net/txgbe: " Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 21/24] net/vhost: use stdatomic instead of rte_atomic32 Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 22/24] vdpa/ifc: replace rte_atomic32 with stdatomic Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 23/24] test/atomic: suppress deprecation warnings for legacy APIs Stephen Hemminger
2026-06-20 2:28 ` [PATCH v5 24/24] eal: deprecate rte_atomicNN functions Stephen Hemminger
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=20260620023134.42877-6-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=grive@u256.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.