From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 9AA75427E5;
	Mon, 20 Mar 2023 20:02:20 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 127BC42D42;
	Mon, 20 Mar 2023 20:01:20 +0100 (CET)
Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182])
 by mails.dpdk.org (Postfix) with ESMTP id 90E8842B71
 for <dev@dpdk.org>; Mon, 20 Mar 2023 20:01:03 +0100 (CET)
Received: by linux.microsoft.com (Postfix, from userid 1086)
 id 7935820FB42B; Mon, 20 Mar 2023 12:01:02 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7935820FB42B
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;
 s=default; t=1679338862;
 bh=HjIguY/SdyKE6hv8oNh49pLPoO2vkHoeHsBxKHnDD0w=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=Dl8MDiNJuoaCWKAuilKrZNIMW1HgVf+arGN2O/oFsrLX2rVuexbdYqBYMClMJgzSb
 81EPidHKo4vZposRDcqEcLNkUqMZP7Odtu5VvXESjLvAFPhHX1s6pwyFCZ27vcoCFw
 otB+4DQ96gppSg7l0ywO/uWuLxC6dur7cZc/nxm0=
From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: Honnappa.Nagarahalli@arm.com, Ruifeng.Wang@arm.com, thomas@monjalon.net,
 pbhagavatula@marvell.com, ndabilpuram@marvell.com,
 Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH v3 14/16] ipsec: use previous value atomic fetch operations
Date: Mon, 20 Mar 2023 12:00:34 -0700
Message-Id: <1679338836-21321-15-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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=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 <roretzla@linux.microsoft.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 lib/ipsec/ipsec_sqn.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ipsec/ipsec_sqn.h b/lib/ipsec/ipsec_sqn.h
index 2636cb1..505950e 100644
--- a/lib/ipsec/ipsec_sqn.h
+++ b/lib/ipsec/ipsec_sqn.h
@@ -128,7 +128,7 @@
 
 	n = *num;
 	if (SQN_ATOMIC(sa))
-		sqn = __atomic_add_fetch(&sa->sqn.outb, n, __ATOMIC_RELAXED);
+		sqn = __atomic_fetch_add(&sa->sqn.outb, n, __ATOMIC_RELAXED) + n;
 	else {
 		sqn = sa->sqn.outb + n;
 		sa->sqn.outb = sqn;
-- 
1.8.3.1