[v2,01/16] app/test: use previous value atomic fetch operations

Message ID 1678914945-10638-2-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series replace __atomic operations returning new value |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tyler Retzlaff March 15, 2023, 9:15 p.m. UTC
  Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch adding the necessary code to
allow consumption of the resulting value.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 app/test/test_ring_perf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/app/test/test_ring_perf.c b/app/test/test_ring_perf.c
index 2d8bb67..3972fd9 100644
--- a/app/test/test_ring_perf.c
+++ b/app/test/test_ring_perf.c
@@ -186,7 +186,7 @@  struct thread_params {
 	void *burst = NULL;
 
 #ifdef RTE_USE_C11_MEM_MODEL
-	if (__atomic_add_fetch(&lcore_count, 1, __ATOMIC_RELAXED) != 2)
+	if (__atomic_fetch_add(&lcore_count, 1, __ATOMIC_RELAXED) + 1 != 2)
 #else
 	if (__sync_add_and_fetch(&lcore_count, 1) != 2)
 #endif