[PATCH] net/ixgbe: fix inverted test and set conditional

Tyler Retzlaff roretzla at linux.microsoft.com
Thu Jun 15 21:30:02 CEST 2023


Correct a mistake when converting ixgbe to use __atomic_test_and_set
instead of rte_atomic32_test_and_set. The return value from
__atomic_test_and_set is inverted relative to rte_atomic32_test_and_set.

Fixes: e90baf6b82f6 ("net/ixgbe: replace legacy atomics with GCC builtin atomics")
Cc: roretzla at linux.microsoft.com
Cc: david.marchand at redhat.com
Cc: qiming.yang at intel.com

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

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 43aea2e..5f73ae8 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4322,7 +4322,7 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
 		if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) {
 			ixgbe_dev_wait_setup_link_complete(dev, 0);
 			/* NOTE: review for potential ordering optimization */
-			if (__atomic_test_and_set(&ad->link_thread_running, __ATOMIC_SEQ_CST)) {
+			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.
-- 
1.8.3.1



More information about the dev mailing list