From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: Honnappa.Nagarahalli@arm.com, Ruifeng.Wang@arm.com,
thomas@monjalon.net, stephen@networkplumber.org,
mb@smartsharesystems.com,
Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH v3 5/7] net/ixgbe: replace rte atomics with GCC builtin atomics
Date: Thu, 23 Mar 2023 15:53:54 -0700 [thread overview]
Message-ID: <1679612036-30773-6-git-send-email-roretzla@linux.microsoft.com> (raw)
In-Reply-To: <1679612036-30773-1-git-send-email-roretzla@linux.microsoft.com>
Replace the use of rte_atomic.h types and functions, instead use GCC
supplied C++11 memory model builtins.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
drivers/net/ixgbe/ixgbe_bypass.c | 1 -
drivers/net/ixgbe/ixgbe_ethdev.c | 18 ++++++++++++------
drivers/net/ixgbe/ixgbe_ethdev.h | 3 ++-
drivers/net/ixgbe/ixgbe_flow.c | 1 -
drivers/net/ixgbe/ixgbe_rxtx.c | 1 -
5 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_bypass.c b/drivers/net/ixgbe/ixgbe_bypass.c
index 94f34a2..f615d18 100644
--- a/drivers/net/ixgbe/ixgbe_bypass.c
+++ b/drivers/net/ixgbe/ixgbe_bypass.c
@@ -3,7 +3,6 @@
*/
#include <time.h>
-#include <rte_atomic.h>
#include <ethdev_driver.h>
#include "ixgbe_ethdev.h"
#include "ixgbe_bypass_api.h"
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 88118bc..4bb85af 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1127,7 +1127,8 @@ struct rte_ixgbe_xstats_name_off {
return 0;
}
- rte_atomic32_clear(&ad->link_thread_running);
+ /* NOTE: review for potential ordering optimization */
+ __atomic_clear(&ad->link_thread_running, __ATOMIC_SEQ_CST);
ixgbe_parse_devargs(eth_dev->data->dev_private,
pci_dev->device.devargs);
rte_eth_copy_pci_info(eth_dev, pci_dev);
@@ -1625,7 +1626,8 @@ static int ixgbe_l2_tn_filter_init(struct rte_eth_dev *eth_dev)
return 0;
}
- rte_atomic32_clear(&ad->link_thread_running);
+ /* NOTE: review for potential ordering optimization */
+ __atomic_clear(&ad->link_thread_running, __ATOMIC_SEQ_CST);
ixgbevf_parse_devargs(eth_dev->data->dev_private,
pci_dev->device.devargs);
@@ -4186,7 +4188,8 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
struct ixgbe_adapter *ad = dev->data->dev_private;
uint32_t timeout = timeout_ms ? timeout_ms : WARNING_TIMEOUT;
- while (rte_atomic32_read(&ad->link_thread_running)) {
+ /* NOTE: review for potential ordering optimization */
+ while (__atomic_load_n(&ad->link_thread_running, __ATOMIC_SEQ_CST)) {
msec_delay(1);
timeout--;
@@ -4222,7 +4225,8 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
ixgbe_setup_link(hw, speed, true);
intr->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG;
- rte_atomic32_clear(&ad->link_thread_running);
+ /* NOTE: review for potential ordering optimization */
+ __atomic_clear(&ad->link_thread_running, __ATOMIC_SEQ_CST);
return NULL;
}
@@ -4317,7 +4321,8 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
if (link_up == 0) {
if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) {
ixgbe_dev_wait_setup_link_complete(dev, 0);
- if (rte_atomic32_test_and_set(&ad->link_thread_running)) {
+ /* NOTE: review for potential ordering optimization */
+ if (__atomic_test_and_set(&ad->link_thread_running, __ATOMIC_SEQ_CST)) {
/* To avoid race condition between threads, set
* the IXGBE_FLAG_NEED_LINK_CONFIG flag only
* when there is no link thread running.
@@ -4330,7 +4335,8 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
dev) < 0) {
PMD_DRV_LOG(ERR,
"Create link thread failed!");
- rte_atomic32_clear(&ad->link_thread_running);
+ /* NOTE: review for potential ordering optimization */
+ __atomic_clear(&ad->link_thread_running, __ATOMIC_SEQ_CST);
}
} else {
PMD_DRV_LOG(ERR,
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index 48290af..2ca6998 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -6,6 +6,7 @@
#define _IXGBE_ETHDEV_H_
#include <stdint.h>
+#include <stdbool.h>
#include <sys/queue.h>
#include "base/ixgbe_type.h"
@@ -510,7 +511,7 @@ struct ixgbe_adapter {
*/
uint8_t pflink_fullchk;
uint8_t mac_ctrl_frame_fwd;
- rte_atomic32_t link_thread_running;
+ bool link_thread_running;
pthread_t link_thread_tid;
};
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index eac81ee..687341c 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -18,7 +18,6 @@
#include <rte_log.h>
#include <rte_debug.h>
#include <rte_pci.h>
-#include <rte_atomic.h>
#include <rte_branch_prediction.h>
#include <rte_memory.h>
#include <rte_eal.h>
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index c9d6ca9..8d7251d 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -27,7 +27,6 @@
#include <rte_eal.h>
#include <rte_per_lcore.h>
#include <rte_lcore.h>
-#include <rte_atomic.h>
#include <rte_branch_prediction.h>
#include <rte_mempool.h>
#include <rte_malloc.h>
--
1.8.3.1
next prev parent reply other threads:[~2023-03-23 22:54 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-17 20:19 [PATCH 0/7] " Tyler Retzlaff
2023-03-17 20:19 ` [PATCH 1/7] ring: " Tyler Retzlaff
2023-03-17 20:36 ` Tyler Retzlaff
2023-03-17 20:19 ` [PATCH 2/7] stack: " Tyler Retzlaff
2023-03-17 20:19 ` [PATCH 3/7] dma/idxd: " Tyler Retzlaff
2023-03-17 20:19 ` [PATCH 4/7] net/ice: " Tyler Retzlaff
2023-03-17 20:41 ` Tyler Retzlaff
2023-03-17 20:19 ` [PATCH 5/7] net/ixgbe: " Tyler Retzlaff
2023-03-17 20:19 ` [PATCH 6/7] net/null: " Tyler Retzlaff
2023-03-17 20:44 ` Tyler Retzlaff
2023-03-17 20:19 ` [PATCH 7/7] net/ring: " Tyler Retzlaff
2023-03-17 21:42 ` [PATCH 0/7] " Stephen Hemminger
2023-03-17 21:49 ` Tyler Retzlaff
2023-03-22 11:28 ` Morten Brørup
2023-03-22 14:21 ` Tyler Retzlaff
2023-03-22 14:58 ` Morten Brørup
2023-03-22 15:29 ` Tyler Retzlaff
2023-03-22 16:13 ` Morten Brørup
2023-03-22 16:40 ` Honnappa Nagarahalli
2023-03-22 17:07 ` Morten Brørup
2023-03-22 17:38 ` Honnappa Nagarahalli
2023-03-22 18:06 ` Tyler Retzlaff
2023-05-02 3:37 ` Tyler Retzlaff
2023-05-02 4:31 ` Honnappa Nagarahalli
2023-03-23 22:34 ` [PATCH v2 " Tyler Retzlaff
2023-03-23 22:34 ` [PATCH v2 1/7] ring: " Tyler Retzlaff
2023-03-23 22:34 ` [PATCH v2 2/7] stack: " Tyler Retzlaff
2023-03-23 22:34 ` [PATCH v2 3/7] dma/idxd: " Tyler Retzlaff
2023-03-23 22:34 ` [PATCH v2 4/7] net/ice: " Tyler Retzlaff
2023-03-23 22:34 ` [PATCH v2 5/7] net/ixgbe: " Tyler Retzlaff
2023-03-23 22:34 ` [PATCH v2 6/7] net/null: " Tyler Retzlaff
2023-03-23 22:34 ` [PATCH v2 7/7] net/ring: " Tyler Retzlaff
2023-03-24 7:07 ` [PATCH v2 0/7] " Morten Brørup
2023-03-23 22:53 ` [PATCH v3 " Tyler Retzlaff
2023-03-23 22:53 ` [PATCH v3 1/7] ring: " Tyler Retzlaff
2023-03-23 22:53 ` [PATCH v3 2/7] stack: " Tyler Retzlaff
2023-05-24 20:08 ` David Marchand
2023-03-23 22:53 ` [PATCH v3 3/7] dma/idxd: " Tyler Retzlaff
2023-05-24 20:09 ` David Marchand
2023-05-25 8:41 ` Bruce Richardson
2023-05-25 13:59 ` Morten Brørup
2023-05-25 12:57 ` Kevin Laatz
2023-03-23 22:53 ` [PATCH v3 4/7] net/ice: " Tyler Retzlaff
2023-05-24 20:10 ` David Marchand
2023-03-23 22:53 ` Tyler Retzlaff [this message]
2023-05-24 20:11 ` [PATCH v3 5/7] net/ixgbe: " David Marchand
2023-03-23 22:53 ` [PATCH v3 6/7] net/null: " Tyler Retzlaff
2023-05-24 20:13 ` David Marchand
2023-03-23 22:53 ` [PATCH v3 7/7] net/ring: " Tyler Retzlaff
2023-05-24 20:12 ` David Marchand
2023-05-25 8:44 ` Bruce Richardson
2023-03-24 7:09 ` [PATCH v3 0/7] " Morten Brørup
2023-03-24 19:22 ` Tyler Retzlaff
2023-05-24 12:40 ` David Marchand
2023-05-24 15:47 ` Tyler Retzlaff
2023-05-24 20:06 ` David Marchand
2023-05-24 22:50 ` Tyler Retzlaff
2023-05-24 22:56 ` Honnappa Nagarahalli
2023-05-25 0:02 ` Tyler Retzlaff
2023-05-25 7:50 ` Morten Brørup
2023-06-02 19:45 ` [PATCH v4 0/6] " Tyler Retzlaff
2023-06-02 19:45 ` [PATCH v4 1/6] stack: " Tyler Retzlaff
2023-06-02 19:45 ` [PATCH v4 2/6] dma/idxd: " Tyler Retzlaff
2023-06-02 19:45 ` [PATCH v4 3/6] net/ice: " Tyler Retzlaff
2023-06-02 19:45 ` [PATCH v4 4/6] net/ixgbe: " Tyler Retzlaff
2023-06-02 19:45 ` [PATCH v4 5/6] net/null: " Tyler Retzlaff
2023-06-02 19:45 ` [PATCH v4 6/6] net/ring: " Tyler Retzlaff
2023-06-05 8:27 ` Olivier Matz
2023-06-06 21:45 ` [PATCH v5 0/6] " Tyler Retzlaff
2023-06-06 21:45 ` [PATCH v5 1/6] stack: " Tyler Retzlaff
2023-06-06 21:45 ` [PATCH v5 2/6] dma/idxd: " Tyler Retzlaff
2023-06-06 21:45 ` [PATCH v5 3/6] net/ice: " Tyler Retzlaff
2023-06-06 21:45 ` [PATCH v5 4/6] net/ixgbe: " Tyler Retzlaff
2023-06-06 21:45 ` [PATCH v5 5/6] net/null: " Tyler Retzlaff
2023-06-06 21:45 ` [PATCH v5 6/6] net/ring: " Tyler Retzlaff
2023-06-09 15:01 ` [PATCH v5 0/6] " David Marchand
2023-06-09 15:13 ` Tyler Retzlaff
2023-06-22 19:59 ` Patrick Robb
2023-06-23 8:53 ` David Marchand
2023-06-23 21:37 ` Tyler Retzlaff
2023-06-28 14:01 ` Patrick Robb
2023-06-28 14:49 ` David Marchand
2023-06-23 21:35 ` Tyler Retzlaff
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=1679612036-30773-6-git-send-email-roretzla@linux.microsoft.com \
--to=roretzla@linux.microsoft.com \
--cc=Honnappa.Nagarahalli@arm.com \
--cc=Ruifeng.Wang@arm.com \
--cc=dev@dpdk.org \
--cc=mb@smartsharesystems.com \
--cc=stephen@networkplumber.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).