[PATCH v4 19/45] net/qede: use rte stdatomic API

Tyler Retzlaff roretzla at linux.microsoft.com
Sat Apr 20 01:06:17 CEST 2024


Replace the use of gcc builtin __atomic_xxx intrinsics with
corresponding rte_atomic_xxx optional rte stdatomic API.

Signed-off-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
Acked-by: Stephen Hemminger <stephen at networkplumber.org>
---
 drivers/net/qede/base/bcm_osal.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
index 2edeb38..abd1186 100644
--- a/drivers/net/qede/base/bcm_osal.c
+++ b/drivers/net/qede/base/bcm_osal.c
@@ -51,11 +51,11 @@ void osal_poll_mode_dpc(osal_int_ptr_t hwfn_cookie)
 /* Counter to track current memzone allocated */
 static uint16_t ecore_mz_count;
 
-static uint32_t ref_cnt;
+static RTE_ATOMIC(uint32_t) ref_cnt;
 
 int ecore_mz_mapping_alloc(void)
 {
-	if (__atomic_fetch_add(&ref_cnt, 1, __ATOMIC_RELAXED) == 0) {
+	if (rte_atomic_fetch_add_explicit(&ref_cnt, 1, rte_memory_order_relaxed) == 0) {
 		ecore_mz_mapping = rte_calloc("ecore_mz_map",
 				rte_memzone_max_get(), sizeof(struct rte_memzone *), 0);
 	}
@@ -68,7 +68,7 @@ int ecore_mz_mapping_alloc(void)
 
 void ecore_mz_mapping_free(void)
 {
-	if (__atomic_fetch_sub(&ref_cnt, 1, __ATOMIC_RELAXED) - 1 == 0) {
+	if (rte_atomic_fetch_sub_explicit(&ref_cnt, 1, rte_memory_order_relaxed) - 1 == 0) {
 		rte_free(ecore_mz_mapping);
 		ecore_mz_mapping = NULL;
 	}
-- 
1.8.3.1



More information about the dev mailing list