From patchwork Wed Feb 14 00:36:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wathsala Wathawana Vithanage X-Patchwork-Id: 136678 X-Patchwork-Delegate: ferruh.yigit@amd.com 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 E6DD543B20; Wed, 14 Feb 2024 01:37:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AC53842E56; Wed, 14 Feb 2024 01:37:33 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id ED2B340042 for ; Wed, 14 Feb 2024 01:37:28 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 829A21FB; Tue, 13 Feb 2024 16:38:09 -0800 (PST) Received: from ampere-altra-2-1.usa.Arm.com (ampere-altra-2-1.usa.arm.com [10.118.91.158]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3A7133F7B4; Tue, 13 Feb 2024 16:37:28 -0800 (PST) From: Wathsala Vithanage To: Thomas Monjalon , Jakub Grajciar , Ferruh Yigit Cc: dev@dpdk.org, nd@arm.com, Wathsala Vithanage , Liangxing Wang , Ruifeng Wang Subject: [PATCH V2] net/memif: fix extra mbuf refcnt update in zero copy Tx Date: Wed, 14 Feb 2024 00:36:16 +0000 Message-Id: <20240214003616.1382823-1-wathsala.vithanage@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231208023801.3156065-1-liangxing.wang@arm.com> References: <20231208023801.3156065-1-liangxing.wang@arm.com> MIME-Version: 1.0 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 The refcnt update of stored mbufs in memif driver is redundant since those mbufs are only freed in eth_memif_tx_zc(). No other place can free those stored mbufs quietly. By removing this redundant update single core dpdk memif performance can be improved by 7.5%. testpmd stats on Arm Neoverse N1 (Ampere Altra) +-----------------------------+-----------------------+ | | With refcnt update | Without refcnt update | +--------+--------------------+-----------------------+ | Rx-pps | 2748851 | 2955487 | +--------+--------------------+-----------------------+ | Tx-pps | 2748812 | 2955436 | +--------+--------------------+-----------------------+ Fixes: 43b815d88188 ("net/memif: support zero-copy slave") Cc: jgrajcia@cisco.com Signed-off-by: Liangxing Wang Signed-off-by: Wathsala Vithanage Reviewed-by: Ruifeng Wang Acked-by: Ferruh Yigit --- .mailmap | 2 ++ drivers/net/memif/rte_eth_memif.c | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.mailmap b/.mailmap index de339562f4..00a642fcc3 100644 --- a/.mailmap +++ b/.mailmap @@ -791,6 +791,7 @@ Liang Ma Liang-Min Larry Wang Liang Xu Liang Zhang +Liangxing Wang Li Feng Li Han Lihong Ma @@ -1506,6 +1507,7 @@ Vlad Zolotarov Vlastimil Kosar Volodymyr Fialko Vu Pham +Wathsala Vithanage Wajeeh Atrash Walter Heymans Wang Sheng-Hui diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c index 7cc8c0da91..962d390b90 100644 --- a/drivers/net/memif/rte_eth_memif.c +++ b/drivers/net/memif/rte_eth_memif.c @@ -265,8 +265,6 @@ memif_free_stored_mbufs(struct pmd_process_private *proc_private, struct memif_q cur_tail = __atomic_load_n(&ring->tail, __ATOMIC_ACQUIRE); while (mq->last_tail != cur_tail) { RTE_MBUF_PREFETCH_TO_FREE(mq->buffers[(mq->last_tail + 1) & mask]); - /* Decrement refcnt and free mbuf. (current segment) */ - rte_mbuf_refcnt_update(mq->buffers[mq->last_tail & mask], -1); rte_pktmbuf_free_seg(mq->buffers[mq->last_tail & mask]); mq->last_tail++; } @@ -825,10 +823,6 @@ memif_tx_one_zc(struct pmd_process_private *proc_private, struct memif_queue *mq next_in_chain: /* store pointer to mbuf to free it later */ mq->buffers[slot & mask] = mbuf; - /* Increment refcnt to make sure the buffer is not freed before server - * receives it. (current segment) - */ - rte_mbuf_refcnt_update(mbuf, 1); /* populate descriptor */ d0 = &ring->desc[slot & mask]; d0->length = rte_pktmbuf_data_len(mbuf);