From: Matan Azrad Date: Tue, 19 Dec 2017 17:14:28 +0000 (+0000) Subject: net/failsafe: mitigate data plane atomic operations X-Git-Tag: spdx-start~340 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1e2670a9002d59c0c0aa1b29a8997bb7177cffe0;p=dpdk.git net/failsafe: mitigate data plane atomic operations Fail-safe uses atomic operations to protect sub-device close operation calling by host thread in removal time while the removed sub-device burst functions are still in process by application threads. Using "set" atomic operations is a little bit more efficient than "add" or "sub" atomic operations because "set" shouldn't read the value and in fact, it does not need a special atomic mechanism in x86 platforms. Replace "add 1" and "sub 1" atomic operations by "set 1" and "set 0" atomic operations. Signed-off-by: Matan Azrad Acked-by: Gaetan Rivet --- diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index d81cc3ca60..4196ece5c0 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -269,13 +269,13 @@ extern int mac_from_arg; * a: (rte_atomic64_t) */ #define FS_ATOMIC_P(a) \ - rte_atomic64_add(&(a), 1) + rte_atomic64_set(&(a), 1) /** * a: (rte_atomic64_t) */ #define FS_ATOMIC_V(a) \ - rte_atomic64_sub(&(a), 1) + rte_atomic64_set(&(a), 0) /** * s: (struct sub_device *)