[v3,11/45] net/octeontx: use rte stdatomic API

Message ID 1711579078-10624-12-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Superseded
Delegated to: Thomas Monjalon
Headers
Series use stdatomic API |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Tyler Retzlaff March 27, 2024, 10:37 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/octeontx/octeontx_ethdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Patch

diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index bec54fd..64d1666 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -31,7 +31,7 @@ 
 /* Useful in stopping/closing event device if no of
  * eth ports are using it.
  */
-uint16_t evdev_refcnt;
+RTE_ATOMIC(uint16_t) evdev_refcnt;
 
 #define OCTEONTX_QLM_MODE_SGMII  7
 #define OCTEONTX_QLM_MODE_XFI   12
@@ -559,7 +559,7 @@  enum octeontx_link_speed {
 		return 0;
 
 	/* Stopping/closing event device once all eth ports are closed. */
-	if (__atomic_fetch_sub(&evdev_refcnt, 1, __ATOMIC_ACQUIRE) - 1 == 0) {
+	if (rte_atomic_fetch_sub_explicit(&evdev_refcnt, 1, rte_memory_order_acquire) - 1 == 0) {
 		rte_event_dev_stop(nic->evdev);
 		rte_event_dev_close(nic->evdev);
 	}
@@ -1593,7 +1593,7 @@  static void build_xstat_names(struct rte_eth_xstat_name *xstat_names)
 	nic->pko_vfid = pko_vfid;
 	nic->port_id = port;
 	nic->evdev = evdev;
-	__atomic_fetch_add(&evdev_refcnt, 1, __ATOMIC_ACQUIRE);
+	rte_atomic_fetch_add_explicit(&evdev_refcnt, 1, rte_memory_order_acquire);
 
 	res = octeontx_port_open(nic);
 	if (res < 0)
@@ -1844,7 +1844,7 @@  static void build_xstat_names(struct rte_eth_xstat_name *xstat_names)
 		}
 	}
 
-	__atomic_store_n(&evdev_refcnt, 0, __ATOMIC_RELEASE);
+	rte_atomic_store_explicit(&evdev_refcnt, 0, rte_memory_order_release);
 	/*
 	 * Do 1:1 links for ports & queues. All queues would be mapped to
 	 * one port. If there are more ports than queues, then some ports