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 65ED0A0C41; Mon, 2 Aug 2021 12:20:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 523614113E; Mon, 2 Aug 2021 12:20:32 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 3BD2741134 for ; Mon, 2 Aug 2021 12:20:30 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C3D1ED6E; Mon, 2 Aug 2021 03:20:29 -0700 (PDT) Received: from net-arm-n1sdp.shanghai.arm.com (net-arm-n1sdp.shanghai.arm.com [10.169.208.222]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 169763F70D; Mon, 2 Aug 2021 03:20:22 -0700 (PDT) From: Joyce Kong To: thomas@monjalon.net, david.marchand@redhat.com, honnappa.nagarahalli@arm.com, ruifeng.wang@arm.com, konstantin.ananyev@intel.com, rsanford@akamai.com, erik.g.carrillo@intel.com, olivier.matz@6wind.com, yipeng1.wang@intel.com, sameh.gobriel@intel.com, bruce.richardson@intel.com, vladimir.medvedkin@intel.com, anatoly.burakov@intel.com, andrew.rybchenko@oktetlabs.ru, jerinj@marvell.com, declan.doherty@intel.com, ciara.power@intel.com, xiaoyun.li@intel.com, nicolas.chautru@intel.com, maryam.tahhan@intel.com, reshma.pattan@intel.com, cristian.dumitrescu@intel.com Cc: dev@dpdk.org, nd@arm.com Date: Mon, 2 Aug 2021 05:18:40 -0500 Message-Id: <20210802101847.3462-6-joyce.kong@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210802101847.3462-1-joyce.kong@arm.com> References: <20210802101847.3462-1-joyce.kong@arm.com> Subject: [dpdk-dev] [PATCH v1 05/12] test/bpf: use compiler atomics for calculation 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 Sender: "dev" Convert rte_atomic usages to compiler atomic built-ins for calculation in bpf test cases. Signed-off-by: Joyce Kong Reviewed-by: Ruifeng Wang --- app/test/test_bpf.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/app/test/test_bpf.c b/app/test/test_bpf.c index 527c06b807..8d78e5761b 100644 --- a/app/test/test_bpf.c +++ b/app/test/test_bpf.c @@ -1553,32 +1553,32 @@ test_xadd1_check(uint64_t rc, const void *arg) memset(&dfe, 0, sizeof(dfe)); rv = 1; - rte_atomic32_add((rte_atomic32_t *)&dfe.u32, rv); - rte_atomic64_add((rte_atomic64_t *)&dfe.u64, rv); + __atomic_fetch_add(&dfe.u32, rv, __ATOMIC_RELAXED); + __atomic_fetch_add(&dfe.u64, rv, __ATOMIC_RELAXED); rv = -1; - rte_atomic32_add((rte_atomic32_t *)&dfe.u32, rv); - rte_atomic64_add((rte_atomic64_t *)&dfe.u64, rv); + __atomic_fetch_add(&dfe.u32, rv, __ATOMIC_RELAXED); + __atomic_fetch_add(&dfe.u64, rv, __ATOMIC_RELAXED); rv = (int32_t)TEST_FILL_1; - rte_atomic32_add((rte_atomic32_t *)&dfe.u32, rv); - rte_atomic64_add((rte_atomic64_t *)&dfe.u64, rv); + __atomic_fetch_add(&dfe.u32, rv, __ATOMIC_RELAXED); + __atomic_fetch_add(&dfe.u64, rv, __ATOMIC_RELAXED); rv = TEST_MUL_1; - rte_atomic32_add((rte_atomic32_t *)&dfe.u32, rv); - rte_atomic64_add((rte_atomic64_t *)&dfe.u64, rv); + __atomic_fetch_add(&dfe.u32, rv, __ATOMIC_RELAXED); + __atomic_fetch_add(&dfe.u64, rv, __ATOMIC_RELAXED); rv = TEST_MUL_2; - rte_atomic32_add((rte_atomic32_t *)&dfe.u32, rv); - rte_atomic64_add((rte_atomic64_t *)&dfe.u64, rv); + __atomic_fetch_add(&dfe.u32, rv, __ATOMIC_RELAXED); + __atomic_fetch_add(&dfe.u64, rv, __ATOMIC_RELAXED); rv = TEST_JCC_2; - rte_atomic32_add((rte_atomic32_t *)&dfe.u32, rv); - rte_atomic64_add((rte_atomic64_t *)&dfe.u64, rv); + __atomic_fetch_add(&dfe.u32, rv, __ATOMIC_RELAXED); + __atomic_fetch_add(&dfe.u64, rv, __ATOMIC_RELAXED); rv = TEST_JCC_3; - rte_atomic32_add((rte_atomic32_t *)&dfe.u32, rv); - rte_atomic64_add((rte_atomic64_t *)&dfe.u64, rv); + __atomic_fetch_add(&dfe.u32, rv, __ATOMIC_RELAXED); + __atomic_fetch_add(&dfe.u64, rv, __ATOMIC_RELAXED); return cmp_res(__func__, 1, rc, &dfe, dft, sizeof(dfe)); } -- 2.17.1