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 B8B5F43D14; Thu, 21 Mar 2024 20:20:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F093342F3D; Thu, 21 Mar 2024 20:18:10 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 4B16E42E4F for ; Thu, 21 Mar 2024 20:17:40 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 7651D20B74D9; Thu, 21 Mar 2024 12:17:34 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7651D20B74D9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711048655; bh=txvvFOYuYp2v1KxUqAQkexCHkbcTB5WSMF5F3vmDTo4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mO16A8pgm7YpgjdI0yVBKMG47xb3z5vHpXH834O8QXBWiAJtECU/udOY7SYmq1l89 79L2WvJEyqnH0IR7j1RgaODu/JlmFvirNOYvCpqnzLOgIgz98fRY06sXafWQ2pW8T+ +blU34c4rvdsnGwcnp/cX0Amq01UXk3BeEdPlweA= 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 v2 24/45] event/octeontx: use rte stdatomic API Date: Thu, 21 Mar 2024 12:17:11 -0700 Message-Id: <1711048652-7512-25-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1711048652-7512-1-git-send-email-roretzla@linux.microsoft.com> References: <1710967892-7046-1-git-send-email-roretzla@linux.microsoft.com> <1711048652-7512-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 --- drivers/event/octeontx/timvf_evdev.h | 8 ++++---- drivers/event/octeontx/timvf_worker.h | 36 +++++++++++++++++------------------ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/event/octeontx/timvf_evdev.h b/drivers/event/octeontx/timvf_evdev.h index cef02cd..4bfc3d7 100644 --- a/drivers/event/octeontx/timvf_evdev.h +++ b/drivers/event/octeontx/timvf_evdev.h @@ -126,15 +126,15 @@ enum timvf_clk_src { struct tim_mem_bucket { uint64_t first_chunk; union { - uint64_t w1; + RTE_ATOMIC(uint64_t) w1; struct { - uint32_t nb_entry; + RTE_ATOMIC(uint32_t) nb_entry; uint8_t sbt:1; uint8_t hbt:1; uint8_t bsk:1; uint8_t rsvd:5; - uint8_t lock; - int16_t chunk_remainder; + RTE_ATOMIC(uint8_t) lock; + RTE_ATOMIC(int16_t) chunk_remainder; }; }; uint64_t current_chunk; diff --git a/drivers/event/octeontx/timvf_worker.h b/drivers/event/octeontx/timvf_worker.h index e4b923e..de9f1b0 100644 --- a/drivers/event/octeontx/timvf_worker.h +++ b/drivers/event/octeontx/timvf_worker.h @@ -19,22 +19,22 @@ static inline int16_t timr_bkt_get_rem(struct tim_mem_bucket *bktp) { - return __atomic_load_n(&bktp->chunk_remainder, - __ATOMIC_ACQUIRE); + return rte_atomic_load_explicit(&bktp->chunk_remainder, + rte_memory_order_acquire); } static inline void timr_bkt_set_rem(struct tim_mem_bucket *bktp, uint16_t v) { - __atomic_store_n(&bktp->chunk_remainder, v, - __ATOMIC_RELEASE); + rte_atomic_store_explicit(&bktp->chunk_remainder, v, + rte_memory_order_release); } static inline void timr_bkt_sub_rem(struct tim_mem_bucket *bktp, uint16_t v) { - __atomic_fetch_sub(&bktp->chunk_remainder, v, - __ATOMIC_RELEASE); + rte_atomic_fetch_sub_explicit(&bktp->chunk_remainder, v, + rte_memory_order_release); } static inline uint8_t @@ -47,14 +47,14 @@ timr_bkt_set_sbt(struct tim_mem_bucket *bktp) { const uint64_t v = TIM_BUCKET_W1_M_SBT << TIM_BUCKET_W1_S_SBT; - return __atomic_fetch_or(&bktp->w1, v, __ATOMIC_ACQ_REL); + return rte_atomic_fetch_or_explicit(&bktp->w1, v, rte_memory_order_acq_rel); } static inline uint64_t timr_bkt_clr_sbt(struct tim_mem_bucket *bktp) { const uint64_t v = ~(TIM_BUCKET_W1_M_SBT << TIM_BUCKET_W1_S_SBT); - return __atomic_fetch_and(&bktp->w1, v, __ATOMIC_ACQ_REL); + return rte_atomic_fetch_and_explicit(&bktp->w1, v, rte_memory_order_acq_rel); } static inline uint8_t @@ -81,34 +81,34 @@ { /*Clear everything except lock. */ const uint64_t v = TIM_BUCKET_W1_M_LOCK << TIM_BUCKET_W1_S_LOCK; - return __atomic_fetch_and(&bktp->w1, v, __ATOMIC_ACQ_REL); + return rte_atomic_fetch_and_explicit(&bktp->w1, v, rte_memory_order_acq_rel); } static inline uint64_t timr_bkt_fetch_sema_lock(struct tim_mem_bucket *bktp) { - return __atomic_fetch_add(&bktp->w1, TIM_BUCKET_SEMA_WLOCK, - __ATOMIC_ACQ_REL); + return rte_atomic_fetch_add_explicit(&bktp->w1, TIM_BUCKET_SEMA_WLOCK, + rte_memory_order_acq_rel); } static inline uint64_t timr_bkt_fetch_sema(struct tim_mem_bucket *bktp) { - return __atomic_fetch_add(&bktp->w1, TIM_BUCKET_SEMA, - __ATOMIC_RELAXED); + return rte_atomic_fetch_add_explicit(&bktp->w1, TIM_BUCKET_SEMA, + rte_memory_order_relaxed); } static inline uint64_t timr_bkt_inc_lock(struct tim_mem_bucket *bktp) { const uint64_t v = 1ull << TIM_BUCKET_W1_S_LOCK; - return __atomic_fetch_add(&bktp->w1, v, __ATOMIC_ACQ_REL); + return rte_atomic_fetch_add_explicit(&bktp->w1, v, rte_memory_order_acq_rel); } static inline void timr_bkt_dec_lock(struct tim_mem_bucket *bktp) { - __atomic_fetch_add(&bktp->lock, 0xff, __ATOMIC_ACQ_REL); + rte_atomic_fetch_add_explicit(&bktp->lock, 0xff, rte_memory_order_acq_rel); } static inline uint32_t @@ -121,13 +121,13 @@ static inline void timr_bkt_inc_nent(struct tim_mem_bucket *bktp) { - __atomic_fetch_add(&bktp->nb_entry, 1, __ATOMIC_RELAXED); + rte_atomic_fetch_add_explicit(&bktp->nb_entry, 1, rte_memory_order_relaxed); } static inline void timr_bkt_add_nent(struct tim_mem_bucket *bktp, uint32_t v) { - __atomic_fetch_add(&bktp->nb_entry, v, __ATOMIC_RELAXED); + rte_atomic_fetch_add_explicit(&bktp->nb_entry, v, rte_memory_order_relaxed); } static inline uint64_t @@ -135,7 +135,7 @@ { const uint64_t v = ~(TIM_BUCKET_W1_M_NUM_ENTRIES << TIM_BUCKET_W1_S_NUM_ENTRIES); - return __atomic_fetch_and(&bktp->w1, v, __ATOMIC_ACQ_REL) & v; + return rte_atomic_fetch_and_explicit(&bktp->w1, v, rte_memory_order_acq_rel) & v; } static inline struct tim_mem_entry * -- 1.8.3.1