From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CD33E41E6D; Fri, 10 Mar 2023 23:16:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C000542D29; Fri, 10 Mar 2023 23:15:46 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 195BE40ED9 for ; Fri, 10 Mar 2023 23:15:37 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 02EF02044736; Fri, 10 Mar 2023 14:15:35 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 02EF02044736 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1678486536; bh=yih9w3s1MaYWceV5z99Nk1kNmThi86opCjssIuPTuWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JKmwKq0+opsjG9GFgBiTGEXvzhbUXRi+cdQ4eJRuFh6fmYQtNrrTzPoSieftvEmw/ dYoYGWVFpQe7PnxXWA0r3WiNyTu/T2+l+HMsBSf244gOJgpz1C1W08/GJNsX96boeR IC4U574iO0y6EaUc10jF+sfdfiY1uaGDJZTfdzNU= From: Tyler Retzlaff To: dev@dpdk.org Cc: Honnappa.Nagarahalli@arm.com, Ruifeng.Wang@arm.com, thomas@monjalon.net, Tyler Retzlaff Subject: [PATCH 10/16] net/octeontx: use previous value atomic fetch operations Date: Fri, 10 Mar 2023 14:15:24 -0800 Message-Id: <1678486530-20688-11-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1678486530-20688-1-git-send-email-roretzla@linux.microsoft.com> References: <1678486530-20688-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- drivers/net/octeontx/octeontx_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index d52a3e7..a21ed80 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -559,7 +559,7 @@ enum octeontx_link_speed { return 0; /* Stopping/closing event device once all eth ports are closed. */ - if (__atomic_sub_fetch(&evdev_refcnt, 1, __ATOMIC_ACQUIRE) == 0) { + if (__atomic_fetch_sub(&evdev_refcnt, 1, __ATOMIC_ACQUIRE) - 1 == 0) { rte_event_dev_stop(nic->evdev); rte_event_dev_close(nic->evdev); } -- 1.8.3.1