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 9974043EB4; Sat, 20 Apr 2024 01:08:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 61F5640FDE; Sat, 20 Apr 2024 01:07:14 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 15C0040A7A for ; Sat, 20 Apr 2024 01:06:52 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 32A4520FE6D7; Fri, 19 Apr 2024 16:06:48 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 32A4520FE6D7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713568009; bh=+L9zWeoZH7fgfLq1OZMvibELY/xmWSmqY+x/ug+8QNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V++8drsS6UNRqmY7c7Bgj5Yjfs+EYpNfLA5Rpmv6IcjOF9c/VGc2h5VrYSZE8hCDt Ne6ga561ightvFLHIa9DHWtw/2Qrvgl0mF5aHzefgEVfu3LAuKO0ruiAxcytSDoyQB n4H9w/GwPFca/eAqV73+dbjlqlEtq80PA7vMMv9U= 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 , Yuying Zhang , Yuying Zhang , Ziyang Xuan , Tyler Retzlaff Subject: [PATCH v4 15/45] net/thunderx: use rte stdatomic API Date: Fri, 19 Apr 2024 16:06:13 -0700 Message-Id: <1713568003-30453-16-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1713568003-30453-1-git-send-email-roretzla@linux.microsoft.com> References: <1710967892-7046-1-git-send-email-roretzla@linux.microsoft.com> <1713568003-30453-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/thunderx/nicvf_rxtx.c | 9 +++++---- drivers/net/thunderx/nicvf_struct.h | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/thunderx/nicvf_rxtx.c b/drivers/net/thunderx/nicvf_rxtx.c index 74f43b9..76b6fdb 100644 --- a/drivers/net/thunderx/nicvf_rxtx.c +++ b/drivers/net/thunderx/nicvf_rxtx.c @@ -374,8 +374,8 @@ static const alignas(RTE_CACHE_LINE_SIZE) uint32_t ptype_table[16][16] = { NICVF_RX_ASSERT((unsigned int)to_fill <= (qlen_mask - (nicvf_addr_read(rbdr->rbdr_status) & NICVF_RBDR_COUNT_MASK))); - next_tail = __atomic_fetch_add(&rbdr->next_tail, to_fill, - __ATOMIC_ACQUIRE); + next_tail = rte_atomic_fetch_add_explicit(&rbdr->next_tail, to_fill, + rte_memory_order_acquire); ltail = next_tail; for (i = 0; i < to_fill; i++) { struct rbdr_entry_t *entry = desc + (ltail & qlen_mask); @@ -385,9 +385,10 @@ static const alignas(RTE_CACHE_LINE_SIZE) uint32_t ptype_table[16][16] = { ltail++; } - rte_wait_until_equal_32(&rbdr->tail, next_tail, __ATOMIC_RELAXED); + rte_wait_until_equal_32((uint32_t *)(uintptr_t)&rbdr->tail, next_tail, + rte_memory_order_relaxed); - __atomic_store_n(&rbdr->tail, ltail, __ATOMIC_RELEASE); + rte_atomic_store_explicit(&rbdr->tail, ltail, rte_memory_order_release); nicvf_addr_write(door, to_fill); return to_fill; } diff --git a/drivers/net/thunderx/nicvf_struct.h b/drivers/net/thunderx/nicvf_struct.h index cfcd942..60d3ec0 100644 --- a/drivers/net/thunderx/nicvf_struct.h +++ b/drivers/net/thunderx/nicvf_struct.h @@ -20,8 +20,8 @@ struct __rte_cache_aligned nicvf_rbdr { struct rbdr_entry_t *desc; nicvf_iova_addr_t phys; uint32_t buffsz; - uint32_t tail; - uint32_t next_tail; + RTE_ATOMIC(uint32_t) tail; + RTE_ATOMIC(uint32_t) next_tail; uint32_t head; uint32_t qlen_mask; }; -- 1.8.3.1