[v4,15/45] net/thunderx: use rte stdatomic API

Message ID 1713568003-30453-16-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers
Series use stdatomic API |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Tyler Retzlaff April 19, 2024, 11:06 p.m. UTC
  Replace the use of gcc builtin __atomic_xxx intrinsics with
corresponding rte_atomic_xxx optional rte stdatomic API.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/thunderx/nicvf_rxtx.c   | 9 +++++----
 drivers/net/thunderx/nicvf_struct.h | 4 ++--
 2 files changed, 7 insertions(+), 6 deletions(-)
  

Patch

diff --git a/drivers/net/thunderx/nicvf_rxtx.c b/drivers/net/thunderx/nicvf_rxtx.c
index 74f43b9..76b6fdb 100644
--- a/drivers/net/thunderx/nicvf_rxtx.c
+++ b/drivers/net/thunderx/nicvf_rxtx.c
@@ -374,8 +374,8 @@  static const alignas(RTE_CACHE_LINE_SIZE) uint32_t ptype_table[16][16] = {
 	NICVF_RX_ASSERT((unsigned int)to_fill <= (qlen_mask -
 		(nicvf_addr_read(rbdr->rbdr_status) & NICVF_RBDR_COUNT_MASK)));
 
-	next_tail = __atomic_fetch_add(&rbdr->next_tail, to_fill,
-					__ATOMIC_ACQUIRE);
+	next_tail = rte_atomic_fetch_add_explicit(&rbdr->next_tail, to_fill,
+					rte_memory_order_acquire);
 	ltail = next_tail;
 	for (i = 0; i < to_fill; i++) {
 		struct rbdr_entry_t *entry = desc + (ltail & qlen_mask);
@@ -385,9 +385,10 @@  static const alignas(RTE_CACHE_LINE_SIZE) uint32_t ptype_table[16][16] = {
 		ltail++;
 	}
 
-	rte_wait_until_equal_32(&rbdr->tail, next_tail, __ATOMIC_RELAXED);
+	rte_wait_until_equal_32((uint32_t *)(uintptr_t)&rbdr->tail, next_tail,
+	    rte_memory_order_relaxed);
 
-	__atomic_store_n(&rbdr->tail, ltail, __ATOMIC_RELEASE);
+	rte_atomic_store_explicit(&rbdr->tail, ltail, rte_memory_order_release);
 	nicvf_addr_write(door, to_fill);
 	return to_fill;
 }
diff --git a/drivers/net/thunderx/nicvf_struct.h b/drivers/net/thunderx/nicvf_struct.h
index cfcd942..60d3ec0 100644
--- a/drivers/net/thunderx/nicvf_struct.h
+++ b/drivers/net/thunderx/nicvf_struct.h
@@ -20,8 +20,8 @@  struct __rte_cache_aligned nicvf_rbdr {
 	struct rbdr_entry_t *desc;
 	nicvf_iova_addr_t phys;
 	uint32_t buffsz;
-	uint32_t tail;
-	uint32_t next_tail;
+	RTE_ATOMIC(uint32_t) tail;
+	RTE_ATOMIC(uint32_t) next_tail;
 	uint32_t head;
 	uint32_t qlen_mask;
 };