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 1363241EC0; Fri, 17 Mar 2023 21:19:58 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3D94C42FE8; Fri, 17 Mar 2023 21:19:53 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 309F842FD8 for ; Fri, 17 Mar 2023 21:19:50 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 79BAE20C343B; Fri, 17 Mar 2023 13:19:49 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 79BAE20C343B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1679084389; bh=TncISP8eKNJJGxUi4IBsWmofhtlNfnIaHVbz1n29JN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mBpguMzHk8nUSvokWCFfJITh++0weVslMEKmx3MLrMDJ0QpgtMbA4j9ne9rDAMYBv tiv2ydtooca1kjeVgSSX1nQm61EefXZVsdYZcluonu/APSrLTW16O6ugXqE9CAmBZG GMgCdK9cHYkEAZiKjtUx2CiSPSD9+sJlWFTPPyU8= From: Tyler Retzlaff To: dev@dpdk.org Cc: Honnappa.Nagarahalli@arm.com, Ruifeng.Wang@arm.com, thomas@monjalon.net, Tyler Retzlaff Subject: [PATCH 1/7] ring: replace rte atomics with GCC builtin atomics Date: Fri, 17 Mar 2023 13:19:42 -0700 Message-Id: <1679084388-19267-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1679084388-19267-1-git-send-email-roretzla@linux.microsoft.com> References: <1679084388-19267-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 rte_atomic.h types and functions, instead use GCC supplied C++11 memory model builtins. Signed-off-by: Tyler Retzlaff --- lib/ring/rte_ring_core.h | 1 - lib/ring/rte_ring_generic_pvt.h | 10 ++++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/ring/rte_ring_core.h b/lib/ring/rte_ring_core.h index 82b2370..b9c7860 100644 --- a/lib/ring/rte_ring_core.h +++ b/lib/ring/rte_ring_core.h @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/ring/rte_ring_generic_pvt.h b/lib/ring/rte_ring_generic_pvt.h index 5acb6e5..f9a15b6 100644 --- a/lib/ring/rte_ring_generic_pvt.h +++ b/lib/ring/rte_ring_generic_pvt.h @@ -92,8 +92,9 @@ if (is_sp) r->prod.head = *new_head, success = 1; else - success = rte_atomic32_cmpset(&r->prod.head, - *old_head, *new_head); + success = __atomic_compare_exchange_n(&r->prod.head, + old_head, *new_head, 0, + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); } while (unlikely(success == 0)); return n; } @@ -162,8 +163,9 @@ rte_smp_rmb(); success = 1; } else { - success = rte_atomic32_cmpset(&r->cons.head, *old_head, - *new_head); + success = __atomic_compare_exchange_n(&r->cons.head, + old_head, *new_head, 0, + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); } } while (unlikely(success == 0)); return n; -- 1.8.3.1