eal/x86: fix atomic exchange for 32-bit
authorKonstantin Ananyev <konstantin.ananyev@intel.com>
Wed, 2 May 2018 13:58:26 +0000 (14:58 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 2 May 2018 17:23:06 +0000 (19:23 +0200)
Should break out of loop when rte_atomic64_cmpset() returns non-zero.

Fixes: ff2863570fcc ("eal: introduce atomic exchange operation")

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
lib/librte_eal/common/include/arch/x86/rte_atomic_32.h

index 8d711b6..a932f35 100644 (file)
@@ -105,7 +105,7 @@ rte_atomic64_exchange(volatile uint64_t *dest, uint64_t val)
 
        do {
                old = *dest;
-       } while (rte_atomic64_cmpset(dest, old, val));
+       } while (rte_atomic64_cmpset(dest, old, val) == 0);
 
        return old;
 }