From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 556B442C12; Fri, 2 Jun 2023 21:45:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 736B0427F2; Fri, 2 Jun 2023 21:45:15 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 30C47410D0 for ; Fri, 2 Jun 2023 21:45:13 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 7547C20A1F67; Fri, 2 Jun 2023 12:45:12 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7547C20A1F67 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1685735112; bh=U9SoOMzdPJKpxS3RhAELS42cWRroJ261SrLCDIon5ws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PLq6ypYHT6aCmOhtDnL0IRBDIm0GuWr9g6ln/YGEul1PaNiSiTQDmbLGGYWYrGiek IJ/Cyd7YmvIJedDftpLR2wfI1k0gyOzlBfY/iMGpNiCbC25RtEStZBG3eWHPSQWZDK /L6SE923CGwGy/APioI9uKAYY7DN3Cn312idUpfU= From: Tyler Retzlaff To: dev@dpdk.org, david.marchand@redhat.com Cc: Olivier Matz , Bruce Richardson , Kevin Laatz , Qiming Yang , Qi Zhang , Wenjun Wu , Tetsuya Mukawa , Honnappa.Nagarahalli@arm.com, thomas@monjalon.net, Tyler Retzlaff Subject: [PATCH v4 3/6] net/ice: replace rte atomics with GCC builtin atomics Date: Fri, 2 Jun 2023 12:45:04 -0700 Message-Id: <1685735107-19208-4-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1685735107-19208-1-git-send-email-roretzla@linux.microsoft.com> References: <1679084388-19267-1-git-send-email-roretzla@linux.microsoft.com> <1685735107-19208-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 rte_atomic.h types and functions, instead use GCC supplied C++11 memory model builtins. Signed-off-by: Tyler Retzlaff Acked-by: Morten Brørup --- drivers/net/ice/ice_dcf.c | 1 - drivers/net/ice/ice_dcf_ethdev.c | 1 - drivers/net/ice/ice_ethdev.c | 12 ++++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index 1c3d22a..80d2cbd 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -14,7 +14,6 @@ #include #include -#include #include #include #include diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index dcbf2af..13ff245 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 9a88cf9..a04fca8 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -3927,8 +3927,10 @@ static int ice_init_rss(struct ice_pf *pf) struct rte_eth_link *dst = link; struct rte_eth_link *src = &dev->data->dev_link; - if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst, - *(uint64_t *)src) == 0) + /* NOTE: review for potential ordering optimization */ + if (!__atomic_compare_exchange_n((uint64_t *)dst, + (uint64_t *)dst, *(uint64_t *)src, 0, + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) return -1; return 0; @@ -3941,8 +3943,10 @@ static int ice_init_rss(struct ice_pf *pf) struct rte_eth_link *dst = &dev->data->dev_link; struct rte_eth_link *src = link; - if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst, - *(uint64_t *)src) == 0) + /* NOTE: review for potential ordering optimization */ + if (!__atomic_compare_exchange_n((uint64_t *)dst, + (uint64_t *)dst, *(uint64_t *)src, 0, + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) return -1; return 0; -- 1.8.3.1