Convert rte_atomic usages to compiler atomic built-ins
for calculation in bpf test cases.

Signed-off-by: Joyce Kong <joyce.k...@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.w...@arm.com>
---
 app/test/test_bpf.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/app/test/test_bpf.c b/app/test/test_bpf.c
index 527c06b807..8d78e5761b 100644
--- a/app/test/test_bpf.c
+++ b/app/test/test_bpf.c
@@ -1553,32 +1553,32 @@ test_xadd1_check(uint64_t rc, const void *arg)
        memset(&dfe, 0, sizeof(dfe));
 
        rv = 1;
-       rte_atomic32_add((rte_atomic32_t *)&dfe.u32, rv);
-       rte_atomic64_add((rte_atomic64_t *)&dfe.u64, rv);
+       __atomic_fetch_add(&dfe.u32, rv, __ATOMIC_RELAXED);
+       __atomic_fetch_add(&dfe.u64, rv, __ATOMIC_RELAXED);
 
        rv = -1;
-       rte_atomic32_add((rte_atomic32_t *)&dfe.u32, rv);
-       rte_atomic64_add((rte_atomic64_t *)&dfe.u64, rv);
+       __atomic_fetch_add(&dfe.u32, rv, __ATOMIC_RELAXED);
+       __atomic_fetch_add(&dfe.u64, rv, __ATOMIC_RELAXED);
 
        rv = (int32_t)TEST_FILL_1;
-       rte_atomic32_add((rte_atomic32_t *)&dfe.u32, rv);
-       rte_atomic64_add((rte_atomic64_t *)&dfe.u64, rv);
+       __atomic_fetch_add(&dfe.u32, rv, __ATOMIC_RELAXED);
+       __atomic_fetch_add(&dfe.u64, rv, __ATOMIC_RELAXED);
 
        rv = TEST_MUL_1;
-       rte_atomic32_add((rte_atomic32_t *)&dfe.u32, rv);
-       rte_atomic64_add((rte_atomic64_t *)&dfe.u64, rv);
+       __atomic_fetch_add(&dfe.u32, rv, __ATOMIC_RELAXED);
+       __atomic_fetch_add(&dfe.u64, rv, __ATOMIC_RELAXED);
 
        rv = TEST_MUL_2;
-       rte_atomic32_add((rte_atomic32_t *)&dfe.u32, rv);
-       rte_atomic64_add((rte_atomic64_t *)&dfe.u64, rv);
+       __atomic_fetch_add(&dfe.u32, rv, __ATOMIC_RELAXED);
+       __atomic_fetch_add(&dfe.u64, rv, __ATOMIC_RELAXED);
 
        rv = TEST_JCC_2;
-       rte_atomic32_add((rte_atomic32_t *)&dfe.u32, rv);
-       rte_atomic64_add((rte_atomic64_t *)&dfe.u64, rv);
+       __atomic_fetch_add(&dfe.u32, rv, __ATOMIC_RELAXED);
+       __atomic_fetch_add(&dfe.u64, rv, __ATOMIC_RELAXED);
 
        rv = TEST_JCC_3;
-       rte_atomic32_add((rte_atomic32_t *)&dfe.u32, rv);
-       rte_atomic64_add((rte_atomic64_t *)&dfe.u64, rv);
+       __atomic_fetch_add(&dfe.u32, rv, __ATOMIC_RELAXED);
+       __atomic_fetch_add(&dfe.u64, rv, __ATOMIC_RELAXED);
 
        return cmp_res(__func__, 1, rc, &dfe, dft, sizeof(dfe));
 }
-- 
2.17.1

Reply via email to