From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9A30C55838 for ; Thu, 6 Aug 2026 03:27:51 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E52CB40616; Thu, 6 Aug 2026 05:26:17 +0200 (CEST) Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by mails.dpdk.org (Postfix) with ESMTP id 6FB7740DD2 for ; Thu, 6 Aug 2026 05:26:12 +0200 (CEST) Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-38a0c7e841fso2162276a91.2 for ; Wed, 05 Aug 2026 20:26:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20251104.gappssmtp.com; s=20251104; t=1785986771; x=1786591571; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=+0lNVThOYvKlOHLKbzaPubzFPKBCgRP7BQ7sQsrvDw4=; b=pu2flkwVDcVlOyEAd7oZcWJDU+785UpIl+frsHLdFfVP6nYOpRuN55GoeA0lMGLwH3 ucCud2r3vPqSjSYcsxgdh1zLZr7UPlsP1Hwhpb8KCtB+MwXBCMFHcMSdTUtiFjjf6Rro UUTUSOfJVj0mKOBoA6oF4tjnDkHp0zDS2YwSrnu143DJ5Vda9VVQqwfgaf5ASp3X1JNH yUyRYVsSDXpQHUA9ZSHkgZ0Q4e/ar1LMKtefBSR6XazcIy+e945TGzAkznN5fEug7Zc6 ElSKMxe8be0Ez4whqWdWEMhMgb3fvBYXA7LBD8AYjSTuvwE0GyTgPxRq/9hsF8WS3aVU yEXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785986771; x=1786591571; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=+0lNVThOYvKlOHLKbzaPubzFPKBCgRP7BQ7sQsrvDw4=; b=ZN/DAvGReEeN30GSjih36HcJUNag9wDv0kj7cfQy63YMqxZUxFW3jiVH9qsqGirYC+ 0KuD0+5hBZFYpVjOPrCTEbNJ0rn51Oxf1C6gpq/J2M36bhZDSWKn4udrYsqOD64rgy44 ITL/CM1BIZs0PNWPuXMzhy9nAiQpGk1jCcwFK0DfHTQwuSy8iglgWX2cJdzh7n7xIPzr TJ/41zudS7aOoQLHCPDAksqYCiE0MwIwQsNlG+n9eYG6sI9C8UV8MMDPjJujs/gOwZM1 NN7K8m11aUkqhQ386j/a3uZXlUTeIX4IDOA+VRA3PMBfL4ggzwl8FcPC+bUo2pxO4ceg aZ6A== X-Gm-Message-State: AOJu0YxWEsAK+IS84IdlEv6XXFzby3R5uV2sxVPtV21kvveQJd0NEQjM Xja+nsMdFPOqE6jb9sjKjvCTezA49/p7VtyaL3PkXmeCExXsMKSCas7x313pQ1/sGsvGUoMBHOp iyVRtPMg= X-Gm-Gg: AR+sD12hAbAojMZBgPWpf12XZ8X59GjalQJuBU55BozXxKn4x6It3gcylhPRt7jjdTr RSa9xDzr8UyP70mpGCbF1V5LpZwtlhhdoEEd6ZXrhDhK0elW6z0UGynVZoLSBklyZ3SJn2DRVDe 5tqCOtGrsjjnQ5DReuNuDnMFqDlWZSazkNHnwb1Sf76wE/nINNQS7SK8lac9k45GvgipLdrC14F X9783V8ROU5E8K194qJ5LAZJSs1nAGAs9Io6wWaQX3/9jOZCkkHX+mx2upNpGB65NyQ5Uw8K+Vk pO1dGbIjNRDqg6PNfgH9s91HYDE/lCdNYx30fjUwdFs/vooiArWLB5o7kKU1+1Cu7DjN5H3XbpS 5woI9VOKjWENASq9RDGqdHe1FBMb4+FXGO37sNKABnnizH9Oo0GZjhmnbZdJxbEP2BKDZhdBBp7 AkWydJT+3cpVgnSeOv6R4iNjJWt017AFk+YHW16qbtI86dAY6X5W0zQ+AtMQSxITH0dhOfx9HXk eGNitK3jPuI6PkADAQVbkNutVI= X-Received: by 2002:a05:6a20:729b:b0:3c4:1916:9d40 with SMTP id adf61e73a8af0-3cb85dcaeb9mr12237657637.12.1785986771604; Wed, 05 Aug 2026 20:26:11 -0700 (PDT) Received: from phoenix.lan (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-315863b0c61sm23301631eec.6.2026.08.05.20.26.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2026 20:26:11 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v7 22/24] vdpa/ifc: replace rte_atomic32 with stdatomic Date: Wed, 5 Aug 2026 20:23:14 -0700 Message-ID: <20260806032544.21337-23-stephen@networkplumber.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260806032544.21337-1-stephen@networkplumber.org> References: <20260521042043.1590536-1-stephen@networkplumber.org> <20260806032544.21337-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.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 --- 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 #include #include +#include #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