From patchwork Fri Dec 8 02:38:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liangxing Wang X-Patchwork-Id: 134944 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 4D611436A0; Fri, 8 Dec 2023 03:38:19 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 147B7402CD; Fri, 8 Dec 2023 03:38:19 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 8D271402AC for ; Fri, 8 Dec 2023 03:38:17 +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 BC85511FB; Thu, 7 Dec 2023 18:39:02 -0800 (PST) Received: from net-arm-n1amp-02.shanghai.arm.com (net-arm-n1amp-02.shanghai.arm.com [10.169.210.107]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 58F753F762; Thu, 7 Dec 2023 18:38:14 -0800 (PST) From: Liangxing Wang To: Jakub Grajciar Cc: dev@dpdk.org, nd@arm.com, Liangxing Wang , Ruifeng Wang Subject: [PATCH v1] net/memif: remove extra mbuf refcnt update in zero copy Tx Date: Fri, 8 Dec 2023 02:38:01 +0000 Message-Id: <20231208023801.3156065-1-liangxing.wang@arm.com> X-Mailer: git-send-email 2.25.1 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. So remove the redundant mbuf refcnt update in dpdk memif driver to avoid extra heavy cost. Performance of dpdk memif zero copy tx is improved with this change. Signed-off-by: Liangxing Wang Reviewed-by: Ruifeng Wang --- drivers/net/memif/rte_eth_memif.c | 6 ------ 1 file changed, 6 deletions(-) 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);