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 72242427E5; Mon, 20 Mar 2023 20:01:22 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1A2DF42BFE; Mon, 20 Mar 2023 20:01:08 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 9AC1E41133 for ; Mon, 20 Mar 2023 20:01:02 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id EE37520FB1BC; Mon, 20 Mar 2023 12:01:01 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com EE37520FB1BC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1679338861; bh=KwkIPukJhLJutuumpiLf0nkOHPZ3M576XBwAsmBTZ/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IRJTdcWvIoPQCH+jFXX7UjI1lUAVmEB3yVAYf3iX4TH/IIo6ZFZ5/1Ns5DVM96+qD 9Dybi2Aq94Vgo/eURoUsH/jNsNSI5E30hwJIRsVDGZ6Z36qWNXSqTBE+MmQ8zaAYA5 w35BApMHQ2F17R0S09OQFWR6SRMQ/LznYFP7GvJo= From: Tyler Retzlaff To: dev@dpdk.org Cc: Honnappa.Nagarahalli@arm.com, Ruifeng.Wang@arm.com, thomas@monjalon.net, pbhagavatula@marvell.com, ndabilpuram@marvell.com, Tyler Retzlaff Subject: [PATCH v3 04/16] drivers/event: use previous value atomic fetch operations Date: Mon, 20 Mar 2023 12:00:24 -0700 Message-Id: <1679338836-21321-5-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1679338836-21321-1-git-send-email-roretzla@linux.microsoft.com> References: <1678486530-20688-1-git-send-email-roretzla@linux.microsoft.com> <1679338836-21321-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 Reviewed-by: Ruifeng Wang --- 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