From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB180C25B5F for ; Mon, 6 May 2024 17:58:36 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0FD0C402DD; Mon, 6 May 2024 19:58:31 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 90932402F0 for ; Mon, 6 May 2024 19:58:28 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 7CCE320B2C86; Mon, 6 May 2024 10:58:27 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7CCE320B2C86 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1715018307; bh=SI8n8zyNFpkgqGVaXsnJEqo5Z9gotKJ+TODXosst8x4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cbcsDvHuOKGDax+VMWbjdgzJbRlSzHmva5A7A+C75gc9UygyL+laXQqYRxm3eDsjX 6j/2ZJr/WYT800tCLJaIr3l2T7f2F0G20A6G3nLRrlXZPa8vrm1XcIv6scT33u9q1N 2f1nB7wolXTyufXwRyW0GqRGF6kfDyh1MKgcI+hQ= From: Tyler Retzlaff To: dev@dpdk.org Cc: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Abdullah Sevincer , Ajit Khaparde , Alok Prasad , Anatoly Burakov , Andrew Rybchenko , Anoob Joseph , Bruce Richardson , Byron Marohn , Chenbo Xia , Chengwen Feng , Ciara Loftus , Ciara Power , Dariusz Sosnowski , David Hunt , Devendra Singh Rawat , Erik Gabriel Carrillo , Guoyang Zhou , Harman Kalra , Harry van Haaren , Honnappa Nagarahalli , Jakub Grajciar , Jerin Jacob , Jeroen de Borst , Jian Wang , Jiawen Wu , Jie Hai , Jingjing Wu , Joshua Washington , Joyce Kong , Junfeng Guo , Kevin Laatz , Konstantin Ananyev , Liang Ma , Long Li , Maciej Czekaj , Matan Azrad , Maxime Coquelin , Nicolas Chautru , Ori Kam , Pavan Nikhilesh , Peter Mccarthy , Rahul Lakkireddy , Reshma Pattan , Rosen Xu , Ruifeng Wang , Rushil Gupta , Sameh Gobriel , Sivaprasad Tummala , Somnath Kotur , Stephen Hemminger , Suanming Mou , Sunil Kumar Kori , Sunil Uttarwar , Tetsuya Mukawa , Vamsi Attunuru , Viacheslav Ovsiienko , Vladimir Medvedkin , Xiaoyun Wang , Yipeng Wang , Yisen Zhuang , Ziyang Xuan , Tyler Retzlaff Subject: [PATCH v5 02/45] net/ixgbe: use rte stdatomic API Date: Mon, 6 May 2024 10:57:43 -0700 Message-Id: <1715018306-13741-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1715018306-13741-1-git-send-email-roretzla@linux.microsoft.com> References: <1710967892-7046-1-git-send-email-roretzla@linux.microsoft.com> <1715018306-13741-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Replace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API. Signed-off-by: Tyler Retzlaff Acked-by: Stephen Hemminger --- drivers/net/ixgbe/ixgbe_ethdev.c | 14 ++++++++------ drivers/net/ixgbe/ixgbe_ethdev.h | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index c61c52b..e63ae1a 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1130,7 +1130,7 @@ struct rte_ixgbe_xstats_name_off { } /* NOTE: review for potential ordering optimization */ - __atomic_clear(&ad->link_thread_running, __ATOMIC_SEQ_CST); + rte_atomic_store_explicit(&ad->link_thread_running, 0, rte_memory_order_seq_cst); ixgbe_parse_devargs(eth_dev->data->dev_private, pci_dev->device.devargs); rte_eth_copy_pci_info(eth_dev, pci_dev); @@ -1638,7 +1638,7 @@ static int ixgbe_l2_tn_filter_init(struct rte_eth_dev *eth_dev) } /* NOTE: review for potential ordering optimization */ - __atomic_clear(&ad->link_thread_running, __ATOMIC_SEQ_CST); + rte_atomic_store_explicit(&ad->link_thread_running, 0, rte_memory_order_seq_cst); ixgbevf_parse_devargs(eth_dev->data->dev_private, pci_dev->device.devargs); @@ -4203,7 +4203,7 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev, uint32_t timeout = timeout_ms ? timeout_ms : WARNING_TIMEOUT; /* NOTE: review for potential ordering optimization */ - while (__atomic_load_n(&ad->link_thread_running, __ATOMIC_SEQ_CST)) { + while (rte_atomic_load_explicit(&ad->link_thread_running, rte_memory_order_seq_cst)) { msec_delay(1); timeout--; @@ -4240,7 +4240,7 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev, intr->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG; /* NOTE: review for potential ordering optimization */ - __atomic_clear(&ad->link_thread_running, __ATOMIC_SEQ_CST); + rte_atomic_store_explicit(&ad->link_thread_running, 0, rte_memory_order_seq_cst); return 0; } @@ -4336,7 +4336,8 @@ 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 (!rte_atomic_exchange_explicit(&ad->link_thread_running, 1, + rte_memory_order_seq_cst)) { /* To avoid race condition between threads, set * the IXGBE_FLAG_NEED_LINK_CONFIG flag only * when there is no link thread running. @@ -4348,7 +4349,8 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev, PMD_DRV_LOG(ERR, "Create link thread failed!"); /* NOTE: review for potential ordering optimization */ - __atomic_clear(&ad->link_thread_running, __ATOMIC_SEQ_CST); + rte_atomic_store_explicit(&ad->link_thread_running, 0, + rte_memory_order_seq_cst); } } else { PMD_DRV_LOG(ERR, diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index 22fc3be..8ad841e 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -511,7 +511,7 @@ struct ixgbe_adapter { */ uint8_t pflink_fullchk; uint8_t mac_ctrl_frame_fwd; - bool link_thread_running; + RTE_ATOMIC(bool) link_thread_running; rte_thread_t link_thread_tid; }; diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 3d39eaa..0d42fd8 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -1831,7 +1831,7 @@ const alignas(RTE_CACHE_LINE_SIZE) uint32_t * Use acquire fence to ensure that status_error which includes * DD bit is loaded before loading of other descriptor words. */ - rte_atomic_thread_fence(__ATOMIC_ACQUIRE); + rte_atomic_thread_fence(rte_memory_order_acquire); rxd = *rxdp; @@ -2114,7 +2114,7 @@ const alignas(RTE_CACHE_LINE_SIZE) uint32_t * Use acquire fence to ensure that status_error which includes * DD bit is loaded before loading of other descriptor words. */ - rte_atomic_thread_fence(__ATOMIC_ACQUIRE); + rte_atomic_thread_fence(rte_memory_order_acquire); rxd = *rxdp; -- 1.8.3.1