From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matan Azrad Subject: [PATCH v3 2/3] net/failsafe: mitigate data plan atomic operations Date: Tue, 19 Dec 2017 17:14:28 +0000 Message-ID: <1513703669-29363-3-git-send-email-matan@mellanox.com> References: <1513703669-29363-1-git-send-email-matan@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain Cc: dev@dpdk.org To: Gaetan Rivet Return-path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr60050.outbound.protection.outlook.com [40.107.6.50]) by dpdk.org (Postfix) with ESMTP id B9F301B01B for ; Tue, 19 Dec 2017 18:14:54 +0100 (CET) In-Reply-To: <1513703669-29363-1-git-send-email-matan@mellanox.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 liitle 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 --- drivers/net/failsafe/failsafe_private.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index d81cc3c..4196ece 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -269,13 +269,13 @@ int failsafe_eth_lsc_event_callback(uint16_t port_id, * 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 *) -- 1.8.3.1