[v2,06/19] ipsec: use rte optional stdatomic API

Message ID 1697574677-16578-7-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series use rte optional stdatomic API |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tyler Retzlaff Oct. 17, 2023, 8:31 p.m. UTC
  Replace the use of gcc builtin __atomic_xxx intrinsics with
corresponding rte_atomic_xxx optional stdatomic API

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/ipsec/ipsec_sqn.h | 2 +-
 lib/ipsec/sa.h        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Comments

Konstantin Ananyev Oct. 24, 2023, 8:45 a.m. UTC | #1
17.10.2023 21:31, Tyler Retzlaff пишет:
> Replace the use of gcc builtin __atomic_xxx intrinsics with
> corresponding rte_atomic_xxx optional stdatomic API
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>   lib/ipsec/ipsec_sqn.h | 2 +-
>   lib/ipsec/sa.h        | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/ipsec/ipsec_sqn.h b/lib/ipsec/ipsec_sqn.h
> index 505950e..984a9dd 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_fetch_add(&sa->sqn.outb, n, __ATOMIC_RELAXED) + n;
> +		sqn = rte_atomic_fetch_add_explicit(&sa->sqn.outb, n, rte_memory_order_relaxed) + n;
>   	else {
>   		sqn = sa->sqn.outb + n;
>   		sa->sqn.outb = sqn;
> diff --git a/lib/ipsec/sa.h b/lib/ipsec/sa.h
> index ce4af8c..4b30bea 100644
> --- a/lib/ipsec/sa.h
> +++ b/lib/ipsec/sa.h
> @@ -124,7 +124,7 @@ struct rte_ipsec_sa {
>   	 * place from other frequently accessed data.
>   	 */
>   	union {
> -		uint64_t outb;
> +		RTE_ATOMIC(uint64_t) outb;
>   		struct {
>   			uint32_t rdidx; /* read index */
>   			uint32_t wridx; /* write index */


Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
  

Patch

diff --git a/lib/ipsec/ipsec_sqn.h b/lib/ipsec/ipsec_sqn.h
index 505950e..984a9dd 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_fetch_add(&sa->sqn.outb, n, __ATOMIC_RELAXED) + n;
+		sqn = rte_atomic_fetch_add_explicit(&sa->sqn.outb, n, rte_memory_order_relaxed) + n;
 	else {
 		sqn = sa->sqn.outb + n;
 		sa->sqn.outb = sqn;
diff --git a/lib/ipsec/sa.h b/lib/ipsec/sa.h
index ce4af8c..4b30bea 100644
--- a/lib/ipsec/sa.h
+++ b/lib/ipsec/sa.h
@@ -124,7 +124,7 @@  struct rte_ipsec_sa {
 	 * place from other frequently accessed data.
 	 */
 	union {
-		uint64_t outb;
+		RTE_ATOMIC(uint64_t) outb;
 		struct {
 			uint32_t rdidx; /* read index */
 			uint32_t wridx; /* write index */