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 D8F8141EA5; Wed, 15 Mar 2023 22:16:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 392D742B71; Wed, 15 Mar 2023 22:15:51 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 8968B40FDF for ; Wed, 15 Mar 2023 22:15:47 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id DF076205701E; Wed, 15 Mar 2023 14:15:46 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com DF076205701E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1678914946; bh=TV81iGt0wMIn/Kq820r3dxRPqBANui9c+6Ef0jBPmyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M84SbYkKWpc32qZsbLaVGdfocvpYWctQ90kir3pIhR/xEsNfvxTSvxGEo4x5CKx/1 7ZMQHqpQviXF0UKJa8rgGTw7nbqnYOBCBLDBRb/SYep6Of13PExKL9aTVfHbLIBWMC kTvLvz9p6BFVL4SpTaiwNjqgXg8BcrR2IW2/S4PE= From: Tyler Retzlaff To: dev@dpdk.org Cc: Honnappa.Nagarahalli@arm.com, Ruifeng.Wang@arm.com, thomas@monjalon.net, Tyler Retzlaff Subject: [PATCH v2 04/16] drivers/event: use previous value atomic fetch operations Date: Wed, 15 Mar 2023 14:15:33 -0700 Message-Id: <1678914945-10638-5-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1678914945-10638-1-git-send-email-roretzla@linux.microsoft.com> References: <1678486530-20688-1-git-send-email-roretzla@linux.microsoft.com> <1678914945-10638-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 Use __atomic_fetch_{add,and,or,sub,xor} instead of __atomic_{add,and,or,sub,xor}_fetch adding the necessary code to allow consumption of the resulting value. Signed-off-by: Tyler Retzlaff Acked-by: Pavan Nikhilesh --- drivers/event/cnxk/cnxk_tim_worker.h | 2 +- drivers/event/dsw/dsw_event.c | 4 ++-- drivers/event/octeontx/timvf_worker.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/event/cnxk/cnxk_tim_worker.h b/drivers/event/cnxk/cnxk_tim_worker.h index a326d55..0bd66ec 100644 --- a/drivers/event/cnxk/cnxk_tim_worker.h +++ b/drivers/event/cnxk/cnxk_tim_worker.h @@ -123,7 +123,7 @@ const uint64_t v = ~(TIM_BUCKET_W1_M_NUM_ENTRIES << TIM_BUCKET_W1_S_NUM_ENTRIES); - return __atomic_and_fetch(&bktp->w1, v, __ATOMIC_ACQ_REL); + return __atomic_fetch_and(&bktp->w1, v, __ATOMIC_ACQ_REL) & v; } static inline uint64_t diff --git a/drivers/event/dsw/dsw_event.c b/drivers/event/dsw/dsw_event.c index 9932caf..cbdc03f 100644 --- a/drivers/event/dsw/dsw_event.c +++ b/drivers/event/dsw/dsw_event.c @@ -45,8 +45,8 @@ * allocation. */ new_total_on_loan = - __atomic_add_fetch(&dsw->credits_on_loan, acquired_credits, - __ATOMIC_RELAXED); + __atomic_fetch_add(&dsw->credits_on_loan, acquired_credits, + __ATOMIC_RELAXED) + acquired_credits; if (unlikely(new_total_on_loan > dsw->max_inflight)) { /* Some other port took the last credits */ diff --git a/drivers/event/octeontx/timvf_worker.h b/drivers/event/octeontx/timvf_worker.h index 3f1e77f..aa729f8 100644 --- a/drivers/event/octeontx/timvf_worker.h +++ b/drivers/event/octeontx/timvf_worker.h @@ -135,7 +135,7 @@ { const uint64_t v = ~(TIM_BUCKET_W1_M_NUM_ENTRIES << TIM_BUCKET_W1_S_NUM_ENTRIES); - return __atomic_and_fetch(&bktp->w1, v, __ATOMIC_ACQ_REL); + return __atomic_fetch_and(&bktp->w1, v, __ATOMIC_ACQ_REL) & v; } static inline struct tim_mem_entry * -- 1.8.3.1