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 21BC741E6D; Fri, 10 Mar 2023 23:16:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 56BA942D3E; Fri, 10 Mar 2023 23:15:50 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 3656C4113C for ; Fri, 10 Mar 2023 23:15:37 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 1BA40204473A; Fri, 10 Mar 2023 14:15:35 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 1BA40204473A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1678486536; bh=iuHJ0StecZ9Raltf9LtwKbKGPzFt503WEpiLM/1aHZ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EmMqmcK+ufntgQ5toa88niWh55MpaugNZ+PPZ+DEEUThzwFsUOAMMyGZW/ZNTgFT0 ieB6G06QlIoou1qH7wJdzw7yfBdU5pgN2CnIDGo52WrvhXM/NFSEpVvjHJOHx3BHv3 xKsy3JUlaJX8CU/Ji20OcQ/dwNVm+UcY63r2ENA4= From: Tyler Retzlaff To: dev@dpdk.org Cc: Honnappa.Nagarahalli@arm.com, Ruifeng.Wang@arm.com, thomas@monjalon.net, Tyler Retzlaff Subject: [PATCH 12/16] bbdev: use previous value atomic fetch operations Date: Fri, 10 Mar 2023 14:15:26 -0800 Message-Id: <1678486530-20688-13-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 --- lib/bbdev/rte_bbdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c index 1521cdb..9df0837 100644 --- a/lib/bbdev/rte_bbdev.c +++ b/lib/bbdev/rte_bbdev.c @@ -250,8 +250,8 @@ struct rte_bbdev * } /* clear shared BBDev Data if no process is using the device anymore */ - if (__atomic_sub_fetch(&bbdev->data->process_cnt, 1, - __ATOMIC_RELAXED) == 0) + if (__atomic_fetch_sub(&bbdev->data->process_cnt, 1, + __ATOMIC_RELAXED) - 1 == 0) memset(bbdev->data, 0, sizeof(*bbdev->data)); memset(bbdev, 0, sizeof(*bbdev)); -- 1.8.3.1