From: Phil Yang <phil.yang@arm.com>
To: dev@dpdk.org
Cc: nd@arm.com
Subject: [dpdk-dev] [PATCH] packet_ordering: replace sync builtins with atomic builtins
Date: Thu, 3 Jan 2019 17:49:06 +0800 [thread overview]
Message-ID: <1546508946-12552-1-git-send-email-phil.yang@arm.com> (raw)
'__sync' builtins are deprecated, use '__atomic' builtins instead for
packet_ordering.
Fixes: 850f373 ("examples/packet_ordering: new sample app")
Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
examples/packet_ordering/main.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c
index 149bfdd..61740a9 100644
--- a/examples/packet_ordering/main.c
+++ b/examples/packet_ordering/main.c
@@ -448,7 +448,16 @@ worker_thread(void *args_ptr)
if (unlikely(burst_size == 0))
continue;
+#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION < 70100)
+ /*
+ * '__sync' builtins are deprecated, but '__atomic' ones
+ * are sub-optimized in older GCC versions.
+ */
__sync_fetch_and_add(&app_stats.wkr.dequeue_pkts, burst_size);
+#else
+ __atomic_fetch_add(&app_stats.wkr.dequeue_pkts, burst_size,
+ __ATOMIC_RELAXED);
+#endif
/* just do some operation on mbuf */
for (i = 0; i < burst_size;)
@@ -457,11 +466,29 @@ worker_thread(void *args_ptr)
/* enqueue the modified mbufs to workers_to_tx ring */
ret = rte_ring_enqueue_burst(ring_out, (void *)burst_buffer,
burst_size, NULL);
+#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION < 70100)
+ /*
+ * '__sync' builtins are deprecated, but '__atomic' ones
+ * are sub-optimized in older GCC versions.
+ */
__sync_fetch_and_add(&app_stats.wkr.enqueue_pkts, ret);
+#else
+ __atomic_fetch_add(&app_stats.wkr.enqueue_pkts, ret,
+ __ATOMIC_RELAXED);
+#endif
if (unlikely(ret < burst_size)) {
/* Return the mbufs to their respective pool, dropping packets */
+#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION < 70100)
+ /*
+ * '__sync' builtins are deprecated, but '__atomic' ones
+ * are sub-optimized in older GCC versions.
+ */
__sync_fetch_and_add(&app_stats.wkr.enqueue_failed_pkts,
(int)burst_size - ret);
+#else
+ __atomic_fetch_add(&app_stats.wkr.enqueue_failed_pkts,
+ (int)burst_size - ret, __ATOMIC_RELAXED);
+#endif
pktmbuf_free_bulk(&burst_buffer[ret], burst_size - ret);
}
}
--
2.7.4
next reply other threads:[~2019-01-03 9:49 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-03 9:49 Phil Yang [this message]
2019-03-28 18:42 ` Thomas Monjalon
2019-03-28 18:42 ` Thomas Monjalon
2019-03-29 1:34 ` Phil Yang (Arm Technology China)
2019-03-29 1:34 ` Phil Yang (Arm Technology China)
2019-03-29 10:56 ` [dpdk-dev] [PATCH v2 0/3] example and test cases optimizations Phil Yang
2019-03-29 10:56 ` Phil Yang
2019-03-29 10:56 ` [dpdk-dev] [PATCH v2 1/3] packet_ordering: add statistics for each worker thread Phil Yang
2019-03-29 10:56 ` Phil Yang
2019-03-29 16:39 ` Pattan, Reshma
2019-03-29 16:39 ` Pattan, Reshma
2019-03-30 16:55 ` Phil Yang (Arm Technology China)
2019-03-30 16:55 ` Phil Yang (Arm Technology China)
2019-04-01 12:58 ` Pattan, Reshma
2019-04-01 12:58 ` Pattan, Reshma
2019-04-02 3:33 ` Phil Yang (Arm Technology China)
2019-04-02 3:33 ` Phil Yang (Arm Technology China)
2019-03-29 10:56 ` [dpdk-dev] [PATCH v2 2/3] test/distributor: replace sync builtins with atomic builtins Phil Yang
2019-03-29 10:56 ` Phil Yang
2019-04-01 16:24 ` Honnappa Nagarahalli
2019-04-01 16:24 ` Honnappa Nagarahalli
2019-04-02 3:43 ` Phil Yang (Arm Technology China)
2019-04-02 3:43 ` Phil Yang (Arm Technology China)
2019-03-29 10:56 ` [dpdk-dev] [PATCH v2 3/3] test/ring_perf: " Phil Yang
2019-03-29 10:56 ` Phil Yang
2019-04-01 16:24 ` Honnappa Nagarahalli
2019-04-01 16:24 ` Honnappa Nagarahalli
2019-04-03 6:59 ` [dpdk-dev] [PATCH v3 0/3] example and test cases optimizations Phil Yang
2019-04-03 6:59 ` Phil Yang
2019-04-03 6:59 ` [dpdk-dev] [PATCH v3 1/3] packet_ordering: add statistics for each worker thread Phil Yang
2019-04-03 6:59 ` Phil Yang
2019-04-04 23:24 ` Thomas Monjalon
2019-04-04 23:24 ` Thomas Monjalon
2019-04-08 4:04 ` Phil Yang (Arm Technology China)
2019-04-08 4:04 ` Phil Yang (Arm Technology China)
2019-04-03 6:59 ` [dpdk-dev] [PATCH v3 2/3] test/distributor: replace sync builtins with atomic builtins Phil Yang
2019-04-03 6:59 ` Phil Yang
2019-04-04 15:30 ` Honnappa Nagarahalli
2019-04-04 15:30 ` Honnappa Nagarahalli
2019-04-03 6:59 ` [dpdk-dev] [PATCH v3 3/3] test/ring_perf: " Phil Yang
2019-04-03 6:59 ` Phil Yang
2019-04-08 3:02 ` [dpdk-dev] [PATCH v4 0/3] example and test cases optimizations Phil Yang
2019-04-08 3:02 ` Phil Yang
2019-07-04 20:15 ` Thomas Monjalon
2019-07-05 3:19 ` Phil Yang (Arm Technology China)
2019-07-08 14:38 ` Thomas Monjalon
2019-04-08 3:02 ` [dpdk-dev] [PATCH v4 1/3] packet_ordering: add statistics for each worker thread Phil Yang
2019-04-08 3:02 ` Phil Yang
2019-04-08 3:02 ` [dpdk-dev] [PATCH v4 2/3] test/distributor: replace sync builtins with atomic builtins Phil Yang
2019-04-08 3:02 ` Phil Yang
2019-04-10 14:05 ` Hunt, David
2019-04-10 14:05 ` Hunt, David
2019-04-11 11:31 ` Phil Yang (Arm Technology China)
2019-04-11 11:31 ` Phil Yang (Arm Technology China)
2019-04-08 3:02 ` [dpdk-dev] [PATCH v4 3/3] test/ring_perf: " Phil Yang
2019-04-08 3:02 ` Phil Yang
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=1546508946-12552-1-git-send-email-phil.yang@arm.com \
--to=phil.yang@arm.com \
--cc=dev@dpdk.org \
--cc=nd@arm.com \
/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).