From patchwork Thu Mar 2 00:47:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 124626 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A10F941DAF; Thu, 2 Mar 2023 01:48:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0BA7942D0B; Thu, 2 Mar 2023 01:48:11 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 6C64F40DFB for ; Thu, 2 Mar 2023 01:48:03 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 28A8020B9C3E; Wed, 1 Mar 2023 16:48:01 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 28A8020B9C3E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1677718082; bh=AqnZY5l2+yPYsMACL2klO8iL2TX6L2qcZhv5Uj7ufd4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=roW5W0Ul/WWtJh1wg+cq9M4B9z7kA1A26EbqHbvCuqhv9OQ0Eadhh9LmHstWIoWb6 UTsKKb43fWLK9RHNa6CYQzbCaAmRycFOcuC9R00x8B9zkkgYb1VhyrWTSCrH90rvkW XWZBkYRX1DbxaI+UzgUJf8L2HDpAHkFUH7pr5jfU= From: Tyler Retzlaff To: dev@dpdk.org Cc: Honnappa.Nagarahalli@arm.com, thomas@monjalon.net, Tyler Retzlaff Subject: [PATCH 05/17] distributor: use previous value atomic fetch operations Date: Wed, 1 Mar 2023 16:47:36 -0800 Message-Id: <1677718068-2412-6-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1677718068-2412-1-git-send-email-roretzla@linux.microsoft.com> References: <1677718068-2412-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 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 --- lib/distributor/rte_distributor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/distributor/rte_distributor.c b/lib/distributor/rte_distributor.c index 3969b2e..68840ce 100644 --- a/lib/distributor/rte_distributor.c +++ b/lib/distributor/rte_distributor.c @@ -200,7 +200,7 @@ * we won't read any mbufs from there even if GET_BUF is set. * This allows distributor to retrieve in-flight already sent packets. */ - __atomic_or_fetch(&(buf->bufptr64[0]), RTE_DISTRIB_RETURN_BUF, + __atomic_fetch_or(&(buf->bufptr64[0]), RTE_DISTRIB_RETURN_BUF, __ATOMIC_ACQ_REL); /* set the RETURN_BUF on retptr64 even if we got no returns.