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 513FB41E6D; Fri, 10 Mar 2023 23:15:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 441AE427E9; Fri, 10 Mar 2023 23:15:41 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 6615940EE1 for ; Fri, 10 Mar 2023 23:15:36 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id AD0B9204472A; Fri, 10 Mar 2023 14:15:35 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com AD0B9204472A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1678486535; bh=otE2sixznrKBFR/1eJAbIy8PCfBvHB3ehXXuIJxC4v8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jcFTAnyfkpVvLOV11WvbUqDSdzSJGMKfuslfjPK39nSQ8EsbsGTwiZCffKMNl6/gY V2t06QAZdJnh9tseBikXhXnWUdP07WM7rckPD+rQtdL3ju9BQIfvZxwKe2UzMmotxH hDcNQ0AmlV3/A6YwLfClKV5wNOQjnfUHkAqaWBjk= From: Tyler Retzlaff To: dev@dpdk.org Cc: Honnappa.Nagarahalli@arm.com, Ruifeng.Wang@arm.com, thomas@monjalon.net, Tyler Retzlaff Subject: [PATCH 04/16] drivers/event: use previous value atomic fetch operations Date: Fri, 10 Mar 2023 14:15:18 -0800 Message-Id: <1678486530-20688-5-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1678486530-20688-1-git-send-email-roretzla@linux.microsoft.com> References: <1678486530-20688-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 --- 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