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 EA67941DB5; Thu, 2 Mar 2023 17:19:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC32A42D2F; Thu, 2 Mar 2023 17:18:39 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id D2EFF427F2 for ; Thu, 2 Mar 2023 17:18:31 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 7EC8E20BC5F0; Thu, 2 Mar 2023 08:18:30 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7EC8E20BC5F0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1677773910; bh=o1PsNnrU7jiy9Lq4lvDgX1h4I8o0UMA5bwcJMgZAAAI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S+zYrrh3lMwds2WWQib2etH+Mf3fjVom6MMMP9V2igsCyaXm+6S9XhC1yNSh9fDze DNIzO9UxhUyEczee8cp1jtVhZ+LIC+ryJ8M58nNWa7JgBKi8KW4R0lMIaCK/f8yndx jeCyBHfjt9cMI9NJNyDT3L0qW5ZhqVG8nUJFLk/w= From: Tyler Retzlaff To: dev@dpdk.org Cc: Honnappa.Nagarahalli@arm.com, thomas@monjalon.net, bruce.richardson@intel.com, mb@smartsharesystems.com, Ruifeng.Wang@arm.com, maxime.coquelin@redhat.com, Tyler Retzlaff Subject: [PATCH v2 11/17] net/iavf: use previous value atomic fetch operations Date: Thu, 2 Mar 2023 08:18:16 -0800 Message-Id: <1677773902-5167-12-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1677773902-5167-1-git-send-email-roretzla@linux.microsoft.com> References: <1677718068-2412-1-git-send-email-roretzla@linux.microsoft.com> <1677773902-5167-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 when we have no interest in the result of the operation. Reduces unnecessary codegen that provided the result of the atomic operation that was not used. Change brings closer alignment with atomics available in C11 standard and will reduce review effort when they are integrated. Signed-off-by: Tyler Retzlaff Acked-by: Morten Brørup --- drivers/net/iavf/iavf_vchnl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 9adaadb..6c04bd2 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -128,7 +128,7 @@ struct iavf_event_handler { int err = pipe(handler->fd); #endif if (err != 0) { - __atomic_sub_fetch(&handler->ndev, 1, __ATOMIC_RELAXED); + __atomic_fetch_sub(&handler->ndev, 1, __ATOMIC_RELAXED); return -1; } @@ -137,7 +137,7 @@ struct iavf_event_handler { if (rte_ctrl_thread_create(&handler->tid, "iavf-event-thread", NULL, iavf_dev_event_handle, NULL)) { - __atomic_sub_fetch(&handler->ndev, 1, __ATOMIC_RELAXED); + __atomic_fetch_sub(&handler->ndev, 1, __ATOMIC_RELAXED); return -1; } -- 1.8.3.1