DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 00/17] use __atomic operations returning previous value
@ 2023-03-02  0:47 Tyler Retzlaff
  2023-03-02  0:47 ` [PATCH 01/17] vhost: use previous value atomic fetch operations Tyler Retzlaff
                   ` (18 more replies)
  0 siblings, 19 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02  0:47 UTC (permalink / raw)
  To: dev; +Cc: Honnappa.Nagarahalli, thomas, Tyler Retzlaff

This series replaces uses of __atomic_{add,and,or,sub,xor}_fetch with
__atomic_fetch_{add,and,or,sub,xor} intrinsics.  The latter omits generation
of code that is only needed if the returned value is actually used.

Additionally, this change simplifies adapting dpdk to standard atomics
planned for 23.07 since __atomic_fetch_xxx can be trivially replaced with
atomic_fetch_xxx whereas __atomic_xxx_fetch has no standard equivalent.

Tyler Retzlaff (17):
  vhost: use previous value atomic fetch operations
  telemetry: use previous value atomic fetch operations
  stack: use previous value atomic fetch operations
  eal: use previous value atomic fetch operations
  distributor: use previous value atomic fetch operations
  bbdev: use previous value atomic fetch operations
  examples/vhost: use previous value atomic fetch operations
  net/virtio: use previous value atomic fetch operations
  net/octeontx: use previous value atomic fetch operations
  net/mlx5: use previous value atomic fetch operations
  net/iavf: use previous value atomic fetch operations
  net/cxgbe: use previous value atomic fetch operations
  drivers/event: use previous value atomic fetch operations
  dma/skeleton: use previous value atomic fetch operations
  drivers/common: use previous value atomic fetch operations
  app/test: use previous value atomic fetch operations
  test-eventdev: use previous value atomic fetch operations

 app/test-eventdev/test_order_common.h            |  2 +-
 app/test/test_lcores.c                           |  2 +-
 app/test/test_service_cores.c                    |  4 ++--
 drivers/common/cnxk/roc_nix_inl_dev.c            |  2 +-
 drivers/common/mlx5/mlx5_common_mr.c             |  2 +-
 drivers/common/mlx5/mlx5_common_utils.c          | 10 +++++-----
 drivers/common/mlx5/mlx5_malloc.c                | 16 ++++++++--------
 drivers/dma/skeleton/skeleton_dmadev.c           |  2 +-
 drivers/event/cnxk/cnxk_eventdev_selftest.c      | 12 ++++++------
 drivers/event/cnxk/cnxk_tim_worker.h             |  6 +++---
 drivers/event/dsw/dsw_event.c                    |  6 +++---
 drivers/event/octeontx/timvf_worker.h            |  6 +++---
 drivers/net/cxgbe/clip_tbl.c                     |  2 +-
 drivers/net/cxgbe/cxgbe_main.c                   | 12 ++++++------
 drivers/net/cxgbe/l2t.c                          |  4 ++--
 drivers/net/cxgbe/mps_tcam.c                     |  2 +-
 drivers/net/cxgbe/smt.c                          |  4 ++--
 drivers/net/iavf/iavf_vchnl.c                    |  6 +++---
 drivers/net/mlx5/linux/mlx5_verbs.c              |  2 +-
 drivers/net/mlx5/mlx5_flow.c                     |  6 +++---
 drivers/net/mlx5/mlx5_flow_dv.c                  |  4 ++--
 drivers/net/mlx5/mlx5_flow_flex.c                |  6 +++---
 drivers/net/mlx5/mlx5_flow_hw.c                  | 10 +++++-----
 drivers/net/mlx5/mlx5_flow_meter.c               | 20 ++++++++++----------
 drivers/net/mlx5/mlx5_rx.h                       |  2 +-
 drivers/net/octeontx/octeontx_ethdev.c           |  2 +-
 drivers/net/virtio/virtio_user/virtio_user_dev.c |  2 +-
 examples/vhost/main.c                            | 12 ++++++------
 examples/vhost/virtio_net.c                      |  4 ++--
 lib/bbdev/rte_bbdev.c                            |  2 +-
 lib/distributor/rte_distributor.c                |  2 +-
 lib/eal/common/eal_common_trace.c                |  8 ++++----
 lib/eal/common/rte_service.c                     |  8 ++++----
 lib/eal/ppc/include/rte_atomic.h                 | 16 ++++++++--------
 lib/stack/rte_stack_lf_c11.h                     |  2 +-
 lib/telemetry/telemetry.c                        |  6 +++---
 lib/vhost/virtio_net.c                           |  6 +++---
 37 files changed, 110 insertions(+), 110 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 01/17] vhost: use previous value atomic fetch operations
  2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
@ 2023-03-02  0:47 ` Tyler Retzlaff
  2023-03-02 14:47   ` Maxime Coquelin
  2023-03-02  0:47 ` [PATCH 02/17] telemetry: " Tyler Retzlaff
                   ` (17 subsequent siblings)
  18 siblings, 1 reply; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02  0:47 UTC (permalink / raw)
  To: dev; +Cc: Honnappa.Nagarahalli, thomas, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/vhost/virtio_net.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index 51dc3c9..dc49a54 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -298,7 +298,7 @@
 
 	vhost_log_cache_sync(dev, vq);
 
-	__atomic_add_fetch(&vq->used->idx, vq->shadow_used_idx,
+	__atomic_fetch_add(&vq->used->idx, vq->shadow_used_idx,
 			   __ATOMIC_RELEASE);
 	vq->shadow_used_idx = 0;
 	vhost_log_used_vring(dev, vq, offsetof(struct vring_used, idx),
@@ -2311,7 +2311,7 @@
 			vhost_vring_call_packed(dev, vq);
 		} else {
 			write_back_completed_descs_split(vq, n_descs);
-			__atomic_add_fetch(&vq->used->idx, n_descs, __ATOMIC_RELEASE);
+			__atomic_fetch_add(&vq->used->idx, n_descs, __ATOMIC_RELEASE);
 			vhost_vring_call_split(dev, vq);
 		}
 	} else {
@@ -3683,7 +3683,7 @@
 		vhost_vring_call_packed(dev, vq);
 	} else {
 		write_back_completed_descs_split(vq, nr_cpl_pkts);
-		__atomic_add_fetch(&vq->used->idx, nr_cpl_pkts, __ATOMIC_RELEASE);
+		__atomic_fetch_add(&vq->used->idx, nr_cpl_pkts, __ATOMIC_RELEASE);
 		vhost_vring_call_split(dev, vq);
 	}
 	vq->async->pkts_inflight_n -= nr_cpl_pkts;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 02/17] telemetry: use previous value atomic fetch operations
  2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
  2023-03-02  0:47 ` [PATCH 01/17] vhost: use previous value atomic fetch operations Tyler Retzlaff
@ 2023-03-02  0:47 ` Tyler Retzlaff
  2023-03-02  9:34   ` Bruce Richardson
  2023-03-02  0:47 ` [PATCH 03/17] stack: " Tyler Retzlaff
                   ` (16 subsequent siblings)
  18 siblings, 1 reply; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02  0:47 UTC (permalink / raw)
  To: dev; +Cc: Honnappa.Nagarahalli, thomas, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/telemetry/telemetry.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
index 7bceadc..deba7f3 100644
--- a/lib/telemetry/telemetry.c
+++ b/lib/telemetry/telemetry.c
@@ -391,7 +391,7 @@ struct socket {
 		bytes = read(s, buffer, sizeof(buffer) - 1);
 	}
 	close(s);
-	__atomic_sub_fetch(&v2_clients, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_sub(&v2_clients, 1, __ATOMIC_RELAXED);
 	return NULL;
 }
 
@@ -414,7 +414,7 @@ struct socket {
 				close(s_accepted);
 				continue;
 			}
-			__atomic_add_fetch(s->num_clients, 1,
+			__atomic_fetch_add(s->num_clients, 1,
 					__ATOMIC_RELAXED);
 		}
 		rc = pthread_create(&th, NULL, s->fn,
@@ -424,7 +424,7 @@ struct socket {
 				 strerror(rc));
 			close(s_accepted);
 			if (s->num_clients != NULL)
-				__atomic_sub_fetch(s->num_clients, 1,
+				__atomic_fetch_sub(s->num_clients, 1,
 						   __ATOMIC_RELAXED);
 			continue;
 		}
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 03/17] stack: use previous value atomic fetch operations
  2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
  2023-03-02  0:47 ` [PATCH 01/17] vhost: use previous value atomic fetch operations Tyler Retzlaff
  2023-03-02  0:47 ` [PATCH 02/17] telemetry: " Tyler Retzlaff
@ 2023-03-02  0:47 ` Tyler Retzlaff
  2023-03-02  0:47 ` [PATCH 04/17] eal: " Tyler Retzlaff
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02  0:47 UTC (permalink / raw)
  To: dev; +Cc: Honnappa.Nagarahalli, thomas, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/stack/rte_stack_lf_c11.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/stack/rte_stack_lf_c11.h b/lib/stack/rte_stack_lf_c11.h
index 8403196..687a6f6 100644
--- a/lib/stack/rte_stack_lf_c11.h
+++ b/lib/stack/rte_stack_lf_c11.h
@@ -66,7 +66,7 @@
 	/* Ensure the stack modifications are not reordered with respect
 	 * to the LIFO len update.
 	 */
-	__atomic_add_fetch(&list->len, num, __ATOMIC_RELEASE);
+	__atomic_fetch_add(&list->len, num, __ATOMIC_RELEASE);
 }
 
 static __rte_always_inline struct rte_stack_lf_elem *
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 04/17] eal: use previous value atomic fetch operations
  2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
                   ` (2 preceding siblings ...)
  2023-03-02  0:47 ` [PATCH 03/17] stack: " Tyler Retzlaff
@ 2023-03-02  0:47 ` Tyler Retzlaff
  2023-03-02  0:47 ` [PATCH 05/17] distributor: " Tyler Retzlaff
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02  0:47 UTC (permalink / raw)
  To: dev; +Cc: Honnappa.Nagarahalli, thomas, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/eal/common/eal_common_trace.c |  8 ++++----
 lib/eal/common/rte_service.c      |  8 ++++----
 lib/eal/ppc/include/rte_atomic.h  | 16 ++++++++--------
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/lib/eal/common/eal_common_trace.c b/lib/eal/common/eal_common_trace.c
index 75162b7..cb980af 100644
--- a/lib/eal/common/eal_common_trace.c
+++ b/lib/eal/common/eal_common_trace.c
@@ -103,10 +103,10 @@ struct trace_point_head *
 trace_mode_set(rte_trace_point_t *t, enum rte_trace_mode mode)
 {
 	if (mode == RTE_TRACE_MODE_OVERWRITE)
-		__atomic_and_fetch(t, ~__RTE_TRACE_FIELD_ENABLE_DISCARD,
+		__atomic_fetch_and(t, ~__RTE_TRACE_FIELD_ENABLE_DISCARD,
 			__ATOMIC_RELEASE);
 	else
-		__atomic_or_fetch(t, __RTE_TRACE_FIELD_ENABLE_DISCARD,
+		__atomic_fetch_or(t, __RTE_TRACE_FIELD_ENABLE_DISCARD,
 			__ATOMIC_RELEASE);
 }
 
@@ -155,7 +155,7 @@ rte_trace_mode rte_trace_mode_get(void)
 
 	prev = __atomic_fetch_or(t, __RTE_TRACE_FIELD_ENABLE_MASK, __ATOMIC_RELEASE);
 	if ((prev & __RTE_TRACE_FIELD_ENABLE_MASK) == 0)
-		__atomic_add_fetch(&trace.status, 1, __ATOMIC_RELEASE);
+		__atomic_fetch_add(&trace.status, 1, __ATOMIC_RELEASE);
 	return 0;
 }
 
@@ -169,7 +169,7 @@ rte_trace_mode rte_trace_mode_get(void)
 
 	prev = __atomic_fetch_and(t, ~__RTE_TRACE_FIELD_ENABLE_MASK, __ATOMIC_RELEASE);
 	if ((prev & __RTE_TRACE_FIELD_ENABLE_MASK) != 0)
-		__atomic_sub_fetch(&trace.status, 1, __ATOMIC_RELEASE);
+		__atomic_fetch_sub(&trace.status, 1, __ATOMIC_RELEASE);
 	return 0;
 }
 
diff --git a/lib/eal/common/rte_service.c b/lib/eal/common/rte_service.c
index 42ca1d0..7ab48f2 100644
--- a/lib/eal/common/rte_service.c
+++ b/lib/eal/common/rte_service.c
@@ -464,11 +464,11 @@ struct core_state {
 	/* Increment num_mapped_cores to reflect that this core is
 	 * now mapped capable of running the service.
 	 */
-	__atomic_add_fetch(&s->num_mapped_cores, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&s->num_mapped_cores, 1, __ATOMIC_RELAXED);
 
 	int ret = service_run(id, cs, UINT64_MAX, s, serialize_mt_unsafe);
 
-	__atomic_sub_fetch(&s->num_mapped_cores, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_sub(&s->num_mapped_cores, 1, __ATOMIC_RELAXED);
 
 	return ret;
 }
@@ -638,12 +638,12 @@ struct core_state {
 
 		if (*set && !lcore_mapped) {
 			lcore_states[lcore].service_mask |= sid_mask;
-			__atomic_add_fetch(&rte_services[sid].num_mapped_cores,
+			__atomic_fetch_add(&rte_services[sid].num_mapped_cores,
 				1, __ATOMIC_RELAXED);
 		}
 		if (!*set && lcore_mapped) {
 			lcore_states[lcore].service_mask &= ~(sid_mask);
-			__atomic_sub_fetch(&rte_services[sid].num_mapped_cores,
+			__atomic_fetch_sub(&rte_services[sid].num_mapped_cores,
 				1, __ATOMIC_RELAXED);
 		}
 	}
diff --git a/lib/eal/ppc/include/rte_atomic.h b/lib/eal/ppc/include/rte_atomic.h
index 663b4d3..2ab735b 100644
--- a/lib/eal/ppc/include/rte_atomic.h
+++ b/lib/eal/ppc/include/rte_atomic.h
@@ -60,13 +60,13 @@ static inline int rte_atomic16_test_and_set(rte_atomic16_t *v)
 static inline void
 rte_atomic16_inc(rte_atomic16_t *v)
 {
-	__atomic_add_fetch(&v->cnt, 1, __ATOMIC_ACQUIRE);
+	__atomic_fetch_add(&v->cnt, 1, __ATOMIC_ACQUIRE);
 }
 
 static inline void
 rte_atomic16_dec(rte_atomic16_t *v)
 {
-	__atomic_sub_fetch(&v->cnt, 1, __ATOMIC_ACQUIRE);
+	__atomic_fetch_sub(&v->cnt, 1, __ATOMIC_ACQUIRE);
 }
 
 static inline int rte_atomic16_inc_and_test(rte_atomic16_t *v)
@@ -102,13 +102,13 @@ static inline int rte_atomic32_test_and_set(rte_atomic32_t *v)
 static inline void
 rte_atomic32_inc(rte_atomic32_t *v)
 {
-	__atomic_add_fetch(&v->cnt, 1, __ATOMIC_ACQUIRE);
+	__atomic_fetch_add(&v->cnt, 1, __ATOMIC_ACQUIRE);
 }
 
 static inline void
 rte_atomic32_dec(rte_atomic32_t *v)
 {
-	__atomic_sub_fetch(&v->cnt, 1, __ATOMIC_ACQUIRE);
+	__atomic_fetch_sub(&v->cnt, 1, __ATOMIC_ACQUIRE);
 }
 
 static inline int rte_atomic32_inc_and_test(rte_atomic32_t *v)
@@ -157,25 +157,25 @@ static inline int rte_atomic32_dec_and_test(rte_atomic32_t *v)
 static inline void
 rte_atomic64_add(rte_atomic64_t *v, int64_t inc)
 {
-	__atomic_add_fetch(&v->cnt, inc, __ATOMIC_ACQUIRE);
+	__atomic_fetch_add(&v->cnt, inc, __ATOMIC_ACQUIRE);
 }
 
 static inline void
 rte_atomic64_sub(rte_atomic64_t *v, int64_t dec)
 {
-	__atomic_sub_fetch(&v->cnt, dec, __ATOMIC_ACQUIRE);
+	__atomic_fetch_sub(&v->cnt, dec, __ATOMIC_ACQUIRE);
 }
 
 static inline void
 rte_atomic64_inc(rte_atomic64_t *v)
 {
-	__atomic_add_fetch(&v->cnt, 1, __ATOMIC_ACQUIRE);
+	__atomic_fetch_add(&v->cnt, 1, __ATOMIC_ACQUIRE);
 }
 
 static inline void
 rte_atomic64_dec(rte_atomic64_t *v)
 {
-	__atomic_sub_fetch(&v->cnt, 1, __ATOMIC_ACQUIRE);
+	__atomic_fetch_sub(&v->cnt, 1, __ATOMIC_ACQUIRE);
 }
 
 static inline int64_t
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 05/17] distributor: use previous value atomic fetch operations
  2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
                   ` (3 preceding siblings ...)
  2023-03-02  0:47 ` [PATCH 04/17] eal: " Tyler Retzlaff
@ 2023-03-02  0:47 ` Tyler Retzlaff
  2023-03-02  0:47 ` [PATCH 06/17] bbdev: " Tyler Retzlaff
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02  0:47 UTC (permalink / raw)
  To: dev; +Cc: Honnappa.Nagarahalli, thomas, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/distributor/rte_distributor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/distributor/rte_distributor.c b/lib/distributor/rte_distributor.c
index 3969b2e..68840ce 100644
--- a/lib/distributor/rte_distributor.c
+++ b/lib/distributor/rte_distributor.c
@@ -200,7 +200,7 @@
 	 * we won't read any mbufs from there even if GET_BUF is set.
 	 * This allows distributor to retrieve in-flight already sent packets.
 	 */
-	__atomic_or_fetch(&(buf->bufptr64[0]), RTE_DISTRIB_RETURN_BUF,
+	__atomic_fetch_or(&(buf->bufptr64[0]), RTE_DISTRIB_RETURN_BUF,
 		__ATOMIC_ACQ_REL);
 
 	/* set the RETURN_BUF on retptr64 even if we got no returns.
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 06/17] bbdev: use previous value atomic fetch operations
  2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
                   ` (4 preceding siblings ...)
  2023-03-02  0:47 ` [PATCH 05/17] distributor: " Tyler Retzlaff
@ 2023-03-02  0:47 ` Tyler Retzlaff
  2023-03-02  0:47 ` [PATCH 07/17] examples/vhost: " Tyler Retzlaff
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02  0:47 UTC (permalink / raw)
  To: dev; +Cc: Honnappa.Nagarahalli, thomas, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/bbdev/rte_bbdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c
index 1521cdb..69e099d 100644
--- a/lib/bbdev/rte_bbdev.c
+++ b/lib/bbdev/rte_bbdev.c
@@ -208,7 +208,7 @@ struct rte_bbdev *
 		return NULL;
 	}
 
-	__atomic_add_fetch(&bbdev->data->process_cnt, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&bbdev->data->process_cnt, 1, __ATOMIC_RELAXED);
 	bbdev->data->dev_id = dev_id;
 	bbdev->state = RTE_BBDEV_INITIALIZED;
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 07/17] examples/vhost: use previous value atomic fetch operations
  2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
                   ` (5 preceding siblings ...)
  2023-03-02  0:47 ` [PATCH 06/17] bbdev: " Tyler Retzlaff
@ 2023-03-02  0:47 ` Tyler Retzlaff
  2023-03-02 14:47   ` Maxime Coquelin
  2023-03-02  0:47 ` [PATCH 08/17] net/virtio: " Tyler Retzlaff
                   ` (11 subsequent siblings)
  18 siblings, 1 reply; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02  0:47 UTC (permalink / raw)
  To: dev; +Cc: Honnappa.Nagarahalli, thomas, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 examples/vhost/main.c       | 12 ++++++------
 examples/vhost/virtio_net.c |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 42e53a0..bfe466f 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -1048,9 +1048,9 @@ static unsigned check_ports_num(unsigned nb_ports)
 	}
 
 	if (enable_stats) {
-		__atomic_add_fetch(&dst_vdev->stats.rx_total_atomic, 1,
+		__atomic_fetch_add(&dst_vdev->stats.rx_total_atomic, 1,
 				__ATOMIC_SEQ_CST);
-		__atomic_add_fetch(&dst_vdev->stats.rx_atomic, ret,
+		__atomic_fetch_add(&dst_vdev->stats.rx_atomic, ret,
 				__ATOMIC_SEQ_CST);
 		src_vdev->stats.tx_total++;
 		src_vdev->stats.tx += ret;
@@ -1068,9 +1068,9 @@ static unsigned check_ports_num(unsigned nb_ports)
 	ret = vdev_queue_ops[vdev->vid].enqueue_pkt_burst(vdev, VIRTIO_RXQ, m, nr_xmit);
 
 	if (enable_stats) {
-		__atomic_add_fetch(&vdev->stats.rx_total_atomic, nr_xmit,
+		__atomic_fetch_add(&vdev->stats.rx_total_atomic, nr_xmit,
 				__ATOMIC_SEQ_CST);
-		__atomic_add_fetch(&vdev->stats.rx_atomic, ret,
+		__atomic_fetch_add(&vdev->stats.rx_atomic, ret,
 				__ATOMIC_SEQ_CST);
 	}
 
@@ -1400,9 +1400,9 @@ static void virtio_tx_offload(struct rte_mbuf *m)
 	}
 
 	if (enable_stats) {
-		__atomic_add_fetch(&vdev->stats.rx_total_atomic, rx_count,
+		__atomic_fetch_add(&vdev->stats.rx_total_atomic, rx_count,
 				__ATOMIC_SEQ_CST);
-		__atomic_add_fetch(&vdev->stats.rx_atomic, enqueue_count,
+		__atomic_fetch_add(&vdev->stats.rx_atomic, enqueue_count,
 				__ATOMIC_SEQ_CST);
 	}
 
diff --git a/examples/vhost/virtio_net.c b/examples/vhost/virtio_net.c
index 1d4737f..514c8e0 100644
--- a/examples/vhost/virtio_net.c
+++ b/examples/vhost/virtio_net.c
@@ -231,7 +231,7 @@
 			rte_prefetch0(&vr->desc[desc_indexes[i+1]]);
 	}
 
-	__atomic_add_fetch(&vr->used->idx, count, __ATOMIC_RELEASE);
+	__atomic_fetch_add(&vr->used->idx, count, __ATOMIC_RELEASE);
 	queue->last_used_idx += count;
 
 	rte_vhost_vring_call(dev->vid, queue_id);
@@ -442,7 +442,7 @@
 	queue->last_avail_idx += i;
 	queue->last_used_idx += i;
 
-	__atomic_add_fetch(&vr->used->idx, i, __ATOMIC_ACQ_REL);
+	__atomic_fetch_add(&vr->used->idx, i, __ATOMIC_ACQ_REL);
 
 	rte_vhost_vring_call(dev->vid, queue_id);
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 08/17] net/virtio: use previous value atomic fetch operations
  2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
                   ` (6 preceding siblings ...)
  2023-03-02  0:47 ` [PATCH 07/17] examples/vhost: " Tyler Retzlaff
@ 2023-03-02  0:47 ` Tyler Retzlaff
  2023-03-02 14:48   ` Maxime Coquelin
  2023-03-02  0:47 ` [PATCH 09/17] net/octeontx: " Tyler Retzlaff
                   ` (10 subsequent siblings)
  18 siblings, 1 reply; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02  0:47 UTC (permalink / raw)
  To: dev; +Cc: Honnappa.Nagarahalli, thomas, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index f46a131..2b4607a 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -1025,7 +1025,7 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)
 		uep->id = desc_idx;
 		uep->len = n_descs;
 
-		__atomic_add_fetch(&vring->used->idx, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_add(&vring->used->idx, 1, __ATOMIC_RELAXED);
 	}
 }
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 09/17] net/octeontx: use previous value atomic fetch operations
  2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
                   ` (7 preceding siblings ...)
  2023-03-02  0:47 ` [PATCH 08/17] net/virtio: " Tyler Retzlaff
@ 2023-03-02  0:47 ` Tyler Retzlaff
  2023-03-02  0:47 ` [PATCH 10/17] net/mlx5: " Tyler Retzlaff
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02  0:47 UTC (permalink / raw)
  To: dev; +Cc: Honnappa.Nagarahalli, thomas, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/octeontx/octeontx_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index d52a3e7..e00298e 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -1581,7 +1581,7 @@ static void build_xstat_names(struct rte_eth_xstat_name *xstat_names)
 	nic->pko_vfid = pko_vfid;
 	nic->port_id = port;
 	nic->evdev = evdev;
-	__atomic_add_fetch(&evdev_refcnt, 1, __ATOMIC_ACQUIRE);
+	__atomic_fetch_add(&evdev_refcnt, 1, __ATOMIC_ACQUIRE);
 
 	res = octeontx_port_open(nic);
 	if (res < 0)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 10/17] net/mlx5: use previous value atomic fetch operations
  2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
                   ` (8 preceding siblings ...)
  2023-03-02  0:47 ` [PATCH 09/17] net/octeontx: " Tyler Retzlaff
@ 2023-03-02  0:47 ` Tyler Retzlaff
  2023-03-02  0:47 ` [PATCH 11/17] net/iavf: " Tyler Retzlaff
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02  0:47 UTC (permalink / raw)
  To: dev; +Cc: Honnappa.Nagarahalli, thomas, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/mlx5/linux/mlx5_verbs.c |  2 +-
 drivers/net/mlx5/mlx5_flow.c        |  6 +++---
 drivers/net/mlx5/mlx5_flow_dv.c     |  4 ++--
 drivers/net/mlx5/mlx5_flow_flex.c   |  6 +++---
 drivers/net/mlx5/mlx5_flow_hw.c     | 10 +++++-----
 drivers/net/mlx5/mlx5_flow_meter.c  | 20 ++++++++++----------
 drivers/net/mlx5/mlx5_rx.h          |  2 +-
 7 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/net/mlx5/linux/mlx5_verbs.c b/drivers/net/mlx5/linux/mlx5_verbs.c
index 67a7bec..c722613 100644
--- a/drivers/net/mlx5/linux/mlx5_verbs.c
+++ b/drivers/net/mlx5/linux/mlx5_verbs.c
@@ -1159,7 +1159,7 @@
 		claim_zero(mlx5_glue->destroy_cq(sh->self_lb.ibv_cq));
 		sh->self_lb.ibv_cq = NULL;
 	}
-	(void)__atomic_sub_fetch(&sh->self_lb.refcnt, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_sub(&sh->self_lb.refcnt, 1, __ATOMIC_RELAXED);
 	return -rte_errno;
 #else
 	RTE_SET_USED(dev);
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index a6a426c..1c51b29 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -4451,7 +4451,7 @@ struct mlx5_translated_action_handle {
 			shared_rss = mlx5_ipool_get
 				(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS],
 									   idx);
-			__atomic_add_fetch(&shared_rss->refcnt, 1,
+			__atomic_fetch_add(&shared_rss->refcnt, 1,
 					   __ATOMIC_RELAXED);
 			return idx;
 		default:
@@ -7295,7 +7295,7 @@ struct mlx5_list_entry *
 	if (tunnel) {
 		flow->tunnel = 1;
 		flow->tunnel_id = tunnel->tunnel_id;
-		__atomic_add_fetch(&tunnel->refctn, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_add(&tunnel->refctn, 1, __ATOMIC_RELAXED);
 		mlx5_free(default_miss_ctx.queue);
 	}
 	mlx5_flow_pop_thread_workspace();
@@ -7306,7 +7306,7 @@ struct mlx5_list_entry *
 	flow_mreg_del_copy_action(dev, flow);
 	flow_drv_destroy(dev, flow);
 	if (rss_desc->shared_rss)
-		__atomic_sub_fetch(&((struct mlx5_shared_action_rss *)
+		__atomic_fetch_sub(&((struct mlx5_shared_action_rss *)
 			mlx5_ipool_get
 			(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS],
 			rss_desc->shared_rss))->refcnt, 1, __ATOMIC_RELAXED);
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index f93dd40..0233cde 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -15143,7 +15143,7 @@ struct mlx5_list_entry *
 
 	shared_rss = mlx5_ipool_get
 			(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS], srss);
-	__atomic_sub_fetch(&shared_rss->refcnt, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_sub(&shared_rss->refcnt, 1, __ATOMIC_RELAXED);
 }
 
 void
@@ -15734,7 +15734,7 @@ struct mlx5_list_entry *
 	/* Update queue with indirect table queue memoyr. */
 	origin->queue = shared_rss->ind_tbl->queues;
 	rte_spinlock_init(&shared_rss->action_rss_sl);
-	__atomic_add_fetch(&shared_rss->refcnt, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&shared_rss->refcnt, 1, __ATOMIC_RELAXED);
 	rte_spinlock_lock(&priv->shared_act_sl);
 	ILIST_INSERT(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS],
 		     &priv->rss_shared_actions, idx, shared_rss, next);
diff --git a/drivers/net/mlx5/mlx5_flow_flex.c b/drivers/net/mlx5/mlx5_flow_flex.c
index 35f2a99..a825274 100644
--- a/drivers/net/mlx5/mlx5_flow_flex.c
+++ b/drivers/net/mlx5/mlx5_flow_flex.c
@@ -301,7 +301,7 @@
 		return ret;
 	}
 	if (acquire)
-		__atomic_add_fetch(&flex->refcnt, 1, __ATOMIC_RELEASE);
+		__atomic_fetch_add(&flex->refcnt, 1, __ATOMIC_RELEASE);
 	return ret;
 }
 
@@ -336,7 +336,7 @@
 		rte_errno = -EINVAL;
 		return -EINVAL;
 	}
-	__atomic_sub_fetch(&flex->refcnt, 1, __ATOMIC_RELEASE);
+	__atomic_fetch_sub(&flex->refcnt, 1, __ATOMIC_RELEASE);
 	return 0;
 }
 
@@ -1220,7 +1220,7 @@ struct rte_flow_item_flex_handle *
 	}
 	flex->devx_fp = container_of(ent, struct mlx5_flex_parser_devx, entry);
 	/* Mark initialized flex item valid. */
-	__atomic_add_fetch(&flex->refcnt, 1, __ATOMIC_RELEASE);
+	__atomic_fetch_add(&flex->refcnt, 1, __ATOMIC_RELEASE);
 	return (struct rte_flow_item_flex_handle *)flex;
 
 error:
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index a9c7045..159ebb5 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -1406,7 +1406,7 @@ static rte_be32_t vlan_hdr_to_be32(const struct rte_flow_action *actions)
 				goto err;
 			acts->rule_acts[action_pos].action =
 				priv->hw_tag[!!attr->group];
-			__atomic_add_fetch(&priv->hws_mark_refcnt, 1, __ATOMIC_RELAXED);
+			__atomic_fetch_add(&priv->hws_mark_refcnt, 1, __ATOMIC_RELAXED);
 			flow_hw_rxq_flag_set(dev, true);
 			break;
 		case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:
@@ -3162,13 +3162,13 @@ static rte_be32_t vlan_hdr_to_be32(const struct rte_flow_action *actions)
 at_error:
 	while (i--) {
 		__flow_hw_action_template_destroy(dev, &tbl->ats[i].acts);
-		__atomic_sub_fetch(&action_templates[i]->refcnt,
+		__atomic_fetch_sub(&action_templates[i]->refcnt,
 				   1, __ATOMIC_RELAXED);
 	}
 	i = nb_item_templates;
 it_error:
 	while (i--)
-		__atomic_sub_fetch(&item_templates[i]->refcnt,
+		__atomic_fetch_sub(&item_templates[i]->refcnt,
 				   1, __ATOMIC_RELAXED);
 error:
 	err = rte_errno;
@@ -3361,11 +3361,11 @@ static rte_be32_t vlan_hdr_to_be32(const struct rte_flow_action *actions)
 	}
 	LIST_REMOVE(table, next);
 	for (i = 0; i < table->nb_item_templates; i++)
-		__atomic_sub_fetch(&table->its[i]->refcnt,
+		__atomic_fetch_sub(&table->its[i]->refcnt,
 				   1, __ATOMIC_RELAXED);
 	for (i = 0; i < table->nb_action_templates; i++) {
 		__flow_hw_action_template_destroy(dev, &table->ats[i].acts);
-		__atomic_sub_fetch(&table->ats[i].action_template->refcnt,
+		__atomic_fetch_sub(&table->ats[i].action_template->refcnt,
 				   1, __ATOMIC_RELAXED);
 	}
 	mlx5dr_matcher_destroy(table->matcher);
diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c
index 08f8aad..cb26a12 100644
--- a/drivers/net/mlx5/mlx5_flow_meter.c
+++ b/drivers/net/mlx5/mlx5_flow_meter.c
@@ -1788,7 +1788,7 @@ struct mlx5_flow_meter_policy *
 			NULL, "Meter profile id not valid.");
 	/* Meter policy must exist. */
 	if (params->meter_policy_id == priv->sh->mtrmng->def_policy_id) {
-		__atomic_add_fetch
+		__atomic_fetch_add
 			(&priv->sh->mtrmng->def_policy_ref_cnt,
 			1, __ATOMIC_RELAXED);
 		domain_bitmap = MLX5_MTR_ALL_DOMAIN_BIT;
@@ -1870,7 +1870,7 @@ struct mlx5_flow_meter_policy *
 	fm->is_enable = params->meter_enable;
 	fm->shared = !!shared;
 	fm->color_aware = !!params->use_prev_mtr_color;
-	__atomic_add_fetch(&fm->profile->ref_cnt, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&fm->profile->ref_cnt, 1, __ATOMIC_RELAXED);
 	if (params->meter_policy_id == priv->sh->mtrmng->def_policy_id) {
 		fm->def_policy = 1;
 		fm->flow_ipool = mlx5_ipool_create(&flow_ipool_cfg);
@@ -1899,7 +1899,7 @@ struct mlx5_flow_meter_policy *
 	}
 	fm->active_state = params->meter_enable;
 	if (mtr_policy)
-		__atomic_add_fetch(&mtr_policy->ref_cnt, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_add(&mtr_policy->ref_cnt, 1, __ATOMIC_RELAXED);
 	return 0;
 error:
 	mlx5_flow_destroy_mtr_tbls(dev, fm);
@@ -1994,8 +1994,8 @@ struct mlx5_flow_meter_policy *
 			RTE_MTR_ERROR_TYPE_UNSPECIFIED,
 			NULL, "Failed to create devx meter.");
 	fm->active_state = params->meter_enable;
-	__atomic_add_fetch(&fm->profile->ref_cnt, 1, __ATOMIC_RELAXED);
-	__atomic_add_fetch(&policy->ref_cnt, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&fm->profile->ref_cnt, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&policy->ref_cnt, 1, __ATOMIC_RELAXED);
 	return 0;
 }
 
@@ -2017,7 +2017,7 @@ struct mlx5_flow_meter_policy *
 	if (fmp == NULL)
 		return -1;
 	/* Update dependencies. */
-	__atomic_sub_fetch(&fmp->ref_cnt, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_sub(&fmp->ref_cnt, 1, __ATOMIC_RELAXED);
 	fm->profile = NULL;
 	/* Remove from list. */
 	if (!priv->sh->meter_aso_en) {
@@ -2035,14 +2035,14 @@ struct mlx5_flow_meter_policy *
 	}
 	mlx5_flow_destroy_mtr_tbls(dev, fm);
 	if (fm->def_policy)
-		__atomic_sub_fetch(&priv->sh->mtrmng->def_policy_ref_cnt,
+		__atomic_fetch_sub(&priv->sh->mtrmng->def_policy_ref_cnt,
 				1, __ATOMIC_RELAXED);
 	if (priv->sh->meter_aso_en) {
 		if (!fm->def_policy) {
 			mtr_policy = mlx5_flow_meter_policy_find(dev,
 						fm->policy_id, NULL);
 			if (mtr_policy)
-				__atomic_sub_fetch(&mtr_policy->ref_cnt,
+				__atomic_fetch_sub(&mtr_policy->ref_cnt,
 						1, __ATOMIC_RELAXED);
 			fm->policy_id = 0;
 		}
@@ -2146,12 +2146,12 @@ struct mlx5_flow_meter_policy *
 					  RTE_MTR_ERROR_TYPE_UNSPECIFIED,
 					  NULL, "Meter object is being used.");
 	/* Destroy the meter profile. */
-	__atomic_sub_fetch(&fm->profile->ref_cnt,
+	__atomic_fetch_sub(&fm->profile->ref_cnt,
 						1, __ATOMIC_RELAXED);
 	/* Destroy the meter policy. */
 	policy = mlx5_flow_meter_policy_find(dev,
 			fm->policy_id, NULL);
-	__atomic_sub_fetch(&policy->ref_cnt,
+	__atomic_fetch_sub(&policy->ref_cnt,
 						1, __ATOMIC_RELAXED);
 	memset(fm, 0, sizeof(struct mlx5_flow_meter_info));
 	return 0;
diff --git a/drivers/net/mlx5/mlx5_rx.h b/drivers/net/mlx5/mlx5_rx.h
index 6b42e27..ba62398 100644
--- a/drivers/net/mlx5/mlx5_rx.h
+++ b/drivers/net/mlx5/mlx5_rx.h
@@ -539,7 +539,7 @@ uint16_t mlx5_rx_burst_mprq_vec(void *dpdk_rxq, struct rte_mbuf **pkts,
 		void *buf_addr;
 
 		/* Increment the refcnt of the whole chunk. */
-		__atomic_add_fetch(&buf->refcnt, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_add(&buf->refcnt, 1, __ATOMIC_RELAXED);
 		MLX5_ASSERT(__atomic_load_n(&buf->refcnt,
 			    __ATOMIC_RELAXED) <= strd_n + 1);
 		buf_addr = RTE_PTR_SUB(addr, RTE_PKTMBUF_HEADROOM);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 11/17] net/iavf: use previous value atomic fetch operations
  2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
                   ` (9 preceding siblings ...)
  2023-03-02  0:47 ` [PATCH 10/17] net/mlx5: " Tyler Retzlaff
@ 2023-03-02  0:47 ` Tyler Retzlaff
  2023-03-02  9:28   ` Ruifeng Wang
  2023-03-02  0:47 ` [PATCH 12/17] net/cxgbe: " Tyler Retzlaff
                   ` (7 subsequent siblings)
  18 siblings, 1 reply; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02  0:47 UTC (permalink / raw)
  To: dev; +Cc: Honnappa.Nagarahalli, thomas, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/iavf/iavf_vchnl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 9adaadb..73875d7 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -128,7 +128,7 @@ struct iavf_event_handler {
 	int err = pipe(handler->fd);
 #endif
 	if (err != 0) {
-		__atomic_sub_fetch(&handler->ndev, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_sub(&handler->ndev, 1, __ATOMIC_RELAXED);
 		return -1;
 	}
 
@@ -137,7 +137,7 @@ struct iavf_event_handler {
 
 	if (rte_ctrl_thread_create(&handler->tid, "iavf-event-thread",
 				NULL, iavf_dev_event_handle, NULL)) {
-		__atomic_sub_fetch(&handler->ndev, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_sub(&handler->ndev, 1, __ATOMIC_RELAXED);
 		return -1;
 	}
 
@@ -533,7 +533,7 @@ struct iavf_event_handler {
 				/* read message and it's expected one */
 				if (msg_opc == vf->pend_cmd) {
 					uint32_t cmd_count =
-					__atomic_sub_fetch(&vf->pend_cmd_count,
+					__atomic_fetch_sub(&vf->pend_cmd_count,
 							1, __ATOMIC_RELAXED);
 					if (cmd_count == 0)
 						_notify_cmd(vf, msg_ret);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 12/17] net/cxgbe: use previous value atomic fetch operations
  2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
                   ` (10 preceding siblings ...)
  2023-03-02  0:47 ` [PATCH 11/17] net/iavf: " Tyler Retzlaff
@ 2023-03-02  0:47 ` Tyler Retzlaff
  2023-03-02  0:47 ` [PATCH 13/17] drivers/event: " Tyler Retzlaff
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02  0:47 UTC (permalink / raw)
  To: dev; +Cc: Honnappa.Nagarahalli, thomas, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/cxgbe/clip_tbl.c   |  2 +-
 drivers/net/cxgbe/cxgbe_main.c | 12 ++++++------
 drivers/net/cxgbe/l2t.c        |  4 ++--
 drivers/net/cxgbe/mps_tcam.c   |  2 +-
 drivers/net/cxgbe/smt.c        |  4 ++--
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/cxgbe/clip_tbl.c b/drivers/net/cxgbe/clip_tbl.c
index 072fc74..ce715f2 100644
--- a/drivers/net/cxgbe/clip_tbl.c
+++ b/drivers/net/cxgbe/clip_tbl.c
@@ -129,7 +129,7 @@ static struct clip_entry *t4_clip_alloc(struct rte_eth_dev *dev,
 				ce->type = FILTER_TYPE_IPV4;
 			}
 		} else {
-			__atomic_add_fetch(&ce->refcnt, 1, __ATOMIC_RELAXED);
+			__atomic_fetch_add(&ce->refcnt, 1, __ATOMIC_RELAXED);
 		}
 		t4_os_unlock(&ce->lock);
 	}
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index f8dd833..c479454 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -418,14 +418,14 @@ void cxgbe_remove_tid(struct tid_info *t, unsigned int chan, unsigned int tid,
 
 	if (t->tid_tab[tid]) {
 		t->tid_tab[tid] = NULL;
-		__atomic_sub_fetch(&t->conns_in_use, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_sub(&t->conns_in_use, 1, __ATOMIC_RELAXED);
 		if (t->hash_base && tid >= t->hash_base) {
 			if (family == FILTER_TYPE_IPV4)
-				__atomic_sub_fetch(&t->hash_tids_in_use, 1,
+				__atomic_fetch_sub(&t->hash_tids_in_use, 1,
 						   __ATOMIC_RELAXED);
 		} else {
 			if (family == FILTER_TYPE_IPV4)
-				__atomic_sub_fetch(&t->tids_in_use, 1,
+				__atomic_fetch_sub(&t->tids_in_use, 1,
 						   __ATOMIC_RELAXED);
 		}
 	}
@@ -448,15 +448,15 @@ void cxgbe_insert_tid(struct tid_info *t, void *data, unsigned int tid,
 	t->tid_tab[tid] = data;
 	if (t->hash_base && tid >= t->hash_base) {
 		if (family == FILTER_TYPE_IPV4)
-			__atomic_add_fetch(&t->hash_tids_in_use, 1,
+			__atomic_fetch_add(&t->hash_tids_in_use, 1,
 					   __ATOMIC_RELAXED);
 	} else {
 		if (family == FILTER_TYPE_IPV4)
-			__atomic_add_fetch(&t->tids_in_use, 1,
+			__atomic_fetch_add(&t->tids_in_use, 1,
 					   __ATOMIC_RELAXED);
 	}
 
-	__atomic_add_fetch(&t->conns_in_use, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&t->conns_in_use, 1, __ATOMIC_RELAXED);
 }
 
 /**
diff --git a/drivers/net/cxgbe/l2t.c b/drivers/net/cxgbe/l2t.c
index 66f5789..21f4019 100644
--- a/drivers/net/cxgbe/l2t.c
+++ b/drivers/net/cxgbe/l2t.c
@@ -15,7 +15,7 @@
 void cxgbe_l2t_release(struct l2t_entry *e)
 {
 	if (__atomic_load_n(&e->refcnt, __ATOMIC_RELAXED) != 0)
-		__atomic_sub_fetch(&e->refcnt, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_sub(&e->refcnt, 1, __ATOMIC_RELAXED);
 }
 
 /**
@@ -162,7 +162,7 @@ static struct l2t_entry *t4_l2t_alloc_switching(struct rte_eth_dev *dev,
 				dev_debug(adap, "Failed to write L2T entry: %d",
 					  ret);
 		} else {
-			__atomic_add_fetch(&e->refcnt, 1, __ATOMIC_RELAXED);
+			__atomic_fetch_add(&e->refcnt, 1, __ATOMIC_RELAXED);
 		}
 		t4_os_unlock(&e->lock);
 	}
diff --git a/drivers/net/cxgbe/mps_tcam.c b/drivers/net/cxgbe/mps_tcam.c
index abbf06e..017741f 100644
--- a/drivers/net/cxgbe/mps_tcam.c
+++ b/drivers/net/cxgbe/mps_tcam.c
@@ -76,7 +76,7 @@ int cxgbe_mpstcam_alloc(struct port_info *pi, const u8 *eth_addr,
 	t4_os_write_lock(&mpstcam->lock);
 	entry = cxgbe_mpstcam_lookup(adap->mpstcam, eth_addr, mask);
 	if (entry) {
-		__atomic_add_fetch(&entry->refcnt, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_add(&entry->refcnt, 1, __ATOMIC_RELAXED);
 		t4_os_write_unlock(&mpstcam->lock);
 		return entry->idx;
 	}
diff --git a/drivers/net/cxgbe/smt.c b/drivers/net/cxgbe/smt.c
index 810c757..4e14a73 100644
--- a/drivers/net/cxgbe/smt.c
+++ b/drivers/net/cxgbe/smt.c
@@ -170,7 +170,7 @@ static struct smt_entry *t4_smt_alloc_switching(struct rte_eth_dev *dev,
 			e->state = SMT_STATE_SWITCHING;
 			__atomic_store_n(&e->refcnt, 1, __ATOMIC_RELAXED);
 		} else {
-			__atomic_add_fetch(&e->refcnt, 1, __ATOMIC_RELAXED);
+			__atomic_fetch_add(&e->refcnt, 1, __ATOMIC_RELAXED);
 		}
 		t4_os_unlock(&e->lock);
 	}
@@ -196,7 +196,7 @@ struct smt_entry *cxgbe_smt_alloc_switching(struct rte_eth_dev *dev, u8 *smac)
 void cxgbe_smt_release(struct smt_entry *e)
 {
 	if (__atomic_load_n(&e->refcnt, __ATOMIC_RELAXED) != 0)
-		__atomic_sub_fetch(&e->refcnt, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_sub(&e->refcnt, 1, __ATOMIC_RELAXED);
 }
 
 /**
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 13/17] drivers/event: use previous value atomic fetch operations
  2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
                   ` (11 preceding siblings ...)
  2023-03-02  0:47 ` [PATCH 12/17] net/cxgbe: " Tyler Retzlaff
@ 2023-03-02  0:47 ` Tyler Retzlaff
  2023-03-02  0:47 ` [PATCH 14/17] dma/skeleton: " Tyler Retzlaff
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02  0:47 UTC (permalink / raw)
  To: dev; +Cc: Honnappa.Nagarahalli, thomas, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/event/cnxk/cnxk_eventdev_selftest.c | 12 ++++++------
 drivers/event/cnxk/cnxk_tim_worker.h        |  6 +++---
 drivers/event/dsw/dsw_event.c               |  6 +++---
 drivers/event/octeontx/timvf_worker.h       |  6 +++---
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/event/cnxk/cnxk_eventdev_selftest.c b/drivers/event/cnxk/cnxk_eventdev_selftest.c
index 577c99b..95c0f1b 100644
--- a/drivers/event/cnxk/cnxk_eventdev_selftest.c
+++ b/drivers/event/cnxk/cnxk_eventdev_selftest.c
@@ -554,7 +554,7 @@ typedef int (*validate_event_cb)(uint32_t index, uint8_t port,
 		ret = validate_event(&ev);
 		RTE_TEST_ASSERT_SUCCESS(ret, "Failed to validate event");
 		rte_pktmbuf_free(ev.mbuf);
-		__atomic_sub_fetch(total_events, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_sub(total_events, 1, __ATOMIC_RELAXED);
 	}
 
 	return 0;
@@ -916,7 +916,7 @@ typedef int (*validate_event_cb)(uint32_t index, uint8_t port,
 
 			if (seqn_list_update(seqn) == 0) {
 				rte_pktmbuf_free(ev.mbuf);
-				__atomic_sub_fetch(total_events, 1,
+				__atomic_fetch_sub(total_events, 1,
 						   __ATOMIC_RELAXED);
 			} else {
 				plt_err("Failed to update seqn_list");
@@ -1072,7 +1072,7 @@ typedef int (*validate_event_cb)(uint32_t index, uint8_t port,
 
 			if (seqn_list_update(seqn) == 0) {
 				rte_pktmbuf_free(ev.mbuf);
-				__atomic_sub_fetch(total_events, 1,
+				__atomic_fetch_sub(total_events, 1,
 						   __ATOMIC_RELAXED);
 			} else {
 				plt_err("Failed to update seqn_list");
@@ -1217,7 +1217,7 @@ typedef int (*validate_event_cb)(uint32_t index, uint8_t port,
 
 		if (ev.sub_event_type == MAX_STAGES) { /* last stage */
 			rte_pktmbuf_free(ev.mbuf);
-			__atomic_sub_fetch(total_events, 1, __ATOMIC_RELAXED);
+			__atomic_fetch_sub(total_events, 1, __ATOMIC_RELAXED);
 		} else {
 			ev.event_type = RTE_EVENT_TYPE_CPU;
 			ev.sub_event_type++;
@@ -1293,7 +1293,7 @@ typedef int (*validate_event_cb)(uint32_t index, uint8_t port,
 
 		if (ev.queue_id == nr_queues - 1) { /* last stage */
 			rte_pktmbuf_free(ev.mbuf);
-			__atomic_sub_fetch(total_events, 1, __ATOMIC_RELAXED);
+			__atomic_fetch_sub(total_events, 1, __ATOMIC_RELAXED);
 		} else {
 			ev.event_type = RTE_EVENT_TYPE_CPU;
 			ev.queue_id++;
@@ -1338,7 +1338,7 @@ typedef int (*validate_event_cb)(uint32_t index, uint8_t port,
 
 		if (ev.queue_id == nr_queues - 1) { /* Last stage */
 			rte_pktmbuf_free(ev.mbuf);
-			__atomic_sub_fetch(total_events, 1, __ATOMIC_RELAXED);
+			__atomic_fetch_sub(total_events, 1, __ATOMIC_RELAXED);
 		} else {
 			ev.event_type = RTE_EVENT_TYPE_CPU;
 			ev.queue_id++;
diff --git a/drivers/event/cnxk/cnxk_tim_worker.h b/drivers/event/cnxk/cnxk_tim_worker.h
index a326d55..c087fe5 100644
--- a/drivers/event/cnxk/cnxk_tim_worker.h
+++ b/drivers/event/cnxk/cnxk_tim_worker.h
@@ -102,19 +102,19 @@
 static inline void
 cnxk_tim_bkt_inc_nent(struct cnxk_tim_bkt *bktp)
 {
-	__atomic_add_fetch(&bktp->nb_entry, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&bktp->nb_entry, 1, __ATOMIC_RELAXED);
 }
 
 static inline void
 cnxk_tim_bkt_add_nent_relaxed(struct cnxk_tim_bkt *bktp, uint32_t v)
 {
-	__atomic_add_fetch(&bktp->nb_entry, v, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&bktp->nb_entry, v, __ATOMIC_RELAXED);
 }
 
 static inline void
 cnxk_tim_bkt_add_nent(struct cnxk_tim_bkt *bktp, uint32_t v)
 {
-	__atomic_add_fetch(&bktp->nb_entry, v, __ATOMIC_RELEASE);
+	__atomic_fetch_add(&bktp->nb_entry, v, __ATOMIC_RELEASE);
 }
 
 static inline uint64_t
diff --git a/drivers/event/dsw/dsw_event.c b/drivers/event/dsw/dsw_event.c
index 9932caf..89badca 100644
--- a/drivers/event/dsw/dsw_event.c
+++ b/drivers/event/dsw/dsw_event.c
@@ -50,7 +50,7 @@
 
 	if (unlikely(new_total_on_loan > dsw->max_inflight)) {
 		/* Some other port took the last credits */
-		__atomic_sub_fetch(&dsw->credits_on_loan, acquired_credits,
+		__atomic_fetch_sub(&dsw->credits_on_loan, acquired_credits,
 				   __ATOMIC_RELAXED);
 		return false;
 	}
@@ -77,7 +77,7 @@
 
 		port->inflight_credits = leave_credits;
 
-		__atomic_sub_fetch(&dsw->credits_on_loan, return_credits,
+		__atomic_fetch_sub(&dsw->credits_on_loan, return_credits,
 				   __ATOMIC_RELAXED);
 
 		DSW_LOG_DP_PORT(DEBUG, port->id,
@@ -527,7 +527,7 @@ struct dsw_queue_flow_burst {
 	target_qfs[*targets_len] = *candidate_qf;
 	(*targets_len)++;
 
-	__atomic_add_fetch(&dsw->ports[candidate_port_id].immigration_load,
+	__atomic_fetch_add(&dsw->ports[candidate_port_id].immigration_load,
 			   candidate_flow_load, __ATOMIC_RELAXED);
 
 	return true;
diff --git a/drivers/event/octeontx/timvf_worker.h b/drivers/event/octeontx/timvf_worker.h
index 3f1e77f..ad98ca0 100644
--- a/drivers/event/octeontx/timvf_worker.h
+++ b/drivers/event/octeontx/timvf_worker.h
@@ -108,7 +108,7 @@
 static inline void
 timr_bkt_dec_lock(struct tim_mem_bucket *bktp)
 {
-	__atomic_add_fetch(&bktp->lock, 0xff, __ATOMIC_ACQ_REL);
+	__atomic_fetch_add(&bktp->lock, 0xff, __ATOMIC_ACQ_REL);
 }
 
 static inline uint32_t
@@ -121,13 +121,13 @@
 static inline void
 timr_bkt_inc_nent(struct tim_mem_bucket *bktp)
 {
-	__atomic_add_fetch(&bktp->nb_entry, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&bktp->nb_entry, 1, __ATOMIC_RELAXED);
 }
 
 static inline void
 timr_bkt_add_nent(struct tim_mem_bucket *bktp, uint32_t v)
 {
-	__atomic_add_fetch(&bktp->nb_entry, v, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&bktp->nb_entry, v, __ATOMIC_RELAXED);
 }
 
 static inline uint64_t
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 14/17] dma/skeleton: use previous value atomic fetch operations
  2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
                   ` (12 preceding siblings ...)
  2023-03-02  0:47 ` [PATCH 13/17] drivers/event: " Tyler Retzlaff
@ 2023-03-02  0:47 ` Tyler Retzlaff
  2023-03-02  0:47 ` [PATCH 15/17] drivers/common: " Tyler Retzlaff
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02  0:47 UTC (permalink / raw)
  To: dev; +Cc: Honnappa.Nagarahalli, thomas, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/dma/skeleton/skeleton_dmadev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/skeleton/skeleton_dmadev.c b/drivers/dma/skeleton/skeleton_dmadev.c
index 9b6da65..43e7052 100644
--- a/drivers/dma/skeleton/skeleton_dmadev.c
+++ b/drivers/dma/skeleton/skeleton_dmadev.c
@@ -77,7 +77,7 @@
 
 		hw->zero_req_count = 0;
 		rte_memcpy(desc->dst, desc->src, desc->len);
-		__atomic_add_fetch(&hw->completed_count, 1, __ATOMIC_RELEASE);
+		__atomic_fetch_add(&hw->completed_count, 1, __ATOMIC_RELEASE);
 		(void)rte_ring_enqueue(hw->desc_completed, (void *)desc);
 	}
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 15/17] drivers/common: use previous value atomic fetch operations
  2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
                   ` (13 preceding siblings ...)
  2023-03-02  0:47 ` [PATCH 14/17] dma/skeleton: " Tyler Retzlaff
@ 2023-03-02  0:47 ` Tyler Retzlaff
  2023-03-02  0:47 ` [PATCH 16/17] app/test: " Tyler Retzlaff
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02  0:47 UTC (permalink / raw)
  To: dev; +Cc: Honnappa.Nagarahalli, thomas, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/common/cnxk/roc_nix_inl_dev.c   |  2 +-
 drivers/common/mlx5/mlx5_common_mr.c    |  2 +-
 drivers/common/mlx5/mlx5_common_utils.c | 10 +++++-----
 drivers/common/mlx5/mlx5_malloc.c       | 16 ++++++++--------
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/common/cnxk/roc_nix_inl_dev.c b/drivers/common/cnxk/roc_nix_inl_dev.c
index 6f60961..45d6f62 100644
--- a/drivers/common/cnxk/roc_nix_inl_dev.c
+++ b/drivers/common/cnxk/roc_nix_inl_dev.c
@@ -741,7 +741,7 @@
 			inl_dev->work_cb(&tmp, sa, (port_id << 8) | 0x1);
 			__atomic_store_n(ring_base + tail_l + 1, 0ULL,
 					 __ATOMIC_RELAXED);
-			__atomic_add_fetch((uint32_t *)ring_base, 1,
+			__atomic_fetch_add((uint32_t *)ring_base, 1,
 					   __ATOMIC_ACQ_REL);
 		} else
 			plt_err("Invalid SA");
diff --git a/drivers/common/mlx5/mlx5_common_mr.c b/drivers/common/mlx5/mlx5_common_mr.c
index 0e1d243..9ebe398 100644
--- a/drivers/common/mlx5/mlx5_common_mr.c
+++ b/drivers/common/mlx5/mlx5_common_mr.c
@@ -1650,7 +1650,7 @@ struct mlx5_mempool_get_extmem_data {
 	unsigned int i;
 
 	for (i = 0; i < mpr->mrs_n; i++)
-		__atomic_add_fetch(&mpr->mrs[i].refcnt, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_add(&mpr->mrs[i].refcnt, 1, __ATOMIC_RELAXED);
 }
 
 /**
diff --git a/drivers/common/mlx5/mlx5_common_utils.c b/drivers/common/mlx5/mlx5_common_utils.c
index 58d744b..915a317 100644
--- a/drivers/common/mlx5/mlx5_common_utils.c
+++ b/drivers/common/mlx5/mlx5_common_utils.c
@@ -217,7 +217,7 @@ struct mlx5_list_entry *
 		entry->lcore_idx = (uint32_t)lcore_index;
 		LIST_INSERT_HEAD(&l_inconst->cache[lcore_index]->h,
 				 entry, next);
-		__atomic_add_fetch(&l_inconst->count, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_add(&l_inconst->count, 1, __ATOMIC_RELAXED);
 		DRV_LOG(DEBUG, "MLX5 list %s c%d entry %p new: %u.",
 			l_const->name, lcore_index,
 			(void *)entry, entry->ref_cnt);
@@ -254,7 +254,7 @@ struct mlx5_list_entry *
 	l_inconst->gen_cnt++;
 	rte_rwlock_write_unlock(&l_inconst->lock);
 	LIST_INSERT_HEAD(&l_inconst->cache[lcore_index]->h, local_entry, next);
-	__atomic_add_fetch(&l_inconst->count, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&l_inconst->count, 1, __ATOMIC_RELAXED);
 	DRV_LOG(DEBUG, "mlx5 list %s entry %p new: %u.", l_const->name,
 		(void *)entry, entry->ref_cnt);
 	return local_entry;
@@ -294,11 +294,11 @@ struct mlx5_list_entry *
 		else
 			l_const->cb_remove(l_const->ctx, entry);
 	} else {
-		__atomic_add_fetch(&l_inconst->cache[entry->lcore_idx]->inv_cnt,
+		__atomic_fetch_add(&l_inconst->cache[entry->lcore_idx]->inv_cnt,
 				   1, __ATOMIC_RELAXED);
 	}
 	if (!l_const->lcores_share) {
-		__atomic_sub_fetch(&l_inconst->count, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_sub(&l_inconst->count, 1, __ATOMIC_RELAXED);
 		DRV_LOG(DEBUG, "mlx5 list %s entry %p removed.",
 			l_const->name, (void *)entry);
 		return 0;
@@ -310,7 +310,7 @@ struct mlx5_list_entry *
 		LIST_REMOVE(gentry, next);
 		rte_rwlock_write_unlock(&l_inconst->lock);
 		l_const->cb_remove(l_const->ctx, gentry);
-		__atomic_sub_fetch(&l_inconst->count, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_sub(&l_inconst->count, 1, __ATOMIC_RELAXED);
 		DRV_LOG(DEBUG, "mlx5 list %s entry %p removed.",
 			l_const->name, (void *)gentry);
 		return 0;
diff --git a/drivers/common/mlx5/mlx5_malloc.c b/drivers/common/mlx5/mlx5_malloc.c
index cef3b88..c58c41d 100644
--- a/drivers/common/mlx5/mlx5_malloc.c
+++ b/drivers/common/mlx5/mlx5_malloc.c
@@ -99,7 +99,7 @@ struct mlx5_sys_mem {
 			rte_mem_virt2memseg_list(addr),
 			__ATOMIC_RELAXED);
 #ifdef RTE_LIBRTE_MLX5_DEBUG
-		__atomic_add_fetch(&mlx5_sys_mem.msl_update, 1,
+		__atomic_fetch_add(&mlx5_sys_mem.msl_update, 1,
 				   __ATOMIC_RELAXED);
 #endif
 	}
@@ -126,7 +126,7 @@ struct mlx5_sys_mem {
 		if (!rte_mem_virt2memseg_list(addr))
 			return false;
 #ifdef RTE_LIBRTE_MLX5_DEBUG
-		__atomic_add_fetch(&mlx5_sys_mem.msl_miss, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_add(&mlx5_sys_mem.msl_miss, 1, __ATOMIC_RELAXED);
 #endif
 	}
 	return true;
@@ -185,7 +185,7 @@ struct mlx5_sys_mem {
 		mlx5_mem_update_msl(addr);
 #ifdef RTE_LIBRTE_MLX5_DEBUG
 		if (addr)
-			__atomic_add_fetch(&mlx5_sys_mem.malloc_rte, 1,
+			__atomic_fetch_add(&mlx5_sys_mem.malloc_rte, 1,
 					   __ATOMIC_RELAXED);
 #endif
 		return addr;
@@ -199,7 +199,7 @@ struct mlx5_sys_mem {
 		addr = malloc(size);
 #ifdef RTE_LIBRTE_MLX5_DEBUG
 	if (addr)
-		__atomic_add_fetch(&mlx5_sys_mem.malloc_sys, 1,
+		__atomic_fetch_add(&mlx5_sys_mem.malloc_sys, 1,
 				   __ATOMIC_RELAXED);
 #endif
 	return addr;
@@ -233,7 +233,7 @@ struct mlx5_sys_mem {
 		mlx5_mem_update_msl(new_addr);
 #ifdef RTE_LIBRTE_MLX5_DEBUG
 		if (new_addr)
-			__atomic_add_fetch(&mlx5_sys_mem.realloc_rte, 1,
+			__atomic_fetch_add(&mlx5_sys_mem.realloc_rte, 1,
 					   __ATOMIC_RELAXED);
 #endif
 		return new_addr;
@@ -246,7 +246,7 @@ struct mlx5_sys_mem {
 	new_addr = realloc(addr, size);
 #ifdef RTE_LIBRTE_MLX5_DEBUG
 	if (new_addr)
-		__atomic_add_fetch(&mlx5_sys_mem.realloc_sys, 1,
+		__atomic_fetch_add(&mlx5_sys_mem.realloc_sys, 1,
 				   __ATOMIC_RELAXED);
 #endif
 	return new_addr;
@@ -259,13 +259,13 @@ struct mlx5_sys_mem {
 		return;
 	if (!mlx5_mem_is_rte(addr)) {
 #ifdef RTE_LIBRTE_MLX5_DEBUG
-		__atomic_add_fetch(&mlx5_sys_mem.free_sys, 1,
+		__atomic_fetch_add(&mlx5_sys_mem.free_sys, 1,
 				   __ATOMIC_RELAXED);
 #endif
 		mlx5_os_free(addr);
 	} else {
 #ifdef RTE_LIBRTE_MLX5_DEBUG
-		__atomic_add_fetch(&mlx5_sys_mem.free_rte, 1,
+		__atomic_fetch_add(&mlx5_sys_mem.free_rte, 1,
 				   __ATOMIC_RELAXED);
 #endif
 		rte_free(addr);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 16/17] app/test: use previous value atomic fetch operations
  2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
                   ` (14 preceding siblings ...)
  2023-03-02  0:47 ` [PATCH 15/17] drivers/common: " Tyler Retzlaff
@ 2023-03-02  0:47 ` Tyler Retzlaff
  2023-03-02  0:47 ` [PATCH 17/17] test-eventdev: " Tyler Retzlaff
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02  0:47 UTC (permalink / raw)
  To: dev; +Cc: Honnappa.Nagarahalli, thomas, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 app/test/test_lcores.c        | 2 +-
 app/test/test_service_cores.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/test/test_lcores.c b/app/test/test_lcores.c
index 5b43aa5..2c945b0 100644
--- a/app/test/test_lcores.c
+++ b/app/test/test_lcores.c
@@ -40,7 +40,7 @@ static uint32_t thread_loop(void *arg)
 		t->state = Thread_ERROR;
 	}
 	/* Report register happened to the control thread. */
-	__atomic_add_fetch(t->registered_count, 1, __ATOMIC_RELEASE);
+	__atomic_fetch_add(t->registered_count, 1, __ATOMIC_RELEASE);
 
 	/* Wait for release from the control thread. */
 	while (__atomic_load_n(t->registered_count, __ATOMIC_ACQUIRE) != 0)
diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c
index 637fcd7..9175736 100644
--- a/app/test/test_service_cores.c
+++ b/app/test/test_service_cores.c
@@ -751,12 +751,12 @@ static int32_t dummy_mt_safe_cb(void *args)
 	uint32_t *lock = &params[1];
 
 	while (!*done) {
-		__atomic_add_fetch(lock, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_add(lock, 1, __ATOMIC_RELAXED);
 		rte_delay_us(500);
 		if (__atomic_load_n(lock, __ATOMIC_RELAXED) > 1)
 			/* pass: second core has simultaneously incremented */
 			*done = 1;
-		__atomic_sub_fetch(lock, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_sub(lock, 1, __ATOMIC_RELAXED);
 	}
 
 	return 0;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 17/17] test-eventdev: use previous value atomic fetch operations
  2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
                   ` (15 preceding siblings ...)
  2023-03-02  0:47 ` [PATCH 16/17] app/test: " Tyler Retzlaff
@ 2023-03-02  0:47 ` Tyler Retzlaff
  2023-03-02 14:40 ` [PATCH 00/17] use __atomic operations returning previous value Morten Brørup
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
  18 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02  0:47 UTC (permalink / raw)
  To: dev; +Cc: Honnappa.Nagarahalli, thomas, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 app/test-eventdev/test_order_common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-eventdev/test_order_common.h b/app/test-eventdev/test_order_common.h
index 92781d9..1507265 100644
--- a/app/test-eventdev/test_order_common.h
+++ b/app/test-eventdev/test_order_common.h
@@ -113,7 +113,7 @@ struct test_order {
 	 */
 	expected_flow_seq[flow]++;
 	rte_pktmbuf_free(ev->mbuf);
-	__atomic_sub_fetch(outstand_pkts, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_sub(outstand_pkts, 1, __ATOMIC_RELAXED);
 }
 
 static __rte_always_inline void
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* RE: [PATCH 11/17] net/iavf: use previous value atomic fetch operations
  2023-03-02  0:47 ` [PATCH 11/17] net/iavf: " Tyler Retzlaff
