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 550BF41EA5; Wed, 15 Mar 2023 22:16:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2289942D33; Wed, 15 Mar 2023 22:15:57 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 4DB6040A7A for ; Wed, 15 Mar 2023 22:15:48 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 12E8C20C32D1; Wed, 15 Mar 2023 14:15:46 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 12E8C20C32D1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1678914947; bh=7j7D8kUfuBK/jldRhy5nYO2hqi/yb9RGamw2+sYAs+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=npI8HmSByNRLeZsadjqpxU/clDHr6NN69TspeUETDvD0GCnRzPQu87MlxZul4fkfu He6opbALwffqy6DJ5vQKCD0zH3K6r3SRBfVVZG4VmZU/GJexFVEZpPjorsTFBSuKMY kOrXJiYGAfVd/RjWUj+YRZcnjSlqp6CESfhvojSo= From: Tyler Retzlaff To: dev@dpdk.org Cc: Honnappa.Nagarahalli@arm.com, Ruifeng.Wang@arm.com, thomas@monjalon.net, Tyler Retzlaff Subject: [PATCH v2 07/16] net/cxgbe: use previous value atomic fetch operations Date: Wed, 15 Mar 2023 14:15:36 -0700 Message-Id: <1678914945-10638-8-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1678914945-10638-1-git-send-email-roretzla@linux.microsoft.com> References: <1678486530-20688-1-git-send-email-roretzla@linux.microsoft.com> <1678914945-10638-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/cxgbe/clip_tbl.c | 2 +- drivers/net/cxgbe/mps_tcam.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/cxgbe/clip_tbl.c b/drivers/net/cxgbe/clip_tbl.c index 072fc74..f64b922 100644 --- a/drivers/net/cxgbe/clip_tbl.c +++ b/drivers/net/cxgbe/clip_tbl.c @@ -55,7 +55,7 @@ void cxgbe_clip_release(struct rte_eth_dev *dev, struct clip_entry *ce) int ret; t4_os_lock(&ce->lock); - if (__atomic_sub_fetch(&ce->refcnt, 1, __ATOMIC_RELAXED) == 0) { + if (__atomic_fetch_sub(&ce->refcnt, 1, __ATOMIC_RELAXED) - 1 == 0) { ret = clip6_release_mbox(dev, ce->addr); if (ret) dev_debug(adap, "CLIP FW DEL CMD failed: %d", ret); diff --git a/drivers/net/cxgbe/mps_tcam.c b/drivers/net/cxgbe/mps_tcam.c index abbf06e..c7cdf29 100644 --- a/drivers/net/cxgbe/mps_tcam.c +++ b/drivers/net/cxgbe/mps_tcam.c @@ -195,7 +195,7 @@ int cxgbe_mpstcam_remove(struct port_info *pi, u16 idx) entry->mask, idx, 1, pi->port_id, false); else - ret = __atomic_sub_fetch(&entry->refcnt, 1, __ATOMIC_RELAXED); + ret = __atomic_fetch_sub(&entry->refcnt, 1, __ATOMIC_RELAXED) - 1; if (ret == 0) { reset_mpstcam_entry(entry); -- 1.8.3.1