From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: techboard@dpdk.org,
"Bruce Richardson" <bruce.richardson@intel.com>,
"Honnappa Nagarahalli" <honnappa.nagarahalli@arm.com>,
"Ruifeng Wang" <ruifeng.wang@arm.com>,
"Jerin Jacob" <jerinj@marvell.com>,
"Sunil Kumar Kori" <skori@marvell.com>,
"Mattias Rönnblom" <mattias.ronnblom@ericsson.com>,
"Joyce Kong" <joyce.kong@arm.com>,
"David Christensen" <drc@linux.vnet.ibm.com>,
"Konstantin Ananyev" <konstantin.v.ananyev@yandex.ru>,
"David Hunt" <david.hunt@intel.com>,
"Thomas Monjalon" <thomas@monjalon.net>,
"David Marchand" <david.marchand@redhat.com>,
"Tyler Retzlaff" <roretzla@linux.microsoft.com>
Subject: [PATCH v2 4/6] distributor: adapt for EAL optional atomics API changes
Date: Fri, 11 Aug 2023 10:32:14 -0700 [thread overview]
Message-ID: <1691775136-6460-5-git-send-email-roretzla@linux.microsoft.com> (raw)
In-Reply-To: <1691775136-6460-1-git-send-email-roretzla@linux.microsoft.com>
Adapt distributor for EAL optional atomics API changes
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
lib/distributor/distributor_private.h | 2 +-
lib/distributor/rte_distributor_single.c | 44 ++++++++++++++++----------------
2 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/lib/distributor/distributor_private.h b/lib/distributor/distributor_private.h
index 7101f63..ffbdae5 100644
--- a/lib/distributor/distributor_private.h
+++ b/lib/distributor/distributor_private.h
@@ -52,7 +52,7 @@
* Only 64-bits of the memory is actually used though.
*/
union rte_distributor_buffer_single {
- volatile int64_t bufptr64;
+ volatile int64_t __rte_atomic bufptr64;
char pad[RTE_CACHE_LINE_SIZE*3];
} __rte_cache_aligned;
diff --git a/lib/distributor/rte_distributor_single.c b/lib/distributor/rte_distributor_single.c
index 2c77ac4..ad43c13 100644
--- a/lib/distributor/rte_distributor_single.c
+++ b/lib/distributor/rte_distributor_single.c
@@ -32,10 +32,10 @@
int64_t req = (((int64_t)(uintptr_t)oldpkt) << RTE_DISTRIB_FLAG_BITS)
| RTE_DISTRIB_GET_BUF;
RTE_WAIT_UNTIL_MASKED(&buf->bufptr64, RTE_DISTRIB_FLAGS_MASK,
- ==, 0, __ATOMIC_RELAXED);
+ ==, 0, rte_memory_order_relaxed);
/* Sync with distributor on GET_BUF flag. */
- __atomic_store_n(&(buf->bufptr64), req, __ATOMIC_RELEASE);
+ rte_atomic_store_explicit(&buf->bufptr64, req, rte_memory_order_release);
}
struct rte_mbuf *
@@ -44,7 +44,7 @@ struct rte_mbuf *
{
union rte_distributor_buffer_single *buf = &d->bufs[worker_id];
/* Sync with distributor. Acquire bufptr64. */
- if (__atomic_load_n(&buf->bufptr64, __ATOMIC_ACQUIRE)
+ if (rte_atomic_load_explicit(&buf->bufptr64, rte_memory_order_acquire)
& RTE_DISTRIB_GET_BUF)
return NULL;
@@ -72,10 +72,10 @@ struct rte_mbuf *
uint64_t req = (((int64_t)(uintptr_t)oldpkt) << RTE_DISTRIB_FLAG_BITS)
| RTE_DISTRIB_RETURN_BUF;
RTE_WAIT_UNTIL_MASKED(&buf->bufptr64, RTE_DISTRIB_FLAGS_MASK,
- ==, 0, __ATOMIC_RELAXED);
+ ==, 0, rte_memory_order_relaxed);
/* Sync with distributor on RETURN_BUF flag. */
- __atomic_store_n(&(buf->bufptr64), req, __ATOMIC_RELEASE);
+ rte_atomic_store_explicit(&buf->bufptr64, req, rte_memory_order_release);
return 0;
}
@@ -119,7 +119,7 @@ struct rte_mbuf *
d->in_flight_tags[wkr] = 0;
d->in_flight_bitmask &= ~(1UL << wkr);
/* Sync with worker. Release bufptr64. */
- __atomic_store_n(&(d->bufs[wkr].bufptr64), 0, __ATOMIC_RELEASE);
+ rte_atomic_store_explicit(&d->bufs[wkr].bufptr64, 0, rte_memory_order_release);
if (unlikely(d->backlog[wkr].count != 0)) {
/* On return of a packet, we need to move the
* queued packets for this core elsewhere.
@@ -165,21 +165,21 @@ struct rte_mbuf *
for (wkr = 0; wkr < d->num_workers; wkr++) {
uintptr_t oldbuf = 0;
/* Sync with worker. Acquire bufptr64. */
- const int64_t data = __atomic_load_n(&(d->bufs[wkr].bufptr64),
- __ATOMIC_ACQUIRE);
+ const int64_t data = rte_atomic_load_explicit(&d->bufs[wkr].bufptr64,
+ rte_memory_order_acquire);
if (data & RTE_DISTRIB_GET_BUF) {
flushed++;
if (d->backlog[wkr].count)
/* Sync with worker. Release bufptr64. */
- __atomic_store_n(&(d->bufs[wkr].bufptr64),
+ rte_atomic_store_explicit(&d->bufs[wkr].bufptr64,
backlog_pop(&d->backlog[wkr]),
- __ATOMIC_RELEASE);
+ rte_memory_order_release);
else {
/* Sync with worker on GET_BUF flag. */
- __atomic_store_n(&(d->bufs[wkr].bufptr64),
+ rte_atomic_store_explicit(&d->bufs[wkr].bufptr64,
RTE_DISTRIB_GET_BUF,
- __ATOMIC_RELEASE);
+ rte_memory_order_release);
d->in_flight_tags[wkr] = 0;
d->in_flight_bitmask &= ~(1UL << wkr);
}
@@ -217,8 +217,8 @@ struct rte_mbuf *
while (next_idx < num_mbufs || next_mb != NULL) {
uintptr_t oldbuf = 0;
/* Sync with worker. Acquire bufptr64. */
- int64_t data = __atomic_load_n(&(d->bufs[wkr].bufptr64),
- __ATOMIC_ACQUIRE);
+ int64_t data = rte_atomic_load_explicit(&(d->bufs[wkr].bufptr64),
+ rte_memory_order_acquire);
if (!next_mb) {
next_mb = mbufs[next_idx++];
@@ -264,15 +264,15 @@ struct rte_mbuf *
if (d->backlog[wkr].count)
/* Sync with worker. Release bufptr64. */
- __atomic_store_n(&(d->bufs[wkr].bufptr64),
+ rte_atomic_store_explicit(&d->bufs[wkr].bufptr64,
backlog_pop(&d->backlog[wkr]),
- __ATOMIC_RELEASE);
+ rte_memory_order_release);
else {
/* Sync with worker. Release bufptr64. */
- __atomic_store_n(&(d->bufs[wkr].bufptr64),
+ rte_atomic_store_explicit(&d->bufs[wkr].bufptr64,
next_value,
- __ATOMIC_RELEASE);
+ rte_memory_order_release);
d->in_flight_tags[wkr] = new_tag;
d->in_flight_bitmask |= (1UL << wkr);
next_mb = NULL;
@@ -294,8 +294,8 @@ struct rte_mbuf *
for (wkr = 0; wkr < d->num_workers; wkr++)
if (d->backlog[wkr].count &&
/* Sync with worker. Acquire bufptr64. */
- (__atomic_load_n(&(d->bufs[wkr].bufptr64),
- __ATOMIC_ACQUIRE) & RTE_DISTRIB_GET_BUF)) {
+ (rte_atomic_load_explicit(&d->bufs[wkr].bufptr64,
+ rte_memory_order_acquire) & RTE_DISTRIB_GET_BUF)) {
int64_t oldbuf = d->bufs[wkr].bufptr64 >>
RTE_DISTRIB_FLAG_BITS;
@@ -303,9 +303,9 @@ struct rte_mbuf *
store_return(oldbuf, d, &ret_start, &ret_count);
/* Sync with worker. Release bufptr64. */
- __atomic_store_n(&(d->bufs[wkr].bufptr64),
+ rte_atomic_store_explicit(&d->bufs[wkr].bufptr64,
backlog_pop(&d->backlog[wkr]),
- __ATOMIC_RELEASE);
+ rte_memory_order_release);
}
d->returns.start = ret_start;
--
1.8.3.1
next prev parent reply other threads:[~2023-08-11 17:32 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-11 1:31 [PATCH 0/6] RFC optional rte optional stdatomics API Tyler Retzlaff
2023-08-11 1:31 ` [PATCH 1/6] eal: provide rte stdatomics optional atomics API Tyler Retzlaff
2023-08-11 8:56 ` Bruce Richardson
2023-08-11 9:42 ` Morten Brørup
2023-08-11 15:54 ` Tyler Retzlaff
2023-08-14 9:04 ` Morten Brørup
2023-08-11 1:31 ` [PATCH 2/6] eal: adapt EAL to present rte " Tyler Retzlaff
2023-08-11 1:31 ` [PATCH 3/6] eal: add rte atomic qualifier with casts Tyler Retzlaff
2023-08-11 1:31 ` [PATCH 4/6] distributor: adapt for EAL optional atomics API changes Tyler Retzlaff
2023-08-11 1:32 ` [PATCH 5/6] bpf: " Tyler Retzlaff
2023-08-11 1:32 ` [PATCH 6/6] devtools: forbid new direct use of GCC atomic builtins Tyler Retzlaff
2023-08-11 8:57 ` Bruce Richardson
2023-08-11 9:51 ` Morten Brørup
2023-08-11 15:56 ` Tyler Retzlaff
2023-08-14 6:37 ` Morten Brørup
2023-08-11 17:32 ` [PATCH v2 0/6] RFC optional rte optional stdatomics API Tyler Retzlaff
2023-08-11 17:32 ` [PATCH v2 1/6] eal: provide rte stdatomics optional atomics API Tyler Retzlaff
2023-08-14 7:06 ` Morten Brørup
2023-08-11 17:32 ` [PATCH v2 2/6] eal: adapt EAL to present rte " Tyler Retzlaff
2023-08-14 8:00 ` Morten Brørup
2023-08-14 17:47 ` Tyler Retzlaff
2023-08-16 20:13 ` Morten Brørup
2023-08-16 20:32 ` Tyler Retzlaff
2023-08-11 17:32 ` [PATCH v2 3/6] eal: add rte atomic qualifier with casts Tyler Retzlaff
2023-08-14 8:05 ` Morten Brørup
2023-08-11 17:32 ` Tyler Retzlaff [this message]
2023-08-14 8:07 ` [PATCH v2 4/6] distributor: adapt for EAL optional atomics API changes Morten Brørup
2023-08-11 17:32 ` [PATCH v2 5/6] bpf: " Tyler Retzlaff
2023-08-14 8:11 ` Morten Brørup
2023-08-11 17:32 ` [PATCH v2 6/6] devtools: forbid new direct use of GCC atomic builtins Tyler Retzlaff
2023-08-14 8:12 ` Morten Brørup
2023-08-16 19:19 ` [PATCH v3 0/6] RFC optional rte optional stdatomics API Tyler Retzlaff
2023-08-16 19:19 ` [PATCH v3 1/6] eal: provide rte stdatomics optional atomics API Tyler Retzlaff
2023-08-16 20:55 ` Morten Brørup
2023-08-16 21:04 ` Tyler Retzlaff
2023-08-16 21:08 ` Morten Brørup
2023-08-16 21:10 ` Tyler Retzlaff
2023-08-16 19:19 ` [PATCH v3 2/6] eal: adapt EAL to present rte " Tyler Retzlaff
2023-08-16 19:19 ` [PATCH v3 3/6] eal: add rte atomic qualifier with casts Tyler Retzlaff
2023-08-16 19:19 ` [PATCH v3 4/6] distributor: adapt for EAL optional atomics API changes Tyler Retzlaff
2023-08-16 19:19 ` [PATCH v3 5/6] bpf: " Tyler Retzlaff
2023-08-16 19:19 ` [PATCH v3 6/6] devtools: forbid new direct use of GCC atomic builtins Tyler Retzlaff
2023-08-16 21:38 ` [PATCH v4 0/6] RFC optional rte optional stdatomics API Tyler Retzlaff
2023-08-16 21:38 ` [PATCH v4 1/6] eal: provide rte stdatomics optional atomics API Tyler Retzlaff
2023-08-17 11:45 ` Morten Brørup
2023-08-17 19:09 ` Tyler Retzlaff
2023-08-18 6:55 ` Morten Brørup
2023-08-16 21:38 ` [PATCH v4 2/6] eal: adapt EAL to present rte " Tyler Retzlaff
2023-08-16 21:38 ` [PATCH v4 3/6] eal: add rte atomic qualifier with casts Tyler Retzlaff
2023-08-16 21:38 ` [PATCH v4 4/6] distributor: adapt for EAL optional atomics API changes Tyler Retzlaff
2023-08-16 21:38 ` [PATCH v4 5/6] bpf: " Tyler Retzlaff
2023-08-16 21:38 ` [PATCH v4 6/6] devtools: forbid new direct use of GCC atomic builtins Tyler Retzlaff
2023-08-17 11:57 ` Morten Brørup
2023-08-17 19:14 ` Tyler Retzlaff
2023-08-18 7:13 ` Morten Brørup
2023-08-22 18:14 ` Tyler Retzlaff
2023-08-17 21:42 ` [PATCH v5 0/6] optional rte optional stdatomics API Tyler Retzlaff
2023-08-17 21:42 ` [PATCH v5 1/6] eal: provide rte stdatomics optional atomics API Tyler Retzlaff
2023-08-17 21:42 ` [PATCH v5 2/6] eal: adapt EAL to present rte " Tyler Retzlaff
2023-08-17 21:42 ` [PATCH v5 3/6] eal: add rte atomic qualifier with casts Tyler Retzlaff
2023-08-17 21:42 ` [PATCH v5 4/6] distributor: adapt for EAL optional atomics API changes Tyler Retzlaff
2023-08-17 21:42 ` [PATCH v5 5/6] bpf: " Tyler Retzlaff
2023-08-17 21:42 ` [PATCH v5 6/6] devtools: forbid new direct use of GCC atomic builtins Tyler Retzlaff
2023-08-21 22:27 ` [PATCH v5 0/6] optional rte optional stdatomics API Konstantin Ananyev
2023-08-22 21:00 ` [PATCH v6 0/6] rte atomics API for optional stdatomic Tyler Retzlaff
2023-08-22 21:00 ` [PATCH v6 1/6] eal: provide rte stdatomics optional atomics API Tyler Retzlaff
2023-09-28 8:06 ` Thomas Monjalon
2023-09-29 8:04 ` David Marchand
2023-09-29 8:54 ` Morten Brørup
2023-09-29 9:02 ` David Marchand
2023-09-29 9:26 ` Bruce Richardson
2023-09-29 9:34 ` David Marchand
2023-09-29 10:26 ` Thomas Monjalon
2023-09-29 11:38 ` David Marchand
2023-09-29 11:51 ` Thomas Monjalon
2023-08-22 21:00 ` [PATCH v6 2/6] eal: adapt EAL to present rte " Tyler Retzlaff
2023-08-22 21:00 ` [PATCH v6 3/6] eal: add rte atomic qualifier with casts Tyler Retzlaff
2023-08-22 21:00 ` [PATCH v6 4/6] distributor: adapt for EAL optional atomics API changes Tyler Retzlaff
2023-08-22 21:00 ` [PATCH v6 5/6] bpf: " Tyler Retzlaff
2023-08-22 21:00 ` [PATCH v6 6/6] devtools: forbid new direct use of GCC atomic builtins Tyler Retzlaff
2023-08-29 15:57 ` [PATCH v6 0/6] rte atomics API for optional stdatomic Tyler Retzlaff
2023-09-29 14:09 ` David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1691775136-6460-5-git-send-email-roretzla@linux.microsoft.com \
--to=roretzla@linux.microsoft.com \
--cc=bruce.richardson@intel.com \
--cc=david.hunt@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=drc@linux.vnet.ibm.com \
--cc=honnappa.nagarahalli@arm.com \
--cc=jerinj@marvell.com \
--cc=joyce.kong@arm.com \
--cc=konstantin.v.ananyev@yandex.ru \
--cc=mattias.ronnblom@ericsson.com \
--cc=ruifeng.wang@arm.com \
--cc=skori@marvell.com \
--cc=techboard@dpdk.org \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).