@ 2023-03-02  9:28   ` Ruifeng Wang
  2023-03-02 15:50     ` Tyler Retzlaff
  0 siblings, 1 reply; 47+ messages in thread
From: Ruifeng Wang @ 2023-03-02  9:28 UTC (permalink / raw)
  To: Tyler Retzlaff, dev; +Cc: Honnappa Nagarahalli, thomas, nd

> -----Original Message-----
> From: Tyler Retzlaff <roretzla@linux.microsoft.com>
> Sent: Thursday, March 2, 2023 8:48 AM
> To: dev@dpdk.org
> Cc: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>; thomas@monjalon.net; Tyler
> Retzlaff <roretzla@linux.microsoft.com>
> Subject: [PATCH 11/17] net/iavf: use previous value atomic fetch operations
> 
> Use __atomic_fetch_{add,and,or,sub,xor} instead of __atomic_{add,and,or,sub,xor}_fetch
> when we have no interest in the result of the operation.
> 
> Reduces unnecessary codegen that provided the result of the atomic operation that was not
> used.
> 
> Change brings closer alignment with atomics available in C11 standard and will reduce
> review effort when they are integrated.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  drivers/net/iavf/iavf_vchnl.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index
> 9adaadb..73875d7 100644
> --- a/drivers/net/iavf/iavf_vchnl.c
> +++ b/drivers/net/iavf/iavf_vchnl.c
> @@ -128,7 +128,7 @@ struct iavf_event_handler {
>  	int err = pipe(handler->fd);
>  #endif
>  	if (err != 0) {
> -		__atomic_sub_fetch(&handler->ndev, 1, __ATOMIC_RELAXED);
> +		__atomic_fetch_sub(&handler->ndev, 1, __ATOMIC_RELAXED);
>  		return -1;
>  	}
> 
> @@ -137,7 +137,7 @@ struct iavf_event_handler {
> 
>  	if (rte_ctrl_thread_create(&handler->tid, "iavf-event-thread",
>  				NULL, iavf_dev_event_handle, NULL)) {
> -		__atomic_sub_fetch(&handler->ndev, 1, __ATOMIC_RELAXED);
> +		__atomic_fetch_sub(&handler->ndev, 1, __ATOMIC_RELAXED);
>  		return -1;
>  	}
> 
> @@ -533,7 +533,7 @@ struct iavf_event_handler {
>  				/* read message and it's expected one */
>  				if (msg_opc == vf->pend_cmd) {
>  					uint32_t cmd_count =
> -					__atomic_sub_fetch(&vf->pend_cmd_count,
> +					__atomic_fetch_sub(&vf->pend_cmd_count,

It doesn't apply here. The return value is used.
The rest of the series looks good to me.

>  							1, __ATOMIC_RELAXED);
>  					if (cmd_count == 0)
>  						_notify_cmd(vf, msg_ret);
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 02/17] telemetry: use previous value atomic fetch operations
  2023-03-02  0:47 ` [PATCH 02/17] telemetry: " Tyler Retzlaff
@ 2023-03-02  9:34   ` Bruce Richardson
  0 siblings, 0 replies; 47+ messages in thread
From: Bruce Richardson @ 2023-03-02  9:34 UTC (permalink / raw)
  To: Tyler Retzlaff; +Cc: dev, Honnappa.Nagarahalli, thomas

On Wed, Mar 01, 2023 at 04:47:33PM -0800, Tyler Retzlaff wrote:
> Use __atomic_fetch_{add,and,or,sub,xor} instead of
> __atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
> result of the operation.
> 
> Reduces unnecessary codegen that provided the result of the atomic
> operation that was not used.
> 
> Change brings closer alignment with atomics available in C11 standard
> and will reduce review effort when they are integrated.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 47+ messages in thread

* RE: [PATCH 00/17] use __atomic operations returning previous value
  2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
                   ` (16 preceding siblings ...)
  2023-03-02  0:47 ` [PATCH 17/17] test-eventdev: " Tyler Retzlaff
@ 2023-03-02 14:40 ` Morten Brørup
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
  18 siblings, 0 replies; 47+ messages in thread
From: Morten Brørup @ 2023-03-02 14:40 UTC (permalink / raw)
  To: Tyler Retzlaff, dev; +Cc: Honnappa.Nagarahalli, thomas

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Thursday, 2 March 2023 01.48
> To: dev@dpdk.org
> Cc: Honnappa.Nagarahalli@arm.com; thomas@monjalon.net; Tyler Retzlaff
> Subject: [PATCH 00/17] use __atomic operations returning previous value
> 
> This series replaces uses of __atomic_{add,and,or,sub,xor}_fetch with
> __atomic_fetch_{add,and,or,sub,xor} intrinsics.  The latter omits generation
> of code that is only needed if the returned value is actually used.
> 
> Additionally, this change simplifies adapting dpdk to standard atomics
> planned for 23.07 since __atomic_fetch_xxx can be trivially replaced with
> atomic_fetch_xxx whereas __atomic_xxx_fetch has no standard equivalent.
> 

Series-acked-by: Morten Brørup <mb@smartsharesystems.com>


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 01/17] vhost: use previous value atomic fetch operations
  2023-03-02  0:47 ` [PATCH 01/17] vhost: use previous value atomic fetch operations Tyler Retzlaff
@ 2023-03-02 14:47   ` Maxime Coquelin
  0 siblings, 0 replies; 47+ messages in thread
From: Maxime Coquelin @ 2023-03-02 14:47 UTC (permalink / raw)
  To: Tyler Retzlaff, dev; +Cc: Honnappa.Nagarahalli, thomas



On 3/2/23 01:47, Tyler Retzlaff wrote:
> Use __atomic_fetch_{add,and,or,sub,xor} instead of
> __atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
> result of the operation.
> 
> Reduces unnecessary codegen that provided the result of the atomic
> operation that was not used.
> 
> Change brings closer alignment with atomics available in C11 standard
> and will reduce review effort when they are integrated.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>   lib/vhost/virtio_net.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
> index 51dc3c9..dc49a54 100644
> --- a/lib/vhost/virtio_net.c
> +++ b/lib/vhost/virtio_net.c
> @@ -298,7 +298,7 @@
>   
>   	vhost_log_cache_sync(dev, vq);
>   
> -	__atomic_add_fetch(&vq->used->idx, vq->shadow_used_idx,
> +	__atomic_fetch_add(&vq->used->idx, vq->shadow_used_idx,
>   			   __ATOMIC_RELEASE);
>   	vq->shadow_used_idx = 0;
>   	vhost_log_used_vring(dev, vq, offsetof(struct vring_used, idx),
> @@ -2311,7 +2311,7 @@
>   			vhost_vring_call_packed(dev, vq);
>   		} else {
>   			write_back_completed_descs_split(vq, n_descs);
> -			__atomic_add_fetch(&vq->used->idx, n_descs, __ATOMIC_RELEASE);
> +			__atomic_fetch_add(&vq->used->idx, n_descs, __ATOMIC_RELEASE);
>   			vhost_vring_call_split(dev, vq);
>   		}
>   	} else {
> @@ -3683,7 +3683,7 @@
>   		vhost_vring_call_packed(dev, vq);
>   	} else {
>   		write_back_completed_descs_split(vq, nr_cpl_pkts);
> -		__atomic_add_fetch(&vq->used->idx, nr_cpl_pkts, __ATOMIC_RELEASE);
> +		__atomic_fetch_add(&vq->used->idx, nr_cpl_pkts, __ATOMIC_RELEASE);
>   		vhost_vring_call_split(dev, vq);
>   	}
>   	vq->async->pkts_inflight_n -= nr_cpl_pkts;

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 07/17] examples/vhost: use previous value atomic fetch operations
  2023-03-02  0:47 ` [PATCH 07/17] examples/vhost: " Tyler Retzlaff
@ 2023-03-02 14:47   ` Maxime Coquelin
  0 siblings, 0 replies; 47+ messages in thread
From: Maxime Coquelin @ 2023-03-02 14:47 UTC (permalink / raw)
  To: Tyler Retzlaff, dev; +Cc: Honnappa.Nagarahalli, thomas



On 3/2/23 01:47, Tyler Retzlaff wrote:
> Use __atomic_fetch_{add,and,or,sub,xor} instead of
> __atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
> result of the operation.
> 
> Reduces unnecessary codegen that provided the result of the atomic
> operation that was not used.
> 
> Change brings closer alignment with atomics available in C11 standard
> and will reduce review effort when they are integrated.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>   examples/vhost/main.c       | 12 ++++++------
>   examples/vhost/virtio_net.c |  4 ++--
>   2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/examples/vhost/main.c b/examples/vhost/main.c
> index 42e53a0..bfe466f 100644
> --- a/examples/vhost/main.c
> +++ b/examples/vhost/main.c
> @@ -1048,9 +1048,9 @@ static unsigned check_ports_num(unsigned nb_ports)
>   	}
>   
>   	if (enable_stats) {
> -		__atomic_add_fetch(&dst_vdev->stats.rx_total_atomic, 1,
> +		__atomic_fetch_add(&dst_vdev->stats.rx_total_atomic, 1,
>   				__ATOMIC_SEQ_CST);
> -		__atomic_add_fetch(&dst_vdev->stats.rx_atomic, ret,
> +		__atomic_fetch_add(&dst_vdev->stats.rx_atomic, ret,
>   				__ATOMIC_SEQ_CST);
>   		src_vdev->stats.tx_total++;
>   		src_vdev->stats.tx += ret;
> @@ -1068,9 +1068,9 @@ static unsigned check_ports_num(unsigned nb_ports)
>   	ret = vdev_queue_ops[vdev->vid].enqueue_pkt_burst(vdev, VIRTIO_RXQ, m, nr_xmit);
>   
>   	if (enable_stats) {
> -		__atomic_add_fetch(&vdev->stats.rx_total_atomic, nr_xmit,
> +		__atomic_fetch_add(&vdev->stats.rx_total_atomic, nr_xmit,
>   				__ATOMIC_SEQ_CST);
> -		__atomic_add_fetch(&vdev->stats.rx_atomic, ret,
> +		__atomic_fetch_add(&vdev->stats.rx_atomic, ret,
>   				__ATOMIC_SEQ_CST);
>   	}
>   
> @@ -1400,9 +1400,9 @@ static void virtio_tx_offload(struct rte_mbuf *m)
>   	}
>   
>   	if (enable_stats) {
> -		__atomic_add_fetch(&vdev->stats.rx_total_atomic, rx_count,
> +		__atomic_fetch_add(&vdev->stats.rx_total_atomic, rx_count,
>   				__ATOMIC_SEQ_CST);
> -		__atomic_add_fetch(&vdev->stats.rx_atomic, enqueue_count,
> +		__atomic_fetch_add(&vdev->stats.rx_atomic, enqueue_count,
>   				__ATOMIC_SEQ_CST);
>   	}
>   
> diff --git a/examples/vhost/virtio_net.c b/examples/vhost/virtio_net.c
> index 1d4737f..514c8e0 100644
> --- a/examples/vhost/virtio_net.c
> +++ b/examples/vhost/virtio_net.c
> @@ -231,7 +231,7 @@
>   			rte_prefetch0(&vr->desc[desc_indexes[i+1]]);
>   	}
>   
> -	__atomic_add_fetch(&vr->used->idx, count, __ATOMIC_RELEASE);
> +	__atomic_fetch_add(&vr->used->idx, count, __ATOMIC_RELEASE);
>   	queue->last_used_idx += count;
>   
>   	rte_vhost_vring_call(dev->vid, queue_id);
> @@ -442,7 +442,7 @@
>   	queue->last_avail_idx += i;
>   	queue->last_used_idx += i;
>   
> -	__atomic_add_fetch(&vr->used->idx, i, __ATOMIC_ACQ_REL);
> +	__atomic_fetch_add(&vr->used->idx, i, __ATOMIC_ACQ_REL);
>   
>   	rte_vhost_vring_call(dev->vid, queue_id);
>   

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 08/17] net/virtio: use previous value atomic fetch operations
  2023-03-02  0:47 ` [PATCH 08/17] net/virtio: " Tyler Retzlaff
@ 2023-03-02 14:48   ` Maxime Coquelin
  0 siblings, 0 replies; 47+ messages in thread
From: Maxime Coquelin @ 2023-03-02 14:48 UTC (permalink / raw)
  To: Tyler Retzlaff, dev; +Cc: Honnappa.Nagarahalli, thomas



On 3/2/23 01:47, Tyler Retzlaff wrote:
> Use __atomic_fetch_{add,and,or,sub,xor} instead of
> __atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
> result of the operation.
> 
> Reduces unnecessary codegen that provided the result of the atomic
> operation that was not used.
> 
> Change brings closer alignment with atomics available in C11 standard
> and will reduce review effort when they are integrated.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>   drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> index f46a131..2b4607a 100644
> --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
> +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> @@ -1025,7 +1025,7 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)
>   		uep->id = desc_idx;
>   		uep->len = n_descs;
>   
> -		__atomic_add_fetch(&vring->used->idx, 1, __ATOMIC_RELAXED);
> +		__atomic_fetch_add(&vring->used->idx, 1, __ATOMIC_RELAXED);
>   	}
>   }
>   

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 11/17] net/iavf: use previous value atomic fetch operations
  2023-03-02  9:28   ` Ruifeng Wang
@ 2023-03-02 15:50     ` Tyler Retzlaff
  0 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 15:50 UTC (permalink / raw)
  To: Ruifeng Wang; +Cc: dev, Honnappa Nagarahalli, thomas, nd

On Thu, Mar 02, 2023 at 09:28:09AM +0000, Ruifeng Wang wrote:
> > -----Original Message-----
> > From: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > Sent: Thursday, March 2, 2023 8:48 AM
> > To: dev@dpdk.org
> > Cc: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>; thomas@monjalon.net; Tyler
> > Retzlaff <roretzla@linux.microsoft.com>
> > Subject: [PATCH 11/17] net/iavf: use previous value atomic fetch operations
> > 
> > Use __atomic_fetch_{add,and,or,sub,xor} instead of __atomic_{add,and,or,sub,xor}_fetch
> > when we have no interest in the result of the operation.
> > 
> > Reduces unnecessary codegen that provided the result of the atomic operation that was not
> > used.
> > 
> > Change brings closer alignment with atomics available in C11 standard and will reduce
> > review effort when they are integrated.
> > 
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> >  drivers/net/iavf/iavf_vchnl.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index
> > 9adaadb..73875d7 100644
> > --- a/drivers/net/iavf/iavf_vchnl.c
> > +++ b/drivers/net/iavf/iavf_vchnl.c
> > @@ -128,7 +128,7 @@ struct iavf_event_handler {
> >  	int err = pipe(handler->fd);
> >  #endif
> >  	if (err != 0) {
> > -		__atomic_sub_fetch(&handler->ndev, 1, __ATOMIC_RELAXED);
> > +		__atomic_fetch_sub(&handler->ndev, 1, __ATOMIC_RELAXED);
> >  		return -1;
> >  	}
> > 
> > @@ -137,7 +137,7 @@ struct iavf_event_handler {
> > 
> >  	if (rte_ctrl_thread_create(&handler->tid, "iavf-event-thread",
> >  				NULL, iavf_dev_event_handle, NULL)) {
> > -		__atomic_sub_fetch(&handler->ndev, 1, __ATOMIC_RELAXED);
> > +		__atomic_fetch_sub(&handler->ndev, 1, __ATOMIC_RELAXED);
> >  		return -1;
> >  	}
> > 
> > @@ -533,7 +533,7 @@ struct iavf_event_handler {
> >  				/* read message and it's expected one */
> >  				if (msg_opc == vf->pend_cmd) {
> >  					uint32_t cmd_count =
> > -					__atomic_sub_fetch(&vf->pend_cmd_count,
> > +					__atomic_fetch_sub(&vf->pend_cmd_count,
> 
> It doesn't apply here. The return value is used.
> The rest of the series looks good to me.

oh, i was blind to the line wrapping. definitely not correct.

thanks for catching this, will submit v2 with it reverted.

> 
> >  							1, __ATOMIC_RELAXED);
> >  					if (cmd_count == 0)
> >  						_notify_cmd(vf, msg_ret);
> > --
> > 1.8.3.1

^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 00/17] use __atomic operations returning previous value
  2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
                   ` (17 preceding siblings ...)
  2023-03-02 14:40 ` [PATCH 00/17] use __atomic operations returning previous value Morten Brørup
@ 2023-03-02 16:18 ` Tyler Retzlaff
  2023-03-02 16:18   ` [PATCH v2 01/17] vhost: use previous value atomic fetch operations Tyler Retzlaff
                     ` (19 more replies)
  18 siblings, 20 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 16:18 UTC (permalink / raw)
  To: dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin, Tyler Retzlaff

This series replaces uses of __atomic_{add,and,or,sub,xor}_fetch with
__atomic_fetch_{add,and,or,sub,xor} intrinsics.  The latter omits generation
of code that is only needed if the returned value is actually used.

Additionally, this change simplifies adapting dpdk to standard atomics
planned for 23.07 since __atomic_fetch_xxx can be trivially replaced with
atomic_fetch_xxx whereas __atomic_xxx_fetch has no standard equivalent.


v2:
  net/iavf patch had one incorrect change to __atomic_fetch_sub
  from __atomic_sub_fetch the new value was assigned to a variable
  on the previous line so revert the change from the patch.

Series-acked-by: Morten Brørup <mb@smartsharesystems.com>

Tyler Retzlaff (17):
  vhost: use previous value atomic fetch operations
  telemetry: use previous value atomic fetch operations
  stack: use previous value atomic fetch operations
  eal: use previous value atomic fetch operations
  distributor: use previous value atomic fetch operations
  bbdev: use previous value atomic fetch operations
  examples/vhost: use previous value atomic fetch operations
  net/virtio: use previous value atomic fetch operations
  net/octeontx: use previous value atomic fetch operations
  net/mlx5: use previous value atomic fetch operations
  net/iavf: use previous value atomic fetch operations
  net/cxgbe: use previous value atomic fetch operations
  drivers/event: use previous value atomic fetch operations
  dma/skeleton: use previous value atomic fetch operations
  drivers/common: use previous value atomic fetch operations
  app/test: use previous value atomic fetch operations
  test-eventdev: use previous value atomic fetch operations

 app/test-eventdev/test_order_common.h            |  2 +-
 app/test/test_lcores.c                           |  2 +-
 app/test/test_service_cores.c                    |  4 ++--
 drivers/common/cnxk/roc_nix_inl_dev.c            |  2 +-
 drivers/common/mlx5/mlx5_common_mr.c             |  2 +-
 drivers/common/mlx5/mlx5_common_utils.c          | 10 +++++-----
 drivers/common/mlx5/mlx5_malloc.c                | 16 ++++++++--------
 drivers/dma/skeleton/skeleton_dmadev.c           |  2 +-
 drivers/event/cnxk/cnxk_eventdev_selftest.c      | 12 ++++++------
 drivers/event/cnxk/cnxk_tim_worker.h             |  6 +++---
 drivers/event/dsw/dsw_event.c                    |  6 +++---
 drivers/event/octeontx/timvf_worker.h            |  6 +++---
 drivers/net/cxgbe/clip_tbl.c                     |  2 +-
 drivers/net/cxgbe/cxgbe_main.c                   | 12 ++++++------
 drivers/net/cxgbe/l2t.c                          |  4 ++--
 drivers/net/cxgbe/mps_tcam.c                     |  2 +-
 drivers/net/cxgbe/smt.c                          |  4 ++--
 drivers/net/iavf/iavf_vchnl.c                    |  4 ++--
 drivers/net/mlx5/linux/mlx5_verbs.c              |  2 +-
 drivers/net/mlx5/mlx5_flow.c                     |  6 +++---
 drivers/net/mlx5/mlx5_flow_dv.c                  |  4 ++--
 drivers/net/mlx5/mlx5_flow_flex.c                |  6 +++---
 drivers/net/mlx5/mlx5_flow_hw.c                  | 10 +++++-----
 drivers/net/mlx5/mlx5_flow_meter.c               | 20 ++++++++++----------
 drivers/net/mlx5/mlx5_rx.h                       |  2 +-
 drivers/net/octeontx/octeontx_ethdev.c           |  2 +-
 drivers/net/virtio/virtio_user/virtio_user_dev.c |  2 +-
 examples/vhost/main.c                            | 12 ++++++------
 examples/vhost/virtio_net.c                      |  4 ++--
 lib/bbdev/rte_bbdev.c                            |  2 +-
 lib/distributor/rte_distributor.c                |  2 +-
 lib/eal/common/eal_common_trace.c                |  8 ++++----
 lib/eal/common/rte_service.c                     |  8 ++++----
 lib/eal/ppc/include/rte_atomic.h                 | 16 ++++++++--------
 lib/stack/rte_stack_lf_c11.h                     |  2 +-
 lib/telemetry/telemetry.c                        |  6 +++---
 lib/vhost/virtio_net.c                           |  6 +++---
 37 files changed, 109 insertions(+), 109 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 01/17] vhost: use previous value atomic fetch operations
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
@ 2023-03-02 16:18   ` Tyler Retzlaff
  2023-03-02 16:18   ` [PATCH v2 02/17] telemetry: " Tyler Retzlaff
                     ` (18 subsequent siblings)
  19 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 16:18 UTC (permalink / raw)
  To: dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/vhost/virtio_net.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index 51dc3c9..dc49a54 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -298,7 +298,7 @@
 
 	vhost_log_cache_sync(dev, vq);
 
-	__atomic_add_fetch(&vq->used->idx, vq->shadow_used_idx,
+	__atomic_fetch_add(&vq->used->idx, vq->shadow_used_idx,
 			   __ATOMIC_RELEASE);
 	vq->shadow_used_idx = 0;
 	vhost_log_used_vring(dev, vq, offsetof(struct vring_used, idx),
@@ -2311,7 +2311,7 @@
 			vhost_vring_call_packed(dev, vq);
 		} else {
 			write_back_completed_descs_split(vq, n_descs);
-			__atomic_add_fetch(&vq->used->idx, n_descs, __ATOMIC_RELEASE);
+			__atomic_fetch_add(&vq->used->idx, n_descs, __ATOMIC_RELEASE);
 			vhost_vring_call_split(dev, vq);
 		}
 	} else {
@@ -3683,7 +3683,7 @@
 		vhost_vring_call_packed(dev, vq);
 	} else {
 		write_back_completed_descs_split(vq, nr_cpl_pkts);
-		__atomic_add_fetch(&vq->used->idx, nr_cpl_pkts, __ATOMIC_RELEASE);
+		__atomic_fetch_add(&vq->used->idx, nr_cpl_pkts, __ATOMIC_RELEASE);
 		vhost_vring_call_split(dev, vq);
 	}
 	vq->async->pkts_inflight_n -= nr_cpl_pkts;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 02/17] telemetry: use previous value atomic fetch operations
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
  2023-03-02 16:18   ` [PATCH v2 01/17] vhost: use previous value atomic fetch operations Tyler Retzlaff
@ 2023-03-02 16:18   ` Tyler Retzlaff
  2023-03-02 16:18   ` [PATCH v2 03/17] stack: " Tyler Retzlaff
                     ` (17 subsequent siblings)
  19 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 16:18 UTC (permalink / raw)
  To: dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/telemetry/telemetry.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
index 7bceadc..deba7f3 100644
--- a/lib/telemetry/telemetry.c
+++ b/lib/telemetry/telemetry.c
@@ -391,7 +391,7 @@ struct socket {
 		bytes = read(s, buffer, sizeof(buffer) - 1);
 	}
 	close(s);
-	__atomic_sub_fetch(&v2_clients, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_sub(&v2_clients, 1, __ATOMIC_RELAXED);
 	return NULL;
 }
 
@@ -414,7 +414,7 @@ struct socket {
 				close(s_accepted);
 				continue;
 			}
-			__atomic_add_fetch(s->num_clients, 1,
+			__atomic_fetch_add(s->num_clients, 1,
 					__ATOMIC_RELAXED);
 		}
 		rc = pthread_create(&th, NULL, s->fn,
@@ -424,7 +424,7 @@ struct socket {
 				 strerror(rc));
 			close(s_accepted);
 			if (s->num_clients != NULL)
-				__atomic_sub_fetch(s->num_clients, 1,
+				__atomic_fetch_sub(s->num_clients, 1,
 						   __ATOMIC_RELAXED);
 			continue;
 		}
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 03/17] stack: use previous value atomic fetch operations
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
  2023-03-02 16:18   ` [PATCH v2 01/17] vhost: use previous value atomic fetch operations Tyler Retzlaff
  2023-03-02 16:18   ` [PATCH v2 02/17] telemetry: " Tyler Retzlaff
@ 2023-03-02 16:18   ` Tyler Retzlaff
  2023-03-02 16:18   ` [PATCH v2 04/17] eal: " Tyler Retzlaff
                     ` (16 subsequent siblings)
  19 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 16:18 UTC (permalink / raw)
  To: dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/stack/rte_stack_lf_c11.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/stack/rte_stack_lf_c11.h b/lib/stack/rte_stack_lf_c11.h
index 8403196..687a6f6 100644
--- a/lib/stack/rte_stack_lf_c11.h
+++ b/lib/stack/rte_stack_lf_c11.h
@@ -66,7 +66,7 @@
 	/* Ensure the stack modifications are not reordered with respect
 	 * to the LIFO len update.
 	 */
-	__atomic_add_fetch(&list->len, num, __ATOMIC_RELEASE);
+	__atomic_fetch_add(&list->len, num, __ATOMIC_RELEASE);
 }
 
 static __rte_always_inline struct rte_stack_lf_elem *
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 04/17] eal: use previous value atomic fetch operations
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
                     ` (2 preceding siblings ...)
  2023-03-02 16:18   ` [PATCH v2 03/17] stack: " Tyler Retzlaff
@ 2023-03-02 16:18   ` Tyler Retzlaff
  2023-03-02 16:18   ` [PATCH v2 05/17] distributor: " Tyler Retzlaff
                     ` (15 subsequent siblings)
  19 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 16:18 UTC (permalink / raw)
  To: dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/eal/common/eal_common_trace.c |  8 ++++----
 lib/eal/common/rte_service.c      |  8 ++++----
 lib/eal/ppc/include/rte_atomic.h  | 16 ++++++++--------
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/lib/eal/common/eal_common_trace.c b/lib/eal/common/eal_common_trace.c
index 75162b7..cb980af 100644
--- a/lib/eal/common/eal_common_trace.c
+++ b/lib/eal/common/eal_common_trace.c
@@ -103,10 +103,10 @@ struct trace_point_head *
 trace_mode_set(rte_trace_point_t *t, enum rte_trace_mode mode)
 {
 	if (mode == RTE_TRACE_MODE_OVERWRITE)
-		__atomic_and_fetch(t, ~__RTE_TRACE_FIELD_ENABLE_DISCARD,
+		__atomic_fetch_and(t, ~__RTE_TRACE_FIELD_ENABLE_DISCARD,
 			__ATOMIC_RELEASE);
 	else
-		__atomic_or_fetch(t, __RTE_TRACE_FIELD_ENABLE_DISCARD,
+		__atomic_fetch_or(t, __RTE_TRACE_FIELD_ENABLE_DISCARD,
 			__ATOMIC_RELEASE);
 }
 
@@ -155,7 +155,7 @@ rte_trace_mode rte_trace_mode_get(void)
 
 	prev = __atomic_fetch_or(t, __RTE_TRACE_FIELD_ENABLE_MASK, __ATOMIC_RELEASE);
 	if ((prev & __RTE_TRACE_FIELD_ENABLE_MASK) == 0)
-		__atomic_add_fetch(&trace.status, 1, __ATOMIC_RELEASE);
+		__atomic_fetch_add(&trace.status, 1, __ATOMIC_RELEASE);
 	return 0;
 }
 
@@ -169,7 +169,7 @@ rte_trace_mode rte_trace_mode_get(void)
 
 	prev = __atomic_fetch_and(t, ~__RTE_TRACE_FIELD_ENABLE_MASK, __ATOMIC_RELEASE);
 	if ((prev & __RTE_TRACE_FIELD_ENABLE_MASK) != 0)
-		__atomic_sub_fetch(&trace.status, 1, __ATOMIC_RELEASE);
+		__atomic_fetch_sub(&trace.status, 1, __ATOMIC_RELEASE);
 	return 0;
 }
 
diff --git a/lib/eal/common/rte_service.c b/lib/eal/common/rte_service.c
index 42ca1d0..7ab48f2 100644
--- a/lib/eal/common/rte_service.c
+++ b/lib/eal/common/rte_service.c
@@ -464,11 +464,11 @@ struct core_state {
 	/* Increment num_mapped_cores to reflect that this core is
 	 * now mapped capable of running the service.
 	 */
-	__atomic_add_fetch(&s->num_mapped_cores, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&s->num_mapped_cores, 1, __ATOMIC_RELAXED);
 
 	int ret = service_run(id, cs, UINT64_MAX, s, serialize_mt_unsafe);
 
-	__atomic_sub_fetch(&s->num_mapped_cores, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_sub(&s->num_mapped_cores, 1, __ATOMIC_RELAXED);
 
 	return ret;
 }
@@ -638,12 +638,12 @@ struct core_state {
 
 		if (*set && !lcore_mapped) {
 			lcore_states[lcore].service_mask |= sid_mask;
-			__atomic_add_fetch(&rte_services[sid].num_mapped_cores,
+			__atomic_fetch_add(&rte_services[sid].num_mapped_cores,
 				1, __ATOMIC_RELAXED);
 		}
 		if (!*set && lcore_mapped) {
 			lcore_states[lcore].service_mask &= ~(sid_mask);
-			__atomic_sub_fetch(&rte_services[sid].num_mapped_cores,
+			__atomic_fetch_sub(&rte_services[sid].num_mapped_cores,
 				1, __ATOMIC_RELAXED);
 		}
 	}
diff --git a/lib/eal/ppc/include/rte_atomic.h b/lib/eal/ppc/include/rte_atomic.h
index 663b4d3..2ab735b 100644
--- a/lib/eal/ppc/include/rte_atomic.h
+++ b/lib/eal/ppc/include/rte_atomic.h
@@ -60,13 +60,13 @@ static inline int rte_atomic16_test_and_set(rte_atomic16_t *v)
 static inline void
 rte_atomic16_inc(rte_atomic16_t *v)
 {
-	__atomic_add_fetch(&v->cnt, 1, __ATOMIC_ACQUIRE);
+	__atomic_fetch_add(&v->cnt, 1, __ATOMIC_ACQUIRE);
 }
 
 static inline void
 rte_atomic16_dec(rte_atomic16_t *v)
 {
-	__atomic_sub_fetch(&v->cnt, 1, __ATOMIC_ACQUIRE);
+	__atomic_fetch_sub(&v->cnt, 1, __ATOMIC_ACQUIRE);
 }
 
 static inline int rte_atomic16_inc_and_test(rte_atomic16_t *v)
@@ -102,13 +102,13 @@ static inline int rte_atomic32_test_and_set(rte_atomic32_t *v)
 static inline void
 rte_atomic32_inc(rte_atomic32_t *v)
 {
-	__atomic_add_fetch(&v->cnt, 1, __ATOMIC_ACQUIRE);
+	__atomic_fetch_add(&v->cnt, 1, __ATOMIC_ACQUIRE);
 }
 
 static inline void
 rte_atomic32_dec(rte_atomic32_t *v)
 {
-	__atomic_sub_fetch(&v->cnt, 1, __ATOMIC_ACQUIRE);
+	__atomic_fetch_sub(&v->cnt, 1, __ATOMIC_ACQUIRE);
 }
 
 static inline int rte_atomic32_inc_and_test(rte_atomic32_t *v)
@@ -157,25 +157,25 @@ static inline int rte_atomic32_dec_and_test(rte_atomic32_t *v)
 static inline void
 rte_atomic64_add(rte_atomic64_t *v, int64_t inc)
 {
-	__atomic_add_fetch(&v->cnt, inc, __ATOMIC_ACQUIRE);
+	__atomic_fetch_add(&v->cnt, inc, __ATOMIC_ACQUIRE);
 }
 
 static inline void
 rte_atomic64_sub(rte_atomic64_t *v, int64_t dec)
 {
-	__atomic_sub_fetch(&v->cnt, dec, __ATOMIC_ACQUIRE);
+	__atomic_fetch_sub(&v->cnt, dec, __ATOMIC_ACQUIRE);
 }
 
 static inline void
 rte_atomic64_inc(rte_atomic64_t *v)
 {
-	__atomic_add_fetch(&v->cnt, 1, __ATOMIC_ACQUIRE);
+	__atomic_fetch_add(&v->cnt, 1, __ATOMIC_ACQUIRE);
 }
 
 static inline void
 rte_atomic64_dec(rte_atomic64_t *v)
 {
-	__atomic_sub_fetch(&v->cnt, 1, __ATOMIC_ACQUIRE);
+	__atomic_fetch_sub(&v->cnt, 1, __ATOMIC_ACQUIRE);
 }
 
 static inline int64_t
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 05/17] distributor: use previous value atomic fetch operations
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
                     ` (3 preceding siblings ...)
  2023-03-02 16:18   ` [PATCH v2 04/17] eal: " Tyler Retzlaff
@ 2023-03-02 16:18   ` Tyler Retzlaff
  2023-03-02 16:18   ` [PATCH v2 06/17] bbdev: " Tyler Retzlaff
                     ` (14 subsequent siblings)
  19 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 16:18 UTC (permalink / raw)
  To: dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/distributor/rte_distributor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/distributor/rte_distributor.c b/lib/distributor/rte_distributor.c
index 3969b2e..68840ce 100644
--- a/lib/distributor/rte_distributor.c
+++ b/lib/distributor/rte_distributor.c
@@ -200,7 +200,7 @@
 	 * we won't read any mbufs from there even if GET_BUF is set.
 	 * This allows distributor to retrieve in-flight already sent packets.
 	 */
-	__atomic_or_fetch(&(buf->bufptr64[0]), RTE_DISTRIB_RETURN_BUF,
+	__atomic_fetch_or(&(buf->bufptr64[0]), RTE_DISTRIB_RETURN_BUF,
 		__ATOMIC_ACQ_REL);
 
 	/* set the RETURN_BUF on retptr64 even if we got no returns.
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 06/17] bbdev: use previous value atomic fetch operations
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
                     ` (4 preceding siblings ...)
  2023-03-02 16:18   ` [PATCH v2 05/17] distributor: " Tyler Retzlaff
@ 2023-03-02 16:18   ` Tyler Retzlaff
  2023-03-02 16:18   ` [PATCH v2 07/17] examples/vhost: " Tyler Retzlaff
                     ` (13 subsequent siblings)
  19 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 16:18 UTC (permalink / raw)
  To: dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/bbdev/rte_bbdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c
index 1521cdb..69e099d 100644
--- a/lib/bbdev/rte_bbdev.c
+++ b/lib/bbdev/rte_bbdev.c
@@ -208,7 +208,7 @@ struct rte_bbdev *
 		return NULL;
 	}
 
-	__atomic_add_fetch(&bbdev->data->process_cnt, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&bbdev->data->process_cnt, 1, __ATOMIC_RELAXED);
 	bbdev->data->dev_id = dev_id;
 	bbdev->state = RTE_BBDEV_INITIALIZED;
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 07/17] examples/vhost: use previous value atomic fetch operations
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
                     ` (5 preceding siblings ...)
  2023-03-02 16:18   ` [PATCH v2 06/17] bbdev: " Tyler Retzlaff
@ 2023-03-02 16:18   ` Tyler Retzlaff
  2023-03-02 16:18   ` [PATCH v2 08/17] net/virtio: " Tyler Retzlaff
                     ` (12 subsequent siblings)
  19 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 16:18 UTC (permalink / raw)
  To: dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 examples/vhost/main.c       | 12 ++++++------
 examples/vhost/virtio_net.c |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 42e53a0..bfe466f 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -1048,9 +1048,9 @@ static unsigned check_ports_num(unsigned nb_ports)
 	}
 
 	if (enable_stats) {
-		__atomic_add_fetch(&dst_vdev->stats.rx_total_atomic, 1,
+		__atomic_fetch_add(&dst_vdev->stats.rx_total_atomic, 1,
 				__ATOMIC_SEQ_CST);
-		__atomic_add_fetch(&dst_vdev->stats.rx_atomic, ret,
+		__atomic_fetch_add(&dst_vdev->stats.rx_atomic, ret,
 				__ATOMIC_SEQ_CST);
 		src_vdev->stats.tx_total++;
 		src_vdev->stats.tx += ret;
@@ -1068,9 +1068,9 @@ static unsigned check_ports_num(unsigned nb_ports)
 	ret = vdev_queue_ops[vdev->vid].enqueue_pkt_burst(vdev, VIRTIO_RXQ, m, nr_xmit);
 
 	if (enable_stats) {
-		__atomic_add_fetch(&vdev->stats.rx_total_atomic, nr_xmit,
+		__atomic_fetch_add(&vdev->stats.rx_total_atomic, nr_xmit,
 				__ATOMIC_SEQ_CST);
-		__atomic_add_fetch(&vdev->stats.rx_atomic, ret,
+		__atomic_fetch_add(&vdev->stats.rx_atomic, ret,
 				__ATOMIC_SEQ_CST);
 	}
 
@@ -1400,9 +1400,9 @@ static void virtio_tx_offload(struct rte_mbuf *m)
 	}
 
 	if (enable_stats) {
-		__atomic_add_fetch(&vdev->stats.rx_total_atomic, rx_count,
+		__atomic_fetch_add(&vdev->stats.rx_total_atomic, rx_count,
 				__ATOMIC_SEQ_CST);
-		__atomic_add_fetch(&vdev->stats.rx_atomic, enqueue_count,
+		__atomic_fetch_add(&vdev->stats.rx_atomic, enqueue_count,
 				__ATOMIC_SEQ_CST);
 	}
 
diff --git a/examples/vhost/virtio_net.c b/examples/vhost/virtio_net.c
index 1d4737f..514c8e0 100644
--- a/examples/vhost/virtio_net.c
+++ b/examples/vhost/virtio_net.c
@@ -231,7 +231,7 @@
 			rte_prefetch0(&vr->desc[desc_indexes[i+1]]);
 	}
 
-	__atomic_add_fetch(&vr->used->idx, count, __ATOMIC_RELEASE);
+	__atomic_fetch_add(&vr->used->idx, count, __ATOMIC_RELEASE);
 	queue->last_used_idx += count;
 
 	rte_vhost_vring_call(dev->vid, queue_id);
@@ -442,7 +442,7 @@
 	queue->last_avail_idx += i;
 	queue->last_used_idx += i;
 
-	__atomic_add_fetch(&vr->used->idx, i, __ATOMIC_ACQ_REL);
+	__atomic_fetch_add(&vr->used->idx, i, __ATOMIC_ACQ_REL);
 
 	rte_vhost_vring_call(dev->vid, queue_id);
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 08/17] net/virtio: use previous value atomic fetch operations
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
                     ` (6 preceding siblings ...)
  2023-03-02 16:18   ` [PATCH v2 07/17] examples/vhost: " Tyler Retzlaff
@ 2023-03-02 16:18   ` Tyler Retzlaff
  2023-03-02 16:18   ` [PATCH v2 09/17] net/octeontx: " Tyler Retzlaff
                     ` (11 subsequent siblings)
  19 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 16:18 UTC (permalink / raw)
  To: dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index f46a131..2b4607a 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -1025,7 +1025,7 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)
 		uep->id = desc_idx;
 		uep->len = n_descs;
 
-		__atomic_add_fetch(&vring->used->idx, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_add(&vring->used->idx, 1, __ATOMIC_RELAXED);
 	}
 }
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 09/17] net/octeontx: use previous value atomic fetch operations
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
                     ` (7 preceding siblings ...)
  2023-03-02 16:18   ` [PATCH v2 08/17] net/virtio: " Tyler Retzlaff
@ 2023-03-02 16:18   ` Tyler Retzlaff
  2023-03-02 16:18   ` [PATCH v2 10/17] net/mlx5: " Tyler Retzlaff
                     ` (10 subsequent siblings)
  19 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 16:18 UTC (permalink / raw)
  To: dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/octeontx/octeontx_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index d52a3e7..e00298e 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -1581,7 +1581,7 @@ static void build_xstat_names(struct rte_eth_xstat_name *xstat_names)
 	nic->pko_vfid = pko_vfid;
 	nic->port_id = port;
 	nic->evdev = evdev;
-	__atomic_add_fetch(&evdev_refcnt, 1, __ATOMIC_ACQUIRE);
+	__atomic_fetch_add(&evdev_refcnt, 1, __ATOMIC_ACQUIRE);
 
 	res = octeontx_port_open(nic);
 	if (res < 0)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 10/17] net/mlx5: use previous value atomic fetch operations
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
                     ` (8 preceding siblings ...)
  2023-03-02 16:18   ` [PATCH v2 09/17] net/octeontx: " Tyler Retzlaff
@ 2023-03-02 16:18   ` Tyler Retzlaff
  2023-03-02 16:18   ` [PATCH v2 11/17] net/iavf: " Tyler Retzlaff
                     ` (9 subsequent siblings)
  19 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 16:18 UTC (permalink / raw)
  To: dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/mlx5/linux/mlx5_verbs.c |  2 +-
 drivers/net/mlx5/mlx5_flow.c        |  6 +++---
 drivers/net/mlx5/mlx5_flow_dv.c     |  4 ++--
 drivers/net/mlx5/mlx5_flow_flex.c   |  6 +++---
 drivers/net/mlx5/mlx5_flow_hw.c     | 10 +++++-----
 drivers/net/mlx5/mlx5_flow_meter.c  | 20 ++++++++++----------
 drivers/net/mlx5/mlx5_rx.h          |  2 +-
 7 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/net/mlx5/linux/mlx5_verbs.c b/drivers/net/mlx5/linux/mlx5_verbs.c
index 67a7bec..c722613 100644
--- a/drivers/net/mlx5/linux/mlx5_verbs.c
+++ b/drivers/net/mlx5/linux/mlx5_verbs.c
@@ -1159,7 +1159,7 @@
 		claim_zero(mlx5_glue->destroy_cq(sh->self_lb.ibv_cq));
 		sh->self_lb.ibv_cq = NULL;
 	}
-	(void)__atomic_sub_fetch(&sh->self_lb.refcnt, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_sub(&sh->self_lb.refcnt, 1, __ATOMIC_RELAXED);
 	return -rte_errno;
 #else
 	RTE_SET_USED(dev);
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index a6a426c..1c51b29 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -4451,7 +4451,7 @@ struct mlx5_translated_action_handle {
 			shared_rss = mlx5_ipool_get
 				(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS],
 									   idx);
-			__atomic_add_fetch(&shared_rss->refcnt, 1,
+			__atomic_fetch_add(&shared_rss->refcnt, 1,
 					   __ATOMIC_RELAXED);
 			return idx;
 		default:
@@ -7295,7 +7295,7 @@ struct mlx5_list_entry *
 	if (tunnel) {
 		flow->tunnel = 1;
 		flow->tunnel_id = tunnel->tunnel_id;
-		__atomic_add_fetch(&tunnel->refctn, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_add(&tunnel->refctn, 1, __ATOMIC_RELAXED);
 		mlx5_free(default_miss_ctx.queue);
 	}
 	mlx5_flow_pop_thread_workspace();
@@ -7306,7 +7306,7 @@ struct mlx5_list_entry *
 	flow_mreg_del_copy_action(dev, flow);
 	flow_drv_destroy(dev, flow);
 	if (rss_desc->shared_rss)
-		__atomic_sub_fetch(&((struct mlx5_shared_action_rss *)
+		__atomic_fetch_sub(&((struct mlx5_shared_action_rss *)
 			mlx5_ipool_get
 			(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS],
 			rss_desc->shared_rss))->refcnt, 1, __ATOMIC_RELAXED);
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index f93dd40..0233cde 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -15143,7 +15143,7 @@ struct mlx5_list_entry *
 
 	shared_rss = mlx5_ipool_get
 			(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS], srss);
-	__atomic_sub_fetch(&shared_rss->refcnt, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_sub(&shared_rss->refcnt, 1, __ATOMIC_RELAXED);
 }
 
 void
@@ -15734,7 +15734,7 @@ struct mlx5_list_entry *
 	/* Update queue with indirect table queue memoyr. */
 	origin->queue = shared_rss->ind_tbl->queues;
 	rte_spinlock_init(&shared_rss->action_rss_sl);
-	__atomic_add_fetch(&shared_rss->refcnt, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&shared_rss->refcnt, 1, __ATOMIC_RELAXED);
 	rte_spinlock_lock(&priv->shared_act_sl);
 	ILIST_INSERT(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS],
 		     &priv->rss_shared_actions, idx, shared_rss, next);
diff --git a/drivers/net/mlx5/mlx5_flow_flex.c b/drivers/net/mlx5/mlx5_flow_flex.c
index 35f2a99..a825274 100644
--- a/drivers/net/mlx5/mlx5_flow_flex.c
+++ b/drivers/net/mlx5/mlx5_flow_flex.c
@@ -301,7 +301,7 @@
 		return ret;
 	}
 	if (acquire)
