From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH v5 22/24] vdpa/ifc: replace rte_atomic32 with stdatomic
Date: Fri, 19 Jun 2026 19:28:47 -0700 [thread overview]
Message-ID: <20260620023134.42877-23-stephen@networkplumber.org> (raw)
In-Reply-To: <20260620023134.42877-1-stephen@networkplumber.org>
Last in-tree caller of rte_atomic32_*(), blocking deprecation of the
rte_atomicNN_*() family.
Replace rte_atomic32_read/set() with rte_atomic_load_explicit() and
rte_atomic_store_explicit() on the started, dev_attached, and running
flags. Narrow them to bool (only ever hold 0/1) and group with the
existing bools to reduce padding in struct ifcvf_internal.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/vdpa/ifc/ifcvf_vdpa.c | 37 ++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index f319d455ba..e5da11a2ba 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -25,6 +25,7 @@
#include <rte_log.h>
#include <rte_kvargs.h>
#include <rte_devargs.h>
+#include <rte_stdatomic.h>
#include "base/ifcvf.h"
@@ -68,10 +69,10 @@ struct ifcvf_internal {
struct rte_vdpa_device *vdev;
uint16_t max_queues;
uint64_t features;
- rte_atomic32_t started;
- rte_atomic32_t dev_attached;
- rte_atomic32_t running;
rte_spinlock_t lock;
+ RTE_ATOMIC(bool) started;
+ RTE_ATOMIC(bool) dev_attached;
+ RTE_ATOMIC(bool) running;
bool sw_lm;
bool sw_fallback_running;
/* mediated vring for sw fallback */
@@ -712,9 +713,9 @@ update_datapath(struct ifcvf_internal *internal)
rte_spinlock_lock(&internal->lock);
- if (!rte_atomic32_read(&internal->running) &&
- (rte_atomic32_read(&internal->started) &&
- rte_atomic32_read(&internal->dev_attached))) {
+ if (!rte_atomic_load_explicit(&internal->running, rte_memory_order_seq_cst) &&
+ (rte_atomic_load_explicit(&internal->started, rte_memory_order_seq_cst) &&
+ rte_atomic_load_explicit(&internal->dev_attached, rte_memory_order_seq_cst))) {
ret = ifcvf_dma_map(internal, true);
if (ret)
goto err;
@@ -735,10 +736,10 @@ update_datapath(struct ifcvf_internal *internal)
if (ret)
goto err;
- rte_atomic32_set(&internal->running, 1);
- } else if (rte_atomic32_read(&internal->running) &&
- (!rte_atomic32_read(&internal->started) ||
- !rte_atomic32_read(&internal->dev_attached))) {
+ rte_atomic_store_explicit(&internal->running, true, rte_memory_order_seq_cst);
+ } else if (rte_atomic_load_explicit(&internal->running, rte_memory_order_seq_cst) &&
+ (!rte_atomic_load_explicit(&internal->started, rte_memory_order_seq_cst) ||
+ !rte_atomic_load_explicit(&internal->dev_attached, rte_memory_order_seq_cst))) {
unset_intr_relay(internal);
ret = unset_notify_relay(internal);
@@ -755,7 +756,7 @@ update_datapath(struct ifcvf_internal *internal)
if (ret)
goto err;
- rte_atomic32_set(&internal->running, 0);
+ rte_atomic_store_explicit(&internal->running, false, rte_memory_order_seq_cst);
}
rte_spinlock_unlock(&internal->lock);
@@ -1058,7 +1059,7 @@ ifcvf_sw_fallback_switchover(struct ifcvf_internal *internal)
vdpa_disable_vfio_intr(internal);
- rte_atomic32_set(&internal->running, 0);
+ rte_atomic_store_explicit(&internal->running, false, rte_memory_order_seq_cst);
ret = rte_vhost_host_notifier_ctrl(vid, RTE_VHOST_QUEUE_ALL, false);
if (ret && ret != -ENOTSUP)
@@ -1113,11 +1114,11 @@ ifcvf_dev_config(int vid)
internal = list->internal;
internal->vid = vid;
- rte_atomic32_set(&internal->dev_attached, 1);
+ rte_atomic_store_explicit(&internal->dev_attached, true, rte_memory_order_seq_cst);
if (update_datapath(internal) < 0) {
DRV_LOG(ERR, "failed to update datapath for vDPA device %s",
vdev->device->name);
- rte_atomic32_set(&internal->dev_attached, 0);
+ rte_atomic_store_explicit(&internal->dev_attached, false, rte_memory_order_seq_cst);
return -1;
}
@@ -1166,7 +1167,7 @@ ifcvf_dev_close(int vid)
internal->sw_fallback_running = false;
} else {
- rte_atomic32_set(&internal->dev_attached, 0);
+ rte_atomic_store_explicit(&internal->dev_attached, false, rte_memory_order_seq_cst);
if (update_datapath(internal) < 0) {
DRV_LOG(ERR, "failed to update datapath for vDPA device %s",
vdev->device->name);
@@ -1782,10 +1783,10 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
goto error;
}
- rte_atomic32_set(&internal->started, 1);
+ rte_atomic_store_explicit(&internal->started, true, rte_memory_order_seq_cst);
if (update_datapath(internal) < 0) {
DRV_LOG(ERR, "failed to update datapath %s", pci_dev->name);
- rte_atomic32_set(&internal->started, 0);
+ rte_atomic_store_explicit(&internal->started, false, rte_memory_order_seq_cst);
rte_vdpa_unregister_device(internal->vdev);
pthread_mutex_lock(&internal_list_lock);
TAILQ_REMOVE(&internal_list, list, next);
@@ -1819,7 +1820,7 @@ ifcvf_pci_remove(struct rte_pci_device *pci_dev)
}
internal = list->internal;
- rte_atomic32_set(&internal->started, 0);
+ rte_atomic_store_explicit(&internal->started, false, rte_memory_order_seq_cst);
if (update_datapath(internal) < 0)
DRV_LOG(ERR, "failed to update datapath %s", pci_dev->name);
--
2.53.0
next prev parent reply other threads:[~2026-06-20 2:33 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 ` [PATCH v5 05/24] net/failsafe: convert to stdatomic Stephen Hemminger
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 ` Stephen Hemminger [this message]
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-23-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox