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 2EE54427E5; Mon, 20 Mar 2023 20:01:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 80A5342D2C; Mon, 20 Mar 2023 20:01:13 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 45E28410EF for ; Mon, 20 Mar 2023 20:01:03 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 12C2820FB405; Mon, 20 Mar 2023 12:01:01 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 12C2820FB405 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1679338862; bh=p3kSYY434iotxhxJBRK1kyamDWjPGKcQpRcSQ82xaeY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=la7SY5MSuXrBef+5PkMOkYPk6TksAQdUU+ItQD5vuiGluA8DFodF2q0zTTcZDdlua dwh0tQ7isYNdlzcc5S5NTQ8G9c96Zb/DHozZZL9kO1UNA2BevMRsDRbmcsQJ2oClGe A3KtQiTkD9+lBitvQ14GEp+y5vTQ4Q3fcyDAbJ28= From: Tyler Retzlaff To: dev@dpdk.org Cc: Honnappa.Nagarahalli@arm.com, Ruifeng.Wang@arm.com, thomas@monjalon.net, pbhagavatula@marvell.com, ndabilpuram@marvell.com, Tyler Retzlaff Subject: [PATCH v3 06/16] net/cnxk: use previous value atomic fetch operations Date: Mon, 20 Mar 2023 12:00:26 -0700 Message-Id: <1679338836-21321-7-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1679338836-21321-1-git-send-email-roretzla@linux.microsoft.com> References: <1678486530-20688-1-git-send-email-roretzla@linux.microsoft.com> <1679338836-21321-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 Acked-by: Nithin Dabilpuram Reviewed-by: Ruifeng Wang --- drivers/net/cnxk/cn10k_tx.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/cnxk/cn10k_tx.h b/drivers/net/cnxk/cn10k_tx.h index a72a803..c9ec01c 100644 --- a/drivers/net/cnxk/cn10k_tx.h +++ b/drivers/net/cnxk/cn10k_tx.h @@ -108,7 +108,7 @@ retry: while (__atomic_load_n(&txq->fc_cache_pkts, __ATOMIC_RELAXED) < 0) ; - cached = __atomic_sub_fetch(&txq->fc_cache_pkts, req, __ATOMIC_ACQUIRE); + cached = __atomic_fetch_sub(&txq->fc_cache_pkts, req, __ATOMIC_ACQUIRE) - req; /* Check if there is enough space, else update and retry. */ if (cached < 0) { /* Check if we have space else retry. */ @@ -302,7 +302,7 @@ again: fc_sw = txq->cpt_fc_sw; - val = __atomic_sub_fetch(fc_sw, nb_pkts, __ATOMIC_RELAXED); + val = __atomic_fetch_sub(fc_sw, nb_pkts, __ATOMIC_RELAXED) - nb_pkts; if (likely(val >= 0)) return; -- 1.8.3.1