-		__atomic_add_fetch(&flex->refcnt, 1, __ATOMIC_RELEASE);
+		__atomic_fetch_add(&flex->refcnt, 1, __ATOMIC_RELEASE);
 	return ret;
 }
 
@@ -336,7 +336,7 @@
 		rte_errno = -EINVAL;
 		return -EINVAL;
 	}
-	__atomic_sub_fetch(&flex->refcnt, 1, __ATOMIC_RELEASE);
+	__atomic_fetch_sub(&flex->refcnt, 1, __ATOMIC_RELEASE);
 	return 0;
 }
 
@@ -1220,7 +1220,7 @@ struct rte_flow_item_flex_handle *
 	}
 	flex->devx_fp = container_of(ent, struct mlx5_flex_parser_devx, entry);
 	/* Mark initialized flex item valid. */
-	__atomic_add_fetch(&flex->refcnt, 1, __ATOMIC_RELEASE);
+	__atomic_fetch_add(&flex->refcnt, 1, __ATOMIC_RELEASE);
 	return (struct rte_flow_item_flex_handle *)flex;
 
 error:
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index a9c7045..159ebb5 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -1406,7 +1406,7 @@ static rte_be32_t vlan_hdr_to_be32(const struct rte_flow_action *actions)
 				goto err;
 			acts->rule_acts[action_pos].action =
 				priv->hw_tag[!!attr->group];
-			__atomic_add_fetch(&priv->hws_mark_refcnt, 1, __ATOMIC_RELAXED);
+			__atomic_fetch_add(&priv->hws_mark_refcnt, 1, __ATOMIC_RELAXED);
 			flow_hw_rxq_flag_set(dev, true);
 			break;
 		case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:
@@ -3162,13 +3162,13 @@ static rte_be32_t vlan_hdr_to_be32(const struct rte_flow_action *actions)
 at_error:
 	while (i--) {
 		__flow_hw_action_template_destroy(dev, &tbl->ats[i].acts);
-		__atomic_sub_fetch(&action_templates[i]->refcnt,
+		__atomic_fetch_sub(&action_templates[i]->refcnt,
 				   1, __ATOMIC_RELAXED);
 	}
 	i = nb_item_templates;
 it_error:
 	while (i--)
-		__atomic_sub_fetch(&item_templates[i]->refcnt,
+		__atomic_fetch_sub(&item_templates[i]->refcnt,
 				   1, __ATOMIC_RELAXED);
 error:
 	err = rte_errno;
@@ -3361,11 +3361,11 @@ static rte_be32_t vlan_hdr_to_be32(const struct rte_flow_action *actions)
 	}
 	LIST_REMOVE(table, next);
 	for (i = 0; i < table->nb_item_templates; i++)
-		__atomic_sub_fetch(&table->its[i]->refcnt,
+		__atomic_fetch_sub(&table->its[i]->refcnt,
 				   1, __ATOMIC_RELAXED);
 	for (i = 0; i < table->nb_action_templates; i++) {
 		__flow_hw_action_template_destroy(dev, &table->ats[i].acts);
-		__atomic_sub_fetch(&table->ats[i].action_template->refcnt,
+		__atomic_fetch_sub(&table->ats[i].action_template->refcnt,
 				   1, __ATOMIC_RELAXED);
 	}
 	mlx5dr_matcher_destroy(table->matcher);
diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c
index 08f8aad..cb26a12 100644
--- a/drivers/net/mlx5/mlx5_flow_meter.c
+++ b/drivers/net/mlx5/mlx5_flow_meter.c
@@ -1788,7 +1788,7 @@ struct mlx5_flow_meter_policy *
 			NULL, "Meter profile id not valid.");
 	/* Meter policy must exist. */
 	if (params->meter_policy_id == priv->sh->mtrmng->def_policy_id) {
-		__atomic_add_fetch
+		__atomic_fetch_add
 			(&priv->sh->mtrmng->def_policy_ref_cnt,
 			1, __ATOMIC_RELAXED);
 		domain_bitmap = MLX5_MTR_ALL_DOMAIN_BIT;
@@ -1870,7 +1870,7 @@ struct mlx5_flow_meter_policy *
 	fm->is_enable = params->meter_enable;
 	fm->shared = !!shared;
 	fm->color_aware = !!params->use_prev_mtr_color;
-	__atomic_add_fetch(&fm->profile->ref_cnt, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&fm->profile->ref_cnt, 1, __ATOMIC_RELAXED);
 	if (params->meter_policy_id == priv->sh->mtrmng->def_policy_id) {
 		fm->def_policy = 1;
 		fm->flow_ipool = mlx5_ipool_create(&flow_ipool_cfg);
@@ -1899,7 +1899,7 @@ struct mlx5_flow_meter_policy *
 	}
 	fm->active_state = params->meter_enable;
 	if (mtr_policy)
-		__atomic_add_fetch(&mtr_policy->ref_cnt, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_add(&mtr_policy->ref_cnt, 1, __ATOMIC_RELAXED);
 	return 0;
 error:
 	mlx5_flow_destroy_mtr_tbls(dev, fm);
@@ -1994,8 +1994,8 @@ struct mlx5_flow_meter_policy *
 			RTE_MTR_ERROR_TYPE_UNSPECIFIED,
 			NULL, "Failed to create devx meter.");
 	fm->active_state = params->meter_enable;
-	__atomic_add_fetch(&fm->profile->ref_cnt, 1, __ATOMIC_RELAXED);
-	__atomic_add_fetch(&policy->ref_cnt, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&fm->profile->ref_cnt, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&policy->ref_cnt, 1, __ATOMIC_RELAXED);
 	return 0;
 }
 
@@ -2017,7 +2017,7 @@ struct mlx5_flow_meter_policy *
 	if (fmp == NULL)
 		return -1;
 	/* Update dependencies. */
-	__atomic_sub_fetch(&fmp->ref_cnt, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_sub(&fmp->ref_cnt, 1, __ATOMIC_RELAXED);
 	fm->profile = NULL;
 	/* Remove from list. */
 	if (!priv->sh->meter_aso_en) {
@@ -2035,14 +2035,14 @@ struct mlx5_flow_meter_policy *
 	}
 	mlx5_flow_destroy_mtr_tbls(dev, fm);
 	if (fm->def_policy)
-		__atomic_sub_fetch(&priv->sh->mtrmng->def_policy_ref_cnt,
+		__atomic_fetch_sub(&priv->sh->mtrmng->def_policy_ref_cnt,
 				1, __ATOMIC_RELAXED);
 	if (priv->sh->meter_aso_en) {
 		if (!fm->def_policy) {
 			mtr_policy = mlx5_flow_meter_policy_find(dev,
 						fm->policy_id, NULL);
 			if (mtr_policy)
-				__atomic_sub_fetch(&mtr_policy->ref_cnt,
+				__atomic_fetch_sub(&mtr_policy->ref_cnt,
 						1, __ATOMIC_RELAXED);
 			fm->policy_id = 0;
 		}
@@ -2146,12 +2146,12 @@ struct mlx5_flow_meter_policy *
 					  RTE_MTR_ERROR_TYPE_UNSPECIFIED,
 					  NULL, "Meter object is being used.");
 	/* Destroy the meter profile. */
-	__atomic_sub_fetch(&fm->profile->ref_cnt,
+	__atomic_fetch_sub(&fm->profile->ref_cnt,
 						1, __ATOMIC_RELAXED);
 	/* Destroy the meter policy. */
 	policy = mlx5_flow_meter_policy_find(dev,
 			fm->policy_id, NULL);
-	__atomic_sub_fetch(&policy->ref_cnt,
+	__atomic_fetch_sub(&policy->ref_cnt,
 						1, __ATOMIC_RELAXED);
 	memset(fm, 0, sizeof(struct mlx5_flow_meter_info));
 	return 0;
diff --git a/drivers/net/mlx5/mlx5_rx.h b/drivers/net/mlx5/mlx5_rx.h
index 6b42e27..ba62398 100644
--- a/drivers/net/mlx5/mlx5_rx.h
+++ b/drivers/net/mlx5/mlx5_rx.h
@@ -539,7 +539,7 @@ uint16_t mlx5_rx_burst_mprq_vec(void *dpdk_rxq, struct rte_mbuf **pkts,
 		void *buf_addr;
 
 		/* Increment the refcnt of the whole chunk. */
-		__atomic_add_fetch(&buf->refcnt, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_add(&buf->refcnt, 1, __ATOMIC_RELAXED);
 		MLX5_ASSERT(__atomic_load_n(&buf->refcnt,
 			    __ATOMIC_RELAXED) <= strd_n + 1);
 		buf_addr = RTE_PTR_SUB(addr, RTE_PKTMBUF_HEADROOM);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 11/17] net/iavf: use previous value atomic fetch operations
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
                     ` (9 preceding siblings ...)
  2023-03-02 16:18   ` [PATCH v2 10/17] net/mlx5: " Tyler Retzlaff
@ 2023-03-02 16:18   ` Tyler Retzlaff
  2023-03-02 16:18   ` [PATCH v2 12/17] net/cxgbe: " Tyler Retzlaff
                     ` (8 subsequent siblings)
  19 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 16:18 UTC (permalink / raw)
  To: dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/iavf/iavf_vchnl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 9adaadb..6c04bd2 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -128,7 +128,7 @@ struct iavf_event_handler {
 	int err = pipe(handler->fd);
 #endif
 	if (err != 0) {
-		__atomic_sub_fetch(&handler->ndev, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_sub(&handler->ndev, 1, __ATOMIC_RELAXED);
 		return -1;
 	}
 
@@ -137,7 +137,7 @@ struct iavf_event_handler {
 
 	if (rte_ctrl_thread_create(&handler->tid, "iavf-event-thread",
 				NULL, iavf_dev_event_handle, NULL)) {
-		__atomic_sub_fetch(&handler->ndev, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_sub(&handler->ndev, 1, __ATOMIC_RELAXED);
 		return -1;
 	}
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 12/17] net/cxgbe: use previous value atomic fetch operations
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
                     ` (10 preceding siblings ...)
  2023-03-02 16:18   ` [PATCH v2 11/17] net/iavf: " Tyler Retzlaff
@ 2023-03-02 16:18   ` Tyler Retzlaff
  2023-03-02 16:18   ` [PATCH v2 13/17] drivers/event: " Tyler Retzlaff
                     ` (7 subsequent siblings)
  19 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 16:18 UTC (permalink / raw)
  To: dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/cxgbe/clip_tbl.c   |  2 +-
 drivers/net/cxgbe/cxgbe_main.c | 12 ++++++------
 drivers/net/cxgbe/l2t.c        |  4 ++--
 drivers/net/cxgbe/mps_tcam.c   |  2 +-
 drivers/net/cxgbe/smt.c        |  4 ++--
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/cxgbe/clip_tbl.c b/drivers/net/cxgbe/clip_tbl.c
index 072fc74..ce715f2 100644
--- a/drivers/net/cxgbe/clip_tbl.c
+++ b/drivers/net/cxgbe/clip_tbl.c
@@ -129,7 +129,7 @@ static struct clip_entry *t4_clip_alloc(struct rte_eth_dev *dev,
 				ce->type = FILTER_TYPE_IPV4;
 			}
 		} else {
-			__atomic_add_fetch(&ce->refcnt, 1, __ATOMIC_RELAXED);
+			__atomic_fetch_add(&ce->refcnt, 1, __ATOMIC_RELAXED);
 		}
 		t4_os_unlock(&ce->lock);
 	}
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index f8dd833..c479454 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -418,14 +418,14 @@ void cxgbe_remove_tid(struct tid_info *t, unsigned int chan, unsigned int tid,
 
 	if (t->tid_tab[tid]) {
 		t->tid_tab[tid] = NULL;
-		__atomic_sub_fetch(&t->conns_in_use, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_sub(&t->conns_in_use, 1, __ATOMIC_RELAXED);
 		if (t->hash_base && tid >= t->hash_base) {
 			if (family == FILTER_TYPE_IPV4)
-				__atomic_sub_fetch(&t->hash_tids_in_use, 1,
+				__atomic_fetch_sub(&t->hash_tids_in_use, 1,
 						   __ATOMIC_RELAXED);
 		} else {
 			if (family == FILTER_TYPE_IPV4)
-				__atomic_sub_fetch(&t->tids_in_use, 1,
+				__atomic_fetch_sub(&t->tids_in_use, 1,
 						   __ATOMIC_RELAXED);
 		}
 	}
@@ -448,15 +448,15 @@ void cxgbe_insert_tid(struct tid_info *t, void *data, unsigned int tid,
 	t->tid_tab[tid] = data;
 	if (t->hash_base && tid >= t->hash_base) {
 		if (family == FILTER_TYPE_IPV4)
-			__atomic_add_fetch(&t->hash_tids_in_use, 1,
+			__atomic_fetch_add(&t->hash_tids_in_use, 1,
 					   __ATOMIC_RELAXED);
 	} else {
 		if (family == FILTER_TYPE_IPV4)
-			__atomic_add_fetch(&t->tids_in_use, 1,
+			__atomic_fetch_add(&t->tids_in_use, 1,
 					   __ATOMIC_RELAXED);
 	}
 
-	__atomic_add_fetch(&t->conns_in_use, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&t->conns_in_use, 1, __ATOMIC_RELAXED);
 }
 
 /**
diff --git a/drivers/net/cxgbe/l2t.c b/drivers/net/cxgbe/l2t.c
index 66f5789..21f4019 100644
--- a/drivers/net/cxgbe/l2t.c
+++ b/drivers/net/cxgbe/l2t.c
@@ -15,7 +15,7 @@
 void cxgbe_l2t_release(struct l2t_entry *e)
 {
 	if (__atomic_load_n(&e->refcnt, __ATOMIC_RELAXED) != 0)
-		__atomic_sub_fetch(&e->refcnt, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_sub(&e->refcnt, 1, __ATOMIC_RELAXED);
 }
 
 /**
@@ -162,7 +162,7 @@ static struct l2t_entry *t4_l2t_alloc_switching(struct rte_eth_dev *dev,
 				dev_debug(adap, "Failed to write L2T entry: %d",
 					  ret);
 		} else {
-			__atomic_add_fetch(&e->refcnt, 1, __ATOMIC_RELAXED);
+			__atomic_fetch_add(&e->refcnt, 1, __ATOMIC_RELAXED);
 		}
 		t4_os_unlock(&e->lock);
 	}
diff --git a/drivers/net/cxgbe/mps_tcam.c b/drivers/net/cxgbe/mps_tcam.c
index abbf06e..017741f 100644
--- a/drivers/net/cxgbe/mps_tcam.c
+++ b/drivers/net/cxgbe/mps_tcam.c
@@ -76,7 +76,7 @@ int cxgbe_mpstcam_alloc(struct port_info *pi, const u8 *eth_addr,
 	t4_os_write_lock(&mpstcam->lock);
 	entry = cxgbe_mpstcam_lookup(adap->mpstcam, eth_addr, mask);
 	if (entry) {
-		__atomic_add_fetch(&entry->refcnt, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_add(&entry->refcnt, 1, __ATOMIC_RELAXED);
 		t4_os_write_unlock(&mpstcam->lock);
 		return entry->idx;
 	}
diff --git a/drivers/net/cxgbe/smt.c b/drivers/net/cxgbe/smt.c
index 810c757..4e14a73 100644
--- a/drivers/net/cxgbe/smt.c
+++ b/drivers/net/cxgbe/smt.c
@@ -170,7 +170,7 @@ static struct smt_entry *t4_smt_alloc_switching(struct rte_eth_dev *dev,
 			e->state = SMT_STATE_SWITCHING;
 			__atomic_store_n(&e->refcnt, 1, __ATOMIC_RELAXED);
 		} else {
-			__atomic_add_fetch(&e->refcnt, 1, __ATOMIC_RELAXED);
+			__atomic_fetch_add(&e->refcnt, 1, __ATOMIC_RELAXED);
 		}
 		t4_os_unlock(&e->lock);
 	}
@@ -196,7 +196,7 @@ struct smt_entry *cxgbe_smt_alloc_switching(struct rte_eth_dev *dev, u8 *smac)
 void cxgbe_smt_release(struct smt_entry *e)
 {
 	if (__atomic_load_n(&e->refcnt, __ATOMIC_RELAXED) != 0)
-		__atomic_sub_fetch(&e->refcnt, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_sub(&e->refcnt, 1, __ATOMIC_RELAXED);
 }
 
 /**
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 13/17] drivers/event: use previous value atomic fetch operations
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
                     ` (11 preceding siblings ...)
  2023-03-02 16:18   ` [PATCH v2 12/17] net/cxgbe: " Tyler Retzlaff
@ 2023-03-02 16:18   ` Tyler Retzlaff
  2023-03-13  7:02     ` [EXT] " Pavan Nikhilesh Bhagavatula
  2023-03-02 16:18   ` [PATCH v2 14/17] dma/skeleton: " Tyler Retzlaff
                     ` (6 subsequent siblings)
  19 siblings, 1 reply; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 16:18 UTC (permalink / raw)
  To: dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/event/cnxk/cnxk_eventdev_selftest.c | 12 ++++++------
 drivers/event/cnxk/cnxk_tim_worker.h        |  6 +++---
 drivers/event/dsw/dsw_event.c               |  6 +++---
 drivers/event/octeontx/timvf_worker.h       |  6 +++---
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/event/cnxk/cnxk_eventdev_selftest.c b/drivers/event/cnxk/cnxk_eventdev_selftest.c
index 577c99b..95c0f1b 100644
--- a/drivers/event/cnxk/cnxk_eventdev_selftest.c
+++ b/drivers/event/cnxk/cnxk_eventdev_selftest.c
@@ -554,7 +554,7 @@ typedef int (*validate_event_cb)(uint32_t index, uint8_t port,
 		ret = validate_event(&ev);
 		RTE_TEST_ASSERT_SUCCESS(ret, "Failed to validate event");
 		rte_pktmbuf_free(ev.mbuf);
-		__atomic_sub_fetch(total_events, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_sub(total_events, 1, __ATOMIC_RELAXED);
 	}
 
 	return 0;
@@ -916,7 +916,7 @@ typedef int (*validate_event_cb)(uint32_t index, uint8_t port,
 
 			if (seqn_list_update(seqn) == 0) {
 				rte_pktmbuf_free(ev.mbuf);
-				__atomic_sub_fetch(total_events, 1,
+				__atomic_fetch_sub(total_events, 1,
 						   __ATOMIC_RELAXED);
 			} else {
 				plt_err("Failed to update seqn_list");
@@ -1072,7 +1072,7 @@ typedef int (*validate_event_cb)(uint32_t index, uint8_t port,
 
 			if (seqn_list_update(seqn) == 0) {
 				rte_pktmbuf_free(ev.mbuf);
-				__atomic_sub_fetch(total_events, 1,
+				__atomic_fetch_sub(total_events, 1,
 						   __ATOMIC_RELAXED);
 			} else {
 				plt_err("Failed to update seqn_list");
@@ -1217,7 +1217,7 @@ typedef int (*validate_event_cb)(uint32_t index, uint8_t port,
 
 		if (ev.sub_event_type == MAX_STAGES) { /* last stage */
 			rte_pktmbuf_free(ev.mbuf);
-			__atomic_sub_fetch(total_events, 1, __ATOMIC_RELAXED);
+			__atomic_fetch_sub(total_events, 1, __ATOMIC_RELAXED);
 		} else {
 			ev.event_type = RTE_EVENT_TYPE_CPU;
 			ev.sub_event_type++;
@@ -1293,7 +1293,7 @@ typedef int (*validate_event_cb)(uint32_t index, uint8_t port,
 
 		if (ev.queue_id == nr_queues - 1) { /* last stage */
 			rte_pktmbuf_free(ev.mbuf);
-			__atomic_sub_fetch(total_events, 1, __ATOMIC_RELAXED);
+			__atomic_fetch_sub(total_events, 1, __ATOMIC_RELAXED);
 		} else {
 			ev.event_type = RTE_EVENT_TYPE_CPU;
 			ev.queue_id++;
@@ -1338,7 +1338,7 @@ typedef int (*validate_event_cb)(uint32_t index, uint8_t port,
 
 		if (ev.queue_id == nr_queues - 1) { /* Last stage */
 			rte_pktmbuf_free(ev.mbuf);
-			__atomic_sub_fetch(total_events, 1, __ATOMIC_RELAXED);
+			__atomic_fetch_sub(total_events, 1, __ATOMIC_RELAXED);
 		} else {
 			ev.event_type = RTE_EVENT_TYPE_CPU;
 			ev.queue_id++;
diff --git a/drivers/event/cnxk/cnxk_tim_worker.h b/drivers/event/cnxk/cnxk_tim_worker.h
index a326d55..c087fe5 100644
--- a/drivers/event/cnxk/cnxk_tim_worker.h
+++ b/drivers/event/cnxk/cnxk_tim_worker.h
@@ -102,19 +102,19 @@
 static inline void
 cnxk_tim_bkt_inc_nent(struct cnxk_tim_bkt *bktp)
 {
-	__atomic_add_fetch(&bktp->nb_entry, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&bktp->nb_entry, 1, __ATOMIC_RELAXED);
 }
 
 static inline void
 cnxk_tim_bkt_add_nent_relaxed(struct cnxk_tim_bkt *bktp, uint32_t v)
 {
-	__atomic_add_fetch(&bktp->nb_entry, v, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&bktp->nb_entry, v, __ATOMIC_RELAXED);
 }
 
 static inline void
 cnxk_tim_bkt_add_nent(struct cnxk_tim_bkt *bktp, uint32_t v)
 {
-	__atomic_add_fetch(&bktp->nb_entry, v, __ATOMIC_RELEASE);
+	__atomic_fetch_add(&bktp->nb_entry, v, __ATOMIC_RELEASE);
 }
 
 static inline uint64_t
diff --git a/drivers/event/dsw/dsw_event.c b/drivers/event/dsw/dsw_event.c
index 9932caf..89badca 100644
--- a/drivers/event/dsw/dsw_event.c
+++ b/drivers/event/dsw/dsw_event.c
@@ -50,7 +50,7 @@
 
 	if (unlikely(new_total_on_loan > dsw->max_inflight)) {
 		/* Some other port took the last credits */
-		__atomic_sub_fetch(&dsw->credits_on_loan, acquired_credits,
+		__atomic_fetch_sub(&dsw->credits_on_loan, acquired_credits,
 				   __ATOMIC_RELAXED);
 		return false;
 	}
@@ -77,7 +77,7 @@
 
 		port->inflight_credits = leave_credits;
 
-		__atomic_sub_fetch(&dsw->credits_on_loan, return_credits,
+		__atomic_fetch_sub(&dsw->credits_on_loan, return_credits,
 				   __ATOMIC_RELAXED);
 
 		DSW_LOG_DP_PORT(DEBUG, port->id,
@@ -527,7 +527,7 @@ struct dsw_queue_flow_burst {
 	target_qfs[*targets_len] = *candidate_qf;
 	(*targets_len)++;
 
-	__atomic_add_fetch(&dsw->ports[candidate_port_id].immigration_load,
+	__atomic_fetch_add(&dsw->ports[candidate_port_id].immigration_load,
 			   candidate_flow_load, __ATOMIC_RELAXED);
 
 	return true;
diff --git a/drivers/event/octeontx/timvf_worker.h b/drivers/event/octeontx/timvf_worker.h
index 3f1e77f..ad98ca0 100644
--- a/drivers/event/octeontx/timvf_worker.h
+++ b/drivers/event/octeontx/timvf_worker.h
@@ -108,7 +108,7 @@
 static inline void
 timr_bkt_dec_lock(struct tim_mem_bucket *bktp)
 {
-	__atomic_add_fetch(&bktp->lock, 0xff, __ATOMIC_ACQ_REL);
+	__atomic_fetch_add(&bktp->lock, 0xff, __ATOMIC_ACQ_REL);
 }
 
 static inline uint32_t
@@ -121,13 +121,13 @@
 static inline void
 timr_bkt_inc_nent(struct tim_mem_bucket *bktp)
 {
-	__atomic_add_fetch(&bktp->nb_entry, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&bktp->nb_entry, 1, __ATOMIC_RELAXED);
 }
 
 static inline void
 timr_bkt_add_nent(struct tim_mem_bucket *bktp, uint32_t v)
 {
-	__atomic_add_fetch(&bktp->nb_entry, v, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&bktp->nb_entry, v, __ATOMIC_RELAXED);
 }
 
 static inline uint64_t
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 14/17] dma/skeleton: use previous value atomic fetch operations
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
                     ` (12 preceding siblings ...)
  2023-03-02 16:18   ` [PATCH v2 13/17] drivers/event: " Tyler Retzlaff
@ 2023-03-02 16:18   ` Tyler Retzlaff
  2023-03-02 16:18   ` [PATCH v2 15/17] drivers/common: " Tyler Retzlaff
                     ` (5 subsequent siblings)
  19 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 16:18 UTC (permalink / raw)
  To: dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/dma/skeleton/skeleton_dmadev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/skeleton/skeleton_dmadev.c b/drivers/dma/skeleton/skeleton_dmadev.c
index 9b6da65..43e7052 100644
--- a/drivers/dma/skeleton/skeleton_dmadev.c
+++ b/drivers/dma/skeleton/skeleton_dmadev.c
@@ -77,7 +77,7 @@
 
 		hw->zero_req_count = 0;
 		rte_memcpy(desc->dst, desc->src, desc->len);
-		__atomic_add_fetch(&hw->completed_count, 1, __ATOMIC_RELEASE);
+		__atomic_fetch_add(&hw->completed_count, 1, __ATOMIC_RELEASE);
 		(void)rte_ring_enqueue(hw->desc_completed, (void *)desc);
 	}
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 15/17] drivers/common: use previous value atomic fetch operations
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
                     ` (13 preceding siblings ...)
  2023-03-02 16:18   ` [PATCH v2 14/17] dma/skeleton: " Tyler Retzlaff
@ 2023-03-02 16:18   ` Tyler Retzlaff
  2023-03-02 16:18   ` [PATCH v2 16/17] app/test: " Tyler Retzlaff
                     ` (4 subsequent siblings)
  19 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 16:18 UTC (permalink / raw)
  To: dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/common/cnxk/roc_nix_inl_dev.c   |  2 +-
 drivers/common/mlx5/mlx5_common_mr.c    |  2 +-
 drivers/common/mlx5/mlx5_common_utils.c | 10 +++++-----
 drivers/common/mlx5/mlx5_malloc.c       | 16 ++++++++--------
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/common/cnxk/roc_nix_inl_dev.c b/drivers/common/cnxk/roc_nix_inl_dev.c
index 6f60961..45d6f62 100644
--- a/drivers/common/cnxk/roc_nix_inl_dev.c
+++ b/drivers/common/cnxk/roc_nix_inl_dev.c
@@ -741,7 +741,7 @@
 			inl_dev->work_cb(&tmp, sa, (port_id << 8) | 0x1);
 			__atomic_store_n(ring_base + tail_l + 1, 0ULL,
 					 __ATOMIC_RELAXED);
-			__atomic_add_fetch((uint32_t *)ring_base, 1,
+			__atomic_fetch_add((uint32_t *)ring_base, 1,
 					   __ATOMIC_ACQ_REL);
 		} else
 			plt_err("Invalid SA");
diff --git a/drivers/common/mlx5/mlx5_common_mr.c b/drivers/common/mlx5/mlx5_common_mr.c
index 0e1d243..9ebe398 100644
--- a/drivers/common/mlx5/mlx5_common_mr.c
+++ b/drivers/common/mlx5/mlx5_common_mr.c
@@ -1650,7 +1650,7 @@ struct mlx5_mempool_get_extmem_data {
 	unsigned int i;
 
 	for (i = 0; i < mpr->mrs_n; i++)
-		__atomic_add_fetch(&mpr->mrs[i].refcnt, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_add(&mpr->mrs[i].refcnt, 1, __ATOMIC_RELAXED);
 }
 
 /**
diff --git a/drivers/common/mlx5/mlx5_common_utils.c b/drivers/common/mlx5/mlx5_common_utils.c
index 58d744b..915a317 100644
--- a/drivers/common/mlx5/mlx5_common_utils.c
+++ b/drivers/common/mlx5/mlx5_common_utils.c
@@ -217,7 +217,7 @@ struct mlx5_list_entry *
 		entry->lcore_idx = (uint32_t)lcore_index;
 		LIST_INSERT_HEAD(&l_inconst->cache[lcore_index]->h,
 				 entry, next);
-		__atomic_add_fetch(&l_inconst->count, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_add(&l_inconst->count, 1, __ATOMIC_RELAXED);
 		DRV_LOG(DEBUG, "MLX5 list %s c%d entry %p new: %u.",
 			l_const->name, lcore_index,
 			(void *)entry, entry->ref_cnt);
@@ -254,7 +254,7 @@ struct mlx5_list_entry *
 	l_inconst->gen_cnt++;
 	rte_rwlock_write_unlock(&l_inconst->lock);
 	LIST_INSERT_HEAD(&l_inconst->cache[lcore_index]->h, local_entry, next);
-	__atomic_add_fetch(&l_inconst->count, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&l_inconst->count, 1, __ATOMIC_RELAXED);
 	DRV_LOG(DEBUG, "mlx5 list %s entry %p new: %u.", l_const->name,
 		(void *)entry, entry->ref_cnt);
 	return local_entry;
@@ -294,11 +294,11 @@ struct mlx5_list_entry *
 		else
 			l_const->cb_remove(l_const->ctx, entry);
 	} else {
-		__atomic_add_fetch(&l_inconst->cache[entry->lcore_idx]->inv_cnt,
+		__atomic_fetch_add(&l_inconst->cache[entry->lcore_idx]->inv_cnt,
 				   1, __ATOMIC_RELAXED);
 	}
 	if (!l_const->lcores_share) {
-		__atomic_sub_fetch(&l_inconst->count, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_sub(&l_inconst->count, 1, __ATOMIC_RELAXED);
 		DRV_LOG(DEBUG, "mlx5 list %s entry %p removed.",
 			l_const->name, (void *)entry);
 		return 0;
@@ -310,7 +310,7 @@ struct mlx5_list_entry *
 		LIST_REMOVE(gentry, next);
 		rte_rwlock_write_unlock(&l_inconst->lock);
 		l_const->cb_remove(l_const->ctx, gentry);
-		__atomic_sub_fetch(&l_inconst->count, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_sub(&l_inconst->count, 1, __ATOMIC_RELAXED);
 		DRV_LOG(DEBUG, "mlx5 list %s entry %p removed.",
 			l_const->name, (void *)gentry);
 		return 0;
diff --git a/drivers/common/mlx5/mlx5_malloc.c b/drivers/common/mlx5/mlx5_malloc.c
index cef3b88..c58c41d 100644
--- a/drivers/common/mlx5/mlx5_malloc.c
+++ b/drivers/common/mlx5/mlx5_malloc.c
@@ -99,7 +99,7 @@ struct mlx5_sys_mem {
 			rte_mem_virt2memseg_list(addr),
 			__ATOMIC_RELAXED);
 #ifdef RTE_LIBRTE_MLX5_DEBUG
-		__atomic_add_fetch(&mlx5_sys_mem.msl_update, 1,
+		__atomic_fetch_add(&mlx5_sys_mem.msl_update, 1,
 				   __ATOMIC_RELAXED);
 #endif
 	}
@@ -126,7 +126,7 @@ struct mlx5_sys_mem {
 		if (!rte_mem_virt2memseg_list(addr))
 			return false;
 #ifdef RTE_LIBRTE_MLX5_DEBUG
-		__atomic_add_fetch(&mlx5_sys_mem.msl_miss, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_add(&mlx5_sys_mem.msl_miss, 1, __ATOMIC_RELAXED);
 #endif
 	}
 	return true;
@@ -185,7 +185,7 @@ struct mlx5_sys_mem {
 		mlx5_mem_update_msl(addr);
 #ifdef RTE_LIBRTE_MLX5_DEBUG
 		if (addr)
-			__atomic_add_fetch(&mlx5_sys_mem.malloc_rte, 1,
+			__atomic_fetch_add(&mlx5_sys_mem.malloc_rte, 1,
 					   __ATOMIC_RELAXED);
 #endif
 		return addr;
@@ -199,7 +199,7 @@ struct mlx5_sys_mem {
 		addr = malloc(size);
 #ifdef RTE_LIBRTE_MLX5_DEBUG
 	if (addr)
-		__atomic_add_fetch(&mlx5_sys_mem.malloc_sys, 1,
+		__atomic_fetch_add(&mlx5_sys_mem.malloc_sys, 1,
 				   __ATOMIC_RELAXED);
 #endif
 	return addr;
@@ -233,7 +233,7 @@ struct mlx5_sys_mem {
 		mlx5_mem_update_msl(new_addr);
 #ifdef RTE_LIBRTE_MLX5_DEBUG
 		if (new_addr)
-			__atomic_add_fetch(&mlx5_sys_mem.realloc_rte, 1,
+			__atomic_fetch_add(&mlx5_sys_mem.realloc_rte, 1,
 					   __ATOMIC_RELAXED);
 #endif
 		return new_addr;
@@ -246,7 +246,7 @@ struct mlx5_sys_mem {
 	new_addr = realloc(addr, size);
 #ifdef RTE_LIBRTE_MLX5_DEBUG
 	if (new_addr)
-		__atomic_add_fetch(&mlx5_sys_mem.realloc_sys, 1,
+		__atomic_fetch_add(&mlx5_sys_mem.realloc_sys, 1,
 				   __ATOMIC_RELAXED);
 #endif
 	return new_addr;
@@ -259,13 +259,13 @@ struct mlx5_sys_mem {
 		return;
 	if (!mlx5_mem_is_rte(addr)) {
 #ifdef RTE_LIBRTE_MLX5_DEBUG
-		__atomic_add_fetch(&mlx5_sys_mem.free_sys, 1,
+		__atomic_fetch_add(&mlx5_sys_mem.free_sys, 1,
 				   __ATOMIC_RELAXED);
 #endif
 		mlx5_os_free(addr);
 	} else {
 #ifdef RTE_LIBRTE_MLX5_DEBUG
-		__atomic_add_fetch(&mlx5_sys_mem.free_rte, 1,
+		__atomic_fetch_add(&mlx5_sys_mem.free_rte, 1,
 				   __ATOMIC_RELAXED);
 #endif
 		rte_free(addr);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 16/17] app/test: use previous value atomic fetch operations
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
                     ` (14 preceding siblings ...)
  2023-03-02 16:18   ` [PATCH v2 15/17] drivers/common: " Tyler Retzlaff
@ 2023-03-02 16:18   ` Tyler Retzlaff
  2023-03-02 16:18   ` [PATCH v2 17/17] test-eventdev: " Tyler Retzlaff
                     ` (3 subsequent siblings)
  19 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 16:18 UTC (permalink / raw)
  To: dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 app/test/test_lcores.c        | 2 +-
 app/test/test_service_cores.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/test/test_lcores.c b/app/test/test_lcores.c
index 5b43aa5..2c945b0 100644
--- a/app/test/test_lcores.c
+++ b/app/test/test_lcores.c
@@ -40,7 +40,7 @@ static uint32_t thread_loop(void *arg)
 		t->state = Thread_ERROR;
 	}
 	/* Report register happened to the control thread. */
-	__atomic_add_fetch(t->registered_count, 1, __ATOMIC_RELEASE);
+	__atomic_fetch_add(t->registered_count, 1, __ATOMIC_RELEASE);
 
 	/* Wait for release from the control thread. */
 	while (__atomic_load_n(t->registered_count, __ATOMIC_ACQUIRE) != 0)
diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c
index 637fcd7..9175736 100644
--- a/app/test/test_service_cores.c
+++ b/app/test/test_service_cores.c
@@ -751,12 +751,12 @@ static int32_t dummy_mt_safe_cb(void *args)
 	uint32_t *lock = &params[1];
 
 	while (!*done) {
-		__atomic_add_fetch(lock, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_add(lock, 1, __ATOMIC_RELAXED);
 		rte_delay_us(500);
 		if (__atomic_load_n(lock, __ATOMIC_RELAXED) > 1)
 			/* pass: second core has simultaneously incremented */
 			*done = 1;
-		__atomic_sub_fetch(lock, 1, __ATOMIC_RELAXED);
+		__atomic_fetch_sub(lock, 1, __ATOMIC_RELAXED);
 	}
 
 	return 0;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 17/17] test-eventdev: use previous value atomic fetch operations
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
                     ` (15 preceding siblings ...)
  2023-03-02 16:18   ` [PATCH v2 16/17] app/test: " Tyler Retzlaff
@ 2023-03-02 16:18   ` Tyler Retzlaff
  2023-03-03  1:54   ` [PATCH v2 00/17] use __atomic operations returning previous value Ruifeng Wang
                     ` (2 subsequent siblings)
  19 siblings, 0 replies; 47+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 16:18 UTC (permalink / raw)
  To: dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin, Tyler Retzlaff

Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
result of the operation.

Reduces unnecessary codegen that provided the result of the atomic
operation that was not used.

Change brings closer alignment with atomics available in C11 standard
and will reduce review effort when they are integrated.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 app/test-eventdev/test_order_common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-eventdev/test_order_common.h b/app/test-eventdev/test_order_common.h
index 92781d9..1507265 100644
--- a/app/test-eventdev/test_order_common.h
+++ b/app/test-eventdev/test_order_common.h
@@ -113,7 +113,7 @@ struct test_order {
 	 */
 	expected_flow_seq[flow]++;
 	rte_pktmbuf_free(ev->mbuf);
-	__atomic_sub_fetch(outstand_pkts, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_sub(outstand_pkts, 1, __ATOMIC_RELAXED);
 }
 
 static __rte_always_inline void
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* RE: [PATCH v2 00/17] use __atomic operations returning previous value
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
                     ` (16 preceding siblings ...)
  2023-03-02 16:18   ` [PATCH v2 17/17] test-eventdev: " Tyler Retzlaff
@ 2023-03-03  1:54   ` Ruifeng Wang
  2023-03-03  2:33   ` fengchengwen
  2023-04-25  9:10   ` David Marchand
  19 siblings, 0 replies; 47+ messages in thread
From: Ruifeng Wang @ 2023-03-03  1:54 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Honnappa Nagarahalli, thomas, bruce.richardson, mb, maxime.coquelin, nd

> -----Original Message-----
> From: Tyler Retzlaff <roretzla@linux.microsoft.com>
> Sent: Friday, March 3, 2023 12:18 AM
> To: dev@dpdk.org
> Cc: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>; thomas@monjalon.net;
> bruce.richardson@intel.com; mb@smartsharesystems.com; Ruifeng Wang <Ruifeng.Wang@arm.com>;
> maxime.coquelin@redhat.com; Tyler Retzlaff <roretzla@linux.microsoft.com>
> Subject: [PATCH v2 00/17] use __atomic operations returning previous value
> 
> This series replaces uses of __atomic_{add,and,or,sub,xor}_fetch with
> __atomic_fetch_{add,and,or,sub,xor} intrinsics.  The latter omits generation of code that
> is only needed if the returned value is actually used.
> 
> Additionally, this change simplifies adapting dpdk to standard atomics planned for 23.07
> since __atomic_fetch_xxx can be trivially replaced with atomic_fetch_xxx whereas
> __atomic_xxx_fetch has no standard equivalent.
> 
> 
> v2:
>   net/iavf patch had one incorrect change to __atomic_fetch_sub
>   from __atomic_sub_fetch the new value was assigned to a variable
>   on the previous line so revert the change from the patch.
> 
> Series-acked-by: Morten Brørup <mb@smartsharesystems.com>
> 
> Tyler Retzlaff (17):
>   vhost: use previous value atomic fetch operations
>   telemetry: use previous value atomic fetch operations
>   stack: use previous value atomic fetch operations
>   eal: use previous value atomic fetch operations
>   distributor: use previous value atomic fetch operations
>   bbdev: use previous value atomic fetch operations
>   examples/vhost: use previous value atomic fetch operations
>   net/virtio: use previous value atomic fetch operations
>   net/octeontx: use previous value atomic fetch operations
>   net/mlx5: use previous value atomic fetch operations
>   net/iavf: use previous value atomic fetch operations
>   net/cxgbe: use previous value atomic fetch operations
>   drivers/event: use previous value atomic fetch operations
>   dma/skeleton: use previous value atomic fetch operations
>   drivers/common: use previous value atomic fetch operations
>   app/test: use previous value atomic fetch operations
>   test-eventdev: use previous value atomic fetch operations
> 
>  app/test-eventdev/test_order_common.h            |  2 +-
>  app/test/test_lcores.c                           |  2 +-
>  app/test/test_service_cores.c                    |  4 ++--
>  drivers/common/cnxk/roc_nix_inl_dev.c            |  2 +-
>  drivers/common/mlx5/mlx5_common_mr.c             |  2 +-
>  drivers/common/mlx5/mlx5_common_utils.c          | 10 +++++-----
>  drivers/common/mlx5/mlx5_malloc.c                | 16 ++++++++--------
>  drivers/dma/skeleton/skeleton_dmadev.c           |  2 +-
>  drivers/event/cnxk/cnxk_eventdev_selftest.c      | 12 ++++++------
>  drivers/event/cnxk/cnxk_tim_worker.h             |  6 +++---
>  drivers/event/dsw/dsw_event.c                    |  6 +++---
>  drivers/event/octeontx/timvf_worker.h            |  6 +++---
>  drivers/net/cxgbe/clip_tbl.c                     |  2 +-
>  drivers/net/cxgbe/cxgbe_main.c                   | 12 ++++++------
>  drivers/net/cxgbe/l2t.c                          |  4 ++--
>  drivers/net/cxgbe/mps_tcam.c                     |  2 +-
>  drivers/net/cxgbe/smt.c                          |  4 ++--
>  drivers/net/iavf/iavf_vchnl.c                    |  4 ++--
>  drivers/net/mlx5/linux/mlx5_verbs.c              |  2 +-
>  drivers/net/mlx5/mlx5_flow.c                     |  6 +++---
>  drivers/net/mlx5/mlx5_flow_dv.c                  |  4 ++--
>  drivers/net/mlx5/mlx5_flow_flex.c                |  6 +++---
>  drivers/net/mlx5/mlx5_flow_hw.c                  | 10 +++++-----
>  drivers/net/mlx5/mlx5_flow_meter.c               | 20 ++++++++++----------
>  drivers/net/mlx5/mlx5_rx.h                       |  2 +-
>  drivers/net/octeontx/octeontx_ethdev.c           |  2 +-
>  drivers/net/virtio/virtio_user/virtio_user_dev.c |  2 +-
>  examples/vhost/main.c                            | 12 ++++++------
>  examples/vhost/virtio_net.c                      |  4 ++--
>  lib/bbdev/rte_bbdev.c                            |  2 +-
>  lib/distributor/rte_distributor.c                |  2 +-
>  lib/eal/common/eal_common_trace.c                |  8 ++++----
>  lib/eal/common/rte_service.c                     |  8 ++++----
>  lib/eal/ppc/include/rte_atomic.h                 | 16 ++++++++--------
>  lib/stack/rte_stack_lf_c11.h                     |  2 +-
>  lib/telemetry/telemetry.c                        |  6 +++---
>  lib/vhost/virtio_net.c                           |  6 +++---
>  37 files changed, 109 insertions(+), 109 deletions(-)
> 
> --
> 1.8.3.1
Series-acked-by: Ruifeng Wang <ruifeng.wang@arm.com>


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 00/17] use __atomic operations returning previous value
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
                     ` (17 preceding siblings ...)
  2023-03-03  1:54   ` [PATCH v2 00/17] use __atomic operations returning previous value Ruifeng Wang
@ 2023-03-03  2:33   ` fengchengwen
  2023-04-25  9:10   ` David Marchand
  19 siblings, 0 replies; 47+ messages in thread
From: fengchengwen @ 2023-03-03  2:33 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin



On 2023/3/3 0:18, Tyler Retzlaff wrote:
> This series replaces uses of __atomic_{add,and,or,sub,xor}_fetch with
> __atomic_fetch_{add,and,or,sub,xor} intrinsics.  The latter omits generation
> of code that is only needed if the returned value is actually used.
> 
> Additionally, this change simplifies adapting dpdk to standard atomics
> planned for 23.07 since __atomic_fetch_xxx can be trivially replaced with
> atomic_fetch_xxx whereas __atomic_xxx_fetch has no standard equivalent.

Series-acked-by: Chengwen Feng <fengchengwen@huawei.com>

> 
> 

...

> 

^ permalink raw reply	[flat|nested] 47+ messages in thread

* RE: [EXT] [PATCH v2 13/17] drivers/event: use previous value atomic fetch operations
  2023-03-02 16:18   ` [PATCH v2 13/17] drivers/event: " Tyler Retzlaff
@ 2023-03-13  7:02     ` Pavan Nikhilesh Bhagavatula
  0 siblings, 0 replies; 47+ messages in thread
From: Pavan Nikhilesh Bhagavatula @ 2023-03-13  7:02 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Honnappa.Nagarahalli, thomas, bruce.richardson, mb, Ruifeng.Wang,
	maxime.coquelin

> Use __atomic_fetch_{add,and,or,sub,xor} instead of
> __atomic_{add,and,or,sub,xor}_fetch when we have no interest in the
> result of the operation.
> 
> Reduces unnecessary codegen that provided the result of the atomic
> operation that was not used.
> 
> Change brings closer alignment with atomics available in C11 standard
> and will reduce review effort when they are integrated.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>

Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> ---
>  drivers/event/cnxk/cnxk_eventdev_selftest.c | 12 ++++++------
>  drivers/event/cnxk/cnxk_tim_worker.h        |  6 +++---
>  drivers/event/dsw/dsw_event.c               |  6 +++---
>  drivers/event/octeontx/timvf_worker.h       |  6 +++---
>  4 files changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/event/cnxk/cnxk_eventdev_selftest.c
> b/drivers/event/cnxk/cnxk_eventdev_selftest.c
> index 577c99b..95c0f1b 100644
> --- a/drivers/event/cnxk/cnxk_eventdev_selftest.c
> +++ b/drivers/event/cnxk/cnxk_eventdev_selftest.c
> @@ -554,7 +554,7 @@ typedef int (*validate_event_cb)(uint32_t index,
> uint8_t port,
>  		ret = validate_event(&ev);
>  		RTE_TEST_ASSERT_SUCCESS(ret, "Failed to validate event");
>  		rte_pktmbuf_free(ev.mbuf);
> -		__atomic_sub_fetch(total_events, 1, __ATOMIC_RELAXED);
> +		__atomic_fetch_sub(total_events, 1, __ATOMIC_RELAXED);
>  	}
> 
>  	return 0;
> @@ -916,7 +916,7 @@ typedef int (*validate_event_cb)(uint32_t index,
> uint8_t port,
> 
>  			if (seqn_list_update(seqn) == 0) {
>  				rte_pktmbuf_free(ev.mbuf);
> -				__atomic_sub_fetch(total_events, 1,
> +				__atomic_fetch_sub(total_events, 1,
>  						   __ATOMIC_RELAXED);
>  			} else {
>  				plt_err("Failed to update seqn_list");
> @@ -1072,7 +1072,7 @@ typedef int (*validate_event_cb)(uint32_t index,
> uint8_t port,
> 
>  			if (seqn_list_update(seqn) == 0) {
>  				rte_pktmbuf_free(ev.mbuf);
> -				__atomic_sub_fetch(total_events, 1,
> +				__atomic_fetch_sub(total_events, 1,
>  						   __ATOMIC_RELAXED);
>  			} else {
>  				plt_err("Failed to update seqn_list");
> @@ -1217,7 +1217,7 @@ typedef int (*validate_event_cb)(uint32_t index,
> uint8_t port,
> 
>  		if (ev.sub_event_type == MAX_STAGES) { /* last stage */
>  			rte_pktmbuf_free(ev.mbuf);
> -			__atomic_sub_fetch(total_events, 1,
> __ATOMIC_RELAXED);
> +			__atomic_fetch_sub(total_events, 1,
> __ATOMIC_RELAXED);
>  		} else {
>  			ev.event_type = RTE_EVENT_TYPE_CPU;
>  			ev.sub_event_type++;
> @@ -1293,7 +1293,7 @@ typedef int (*validate_event_cb)(uint32_t index,
> uint8_t port,
> 
>  		if (ev.queue_id == nr_queues - 1) { /* last stage */
>  			rte_pktmbuf_free(ev.mbuf);
> -			__atomic_sub_fetch(total_events, 1,
> __ATOMIC_RELAXED);
> +			__atomic_fetch_sub(total_events, 1,
> __ATOMIC_RELAXED);
>  		} else {
>  			ev.event_type = RTE_EVENT_TYPE_CPU;
>  			ev.queue_id++;
> @@ -1338,7 +1338,7 @@ typedef int (*validate_event_cb)(uint32_t index,
> uint8_t port,
> 
>  		if (ev.queue_id == nr_queues - 1) { /* Last stage */
>  			rte_pktmbuf_free(ev.mbuf);
> -			__atomic_sub_fetch(total_events, 1,
> __ATOMIC_RELAXED);
> +			__atomic_fetch_sub(total_events, 1,
> __ATOMIC_RELAXED);
>  		} else {
>  			ev.event_type = RTE_EVENT_TYPE_CPU;
>  			ev.queue_id++;
> diff --git a/drivers/event/cnxk/cnxk_tim_worker.h
> b/drivers/event/cnxk/cnxk_tim_worker.h
> index a326d55..c087fe5 100644
> --- a/drivers/event/cnxk/cnxk_tim_worker.h
> +++ b/drivers/event/cnxk/cnxk_tim_worker.h
> @@ -102,19 +102,19 @@
>  static inline void
>  cnxk_tim_bkt_inc_nent(struct cnxk_tim_bkt *bktp)
>  {
> -	__atomic_add_fetch(&bktp->nb_entry, 1, __ATOMIC_RELAXED);
> +	__atomic_fetch_add(&bktp->nb_entry, 1, __ATOMIC_RELAXED);
>  }
> 
>  static inline void
>  cnxk_tim_bkt_add_nent_relaxed(struct cnxk_tim_bkt *bktp, uint32_t v)
>  {
> -	__atomic_add_fetch(&bktp->nb_entry, v, __ATOMIC_RELAXED);
> +	__atomic_fetch_add(&bktp->nb_entry, v, __ATOMIC_RELAXED);
>  }
> 
>  static inline void
>  cnxk_tim_bkt_add_nent(struct cnxk_tim_bkt *bktp, uint32_t v)
>  {
> -	__atomic_add_fetch(&bktp->nb_entry, v, __ATOMIC_RELEASE);
> +	__atomic_fetch_add(&bktp->nb_entry, v, __ATOMIC_RELEASE);
>  }
> 
>  static inline uint64_t
> diff --git a/drivers/event/dsw/dsw_event.c
> b/drivers/event/dsw/dsw_event.c
> index 9932caf..89badca 100644
> --- a/drivers/event/dsw/dsw_event.c
> +++ b/drivers/event/dsw/dsw_event.c
> @@ -50,7 +50,7 @@
> 
>  	if (unlikely(new_total_on_loan > dsw->max_inflight)) {
>  		/* Some other port took the last credits */
> -		__atomic_sub_fetch(&dsw->credits_on_loan,
> acquired_credits,
> +		__atomic_fetch_sub(&dsw->credits_on_loan,
> acquired_credits,
>  				   __ATOMIC_RELAXED);
>  		return false;
>  	}
> @@ -77,7 +77,7 @@
> 
>  		port->inflight_credits = leave_credits;
> 
> -		__atomic_sub_fetch(&dsw->credits_on_loan,
> return_credits,
> +		__atomic_fetch_sub(&dsw->credits_on_loan,
> return_credits,
>  				   __ATOMIC_RELAXED);
> 
>  		DSW_LOG_DP_PORT(DEBUG, port->id,
> @@ -527,7 +527,7 @@ struct dsw_queue_flow_burst {
>  	target_qfs[*targets_len] = *candidate_qf;
>  	(*targets_len)++;
> 
> -	__atomic_add_fetch(&dsw-
> >ports[candidate_port_id].immigration_load,
> +	__atomic_fetch_add(&dsw-
> >ports[candidate_port_id].immigration_load,
>  			   candidate_flow_load, __ATOMIC_RELAXED);
> 
>  	return true;
> diff --git a/drivers/event/octeontx/timvf_worker.h
> b/drivers/event/octeontx/timvf_worker.h
> index 3f1e77f..ad98ca0 100644
> --- a/drivers/event/octeontx/timvf_worker.h
> +++ b/drivers/event/octeontx/timvf_worker.h
> @@ -108,7 +108,7 @@
>  static inline void
>  timr_bkt_dec_lock(struct tim_mem_bucket *bktp)
>  {
> -	__atomic_add_fetch(&bktp->lock, 0xff, __ATOMIC_ACQ_REL);
> +	__atomic_fetch_add(&bktp->lock, 0xff, __ATOMIC_ACQ_REL);
>  }
> 
>  static inline uint32_t
> @@ -121,13 +121,13 @@
>  static inline void
>  timr_bkt_inc_nent(struct tim_mem_bucket *bktp)
>  {
> -	__atomic_add_fetch(&bktp->nb_entry, 1, __ATOMIC_RELAXED);
> +	__atomic_fetch_add(&bktp->nb_entry, 1, __ATOMIC_RELAXED);
>  }
> 
>  static inline void
>  timr_bkt_add_nent(struct tim_mem_bucket *bktp, uint32_t v)
>  {
> -	__atomic_add_fetch(&bktp->nb_entry, v, __ATOMIC_RELAXED);
> +	__atomic_fetch_add(&bktp->nb_entry, v, __ATOMIC_RELAXED);
>  }
> 
>  static inline uint64_t
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 00/17] use __atomic operations returning previous value
  2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
                     ` (18 preceding siblings ...)
  2023-03-03  2:33   ` fengchengwen
@ 2023-04-25  9:10   ` David Marchand
  19 siblings, 0 replies; 47+ messages in thread
From: David Marchand @ 2023-04-25  9:10 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Honnappa.Nagarahalli, thomas, bruce.richardson, mb,
	Ruifeng.Wang, maxime.coquelin

On Thu, Mar 2, 2023 at 5:18 PM Tyler Retzlaff
<roretzla@linux.microsoft.com> wrote:
>
> This series replaces uses of __atomic_{add,and,or,sub,xor}_fetch with
> __atomic_fetch_{add,and,or,sub,xor} intrinsics.  The latter omits generation
> of code that is only needed if the returned value is actually used.
>
> Additionally, this change simplifies adapting dpdk to standard atomics
> planned for 23.07 since __atomic_fetch_xxx can be trivially replaced with
> atomic_fetch_xxx whereas __atomic_xxx_fetch has no standard equivalent.
>
>
> v2:
>   net/iavf patch had one incorrect change to __atomic_fetch_sub
>   from __atomic_sub_fetch the new value was assigned to a variable
>   on the previous line so revert the change from the patch.
>
> Series-acked-by: Morten Brørup <mb@smartsharesystems.com>
>
> Tyler Retzlaff (17):
>   vhost: use previous value atomic fetch operations
>   telemetry: use previous value atomic fetch operations
>   stack: use previous value atomic fetch operations
>   eal: use previous value atomic fetch operations
>   distributor: use previous value atomic fetch operations
>   bbdev: use previous value atomic fetch operations
>   examples/vhost: use previous value atomic fetch operations
>   net/virtio: use previous value atomic fetch operations
>   net/octeontx: use previous value atomic fetch operations
>   net/mlx5: use previous value atomic fetch operations
>   net/iavf: use previous value atomic fetch operations
>   net/cxgbe: use previous value atomic fetch operations
>   drivers/event: use previous value atomic fetch operations
>   dma/skeleton: use previous value atomic fetch operations
>   drivers/common: use previous value atomic fetch operations
>   app/test: use previous value atomic fetch operations
>   test-eventdev: use previous value atomic fetch operations
>
>  app/test-eventdev/test_order_common.h            |  2 +-
>  app/test/test_lcores.c                           |  2 +-
>  app/test/test_service_cores.c                    |  4 ++--
>  drivers/common/cnxk/roc_nix_inl_dev.c            |  2 +-
>  drivers/common/mlx5/mlx5_common_mr.c             |  2 +-
>  drivers/common/mlx5/mlx5_common_utils.c          | 10 +++++-----
>  drivers/common/mlx5/mlx5_malloc.c                | 16 ++++++++--------
>  drivers/dma/skeleton/skeleton_dmadev.c           |  2 +-
>  drivers/event/cnxk/cnxk_eventdev_selftest.c      | 12 ++++++------
>  drivers/event/cnxk/cnxk_tim_worker.h             |  6 +++---
>  drivers/event/dsw/dsw_event.c                    |  6 +++---
>  drivers/event/octeontx/timvf_worker.h            |  6 +++---
>  drivers/net/cxgbe/clip_tbl.c                     |  2 +-
>  drivers/net/cxgbe/cxgbe_main.c                   | 12 ++++++------
>  drivers/net/cxgbe/l2t.c                          |  4 ++--
>  drivers/net/cxgbe/mps_tcam.c                     |  2 +-
>  drivers/net/cxgbe/smt.c                          |  4 ++--
>  drivers/net/iavf/iavf_vchnl.c                    |  4 ++--
>  drivers/net/mlx5/linux/mlx5_verbs.c              |  2 +-
>  drivers/net/mlx5/mlx5_flow.c                     |  6 +++---
>  drivers/net/mlx5/mlx5_flow_dv.c                  |  4 ++--
>  drivers/net/mlx5/mlx5_flow_flex.c                |  6 +++---
>  drivers/net/mlx5/mlx5_flow_hw.c                  | 10 +++++-----
>  drivers/net/mlx5/mlx5_flow_meter.c               | 20 ++++++++++----------
>  drivers/net/mlx5/mlx5_rx.h                       |  2 +-
>  drivers/net/octeontx/octeontx_ethdev.c           |  2 +-
>  drivers/net/virtio/virtio_user/virtio_user_dev.c |  2 +-
>  examples/vhost/main.c                            | 12 ++++++------
>  examples/vhost/virtio_net.c                      |  4 ++--
>  lib/bbdev/rte_bbdev.c                            |  2 +-
>  lib/distributor/rte_distributor.c                |  2 +-
>  lib/eal/common/eal_common_trace.c                |  8 ++++----
>  lib/eal/common/rte_service.c                     |  8 ++++----
>  lib/eal/ppc/include/rte_atomic.h                 | 16 ++++++++--------
>  lib/stack/rte_stack_lf_c11.h                     |  2 +-
>  lib/telemetry/telemetry.c                        |  6 +++---
>  lib/vhost/virtio_net.c                           |  6 +++---
>  37 files changed, 109 insertions(+), 109 deletions(-)

The changes are systematic and lgtm.
Series applied, thanks Tyler.

-- 
David Marchand


^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2023-04-25  9:10 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-02  0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
2023-03-02  0:47 ` [PATCH 01/17] vhost: use previous value atomic fetch operations Tyler Retzlaff
2023-03-02 14:47   ` Maxime Coquelin
2023-03-02  0:47 ` [PATCH 02/17] telemetry: " Tyler Retzlaff
2023-03-02  9:34   ` Bruce Richardson
2023-03-02  0:47 ` [PATCH 03/17] stack: " Tyler Retzlaff
2023-03-02  0:47 ` [PATCH 04/17] eal: " Tyler Retzlaff
2023-03-02  0:47 ` [PATCH 05/17] distributor: " Tyler Retzlaff
2023-03-02  0:47 ` [PATCH 06/17] bbdev: " Tyler Retzlaff
2023-03-02  0:47 ` [PATCH 07/17] examples/vhost: " Tyler Retzlaff
2023-03-02 14:47   ` Maxime Coquelin
2023-03-02  0:47 ` [PATCH 08/17] net/virtio: " Tyler Retzlaff
2023-03-02 14:48   ` Maxime Coquelin
2023-03-02  0:47 ` [PATCH 09/17] net/octeontx: " Tyler Retzlaff
2023-03-02  0:47 ` [PATCH 10/17] net/mlx5: " Tyler Retzlaff
2023-03-02  0:47 ` [PATCH 11/17] net/iavf: " Tyler Retzlaff
2023-03-02  9:28   ` Ruifeng Wang
2023-03-02 15:50     ` Tyler Retzlaff
2023-03-02  0:47 ` [PATCH 12/17] net/cxgbe: " Tyler Retzlaff
2023-03-02  0:47 ` [PATCH 13/17] drivers/event: " Tyler Retzlaff
2023-03-02  0:47 ` [PATCH 14/17] dma/skeleton: " Tyler Retzlaff
2023-03-02  0:47 ` [PATCH 15/17] drivers/common: " Tyler Retzlaff
2023-03-02  0:47 ` [PATCH 16/17] app/test: " Tyler Retzlaff
2023-03-02  0:47 ` [PATCH 17/17] test-eventdev: " Tyler Retzlaff
2023-03-02 14:40 ` [PATCH 00/17] use __atomic operations returning previous value Morten Brørup
2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
2023-03-02 16:18   ` [PATCH v2 01/17] vhost: use previous value atomic fetch operations Tyler Retzlaff
2023-03-02 16:18   ` [PATCH v2 02/17] telemetry: " Tyler Retzlaff
2023-03-02 16:18   ` [PATCH v2 03/17] stack: " Tyler Retzlaff
2023-03-02 16:18   ` [PATCH v2 04/17] eal: " Tyler Retzlaff
2023-03-02 16:18   ` [PATCH v2 05/17] distributor: " Tyler Retzlaff
2023-03-02 16:18   ` [PATCH v2 06/17] bbdev: " Tyler Retzlaff
2023-03-02 16:18   ` [PATCH v2 07/17] examples/vhost: " Tyler Retzlaff
2023-03-02 16:18   ` [PATCH v2 08/17] net/virtio: " Tyler Retzlaff
2023-03-02 16:18   ` [PATCH v2 09/17] net/octeontx: " Tyler Retzlaff
2023-03-02 16:18   ` [PATCH v2 10/17] net/mlx5: " Tyler Retzlaff
2023-03-02 16:18   ` [PATCH v2 11/17] net/iavf: " Tyler Retzlaff
2023-03-02 16:18   ` [PATCH v2 12/17] net/cxgbe: " Tyler Retzlaff
2023-03-02 16:18   ` [PATCH v2 13/17] drivers/event: " Tyler Retzlaff
2023-03-13  7:02     ` [EXT] " Pavan Nikhilesh Bhagavatula
2023-03-02 16:18   ` [PATCH v2 14/17] dma/skeleton: " Tyler Retzlaff
2023-03-02 16:18   ` [PATCH v2 15/17] drivers/common: " Tyler Retzlaff
2023-03-02 16:18   ` [PATCH v2 16/17] app/test: " Tyler Retzlaff
2023-03-02 16:18   ` [PATCH v2 17/17] test-eventdev: " Tyler Retzlaff
2023-03-03  1:54   ` [PATCH v2 00/17] use __atomic operations returning previous value Ruifeng Wang
2023-03-03  2:33   ` fengchengwen
2023-04-25  9:10   ` David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).