From patchwork Mon Mar 4 09:01:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Brandes, Shai" X-Patchwork-Id: 137848 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 AB83E43B9B; Mon, 4 Mar 2024 10:02:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 144CA40DC9; Mon, 4 Mar 2024 10:02:03 +0100 (CET) Received: from smtp-fw-80008.amazon.com (smtp-fw-80008.amazon.com [99.78.197.219]) by mails.dpdk.org (Postfix) with ESMTP id B09A74026B; Mon, 4 Mar 2024 10:01:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1709542917; x=1741078917; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=VKWLz4oDznq//Hd+/QwTpu816la+fimxjPhi3Vu/OHA=; b=khMtWz75GlySpNIt7zrw6fCTYhyRpNiMEHBJfIxgGwkOEZihDkja9ft4 nSA/1NXTGUW+1FX6cRrHBAbx5xysvYHnHbykt3z0NOSpbtmwj64gpDhE6 UenFeR8vwQM1iIE5GITBV39QnA5Z1UkIAvaPgxMc0/tpcJjl0NH4hzm0r 4=; X-IronPort-AV: E=Sophos;i="6.06,203,1705363200"; d="scan'208";a="70433912" Received: from pdx4-co-svc-p1-lb2-vlan3.amazon.com (HELO smtpout.prod.us-east-1.prod.farcaster.email.amazon.dev) ([10.25.36.214]) by smtp-border-fw-80008.pdx80.corp.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2024 09:01:55 +0000 Received: from EX19MTAEUB002.ant.amazon.com [10.0.17.79:52732] by smtpin.naws.eu-west-1.prod.farcaster.email.amazon.dev [10.0.11.111:2525] with esmtp (Farcaster) id aca711b0-0ce9-454c-8927-84413b6d6435; Mon, 4 Mar 2024 09:01:54 +0000 (UTC) X-Farcaster-Flow-ID: aca711b0-0ce9-454c-8927-84413b6d6435 Received: from EX19D007EUA001.ant.amazon.com (10.252.50.133) by EX19MTAEUB002.ant.amazon.com (10.252.51.79) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Mon, 4 Mar 2024 09:01:48 +0000 Received: from EX19MTAUEC001.ant.amazon.com (10.252.135.222) by EX19D007EUA001.ant.amazon.com (10.252.50.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Mon, 4 Mar 2024 09:01:47 +0000 Received: from HFA15-CG15235BS.amazon.com (10.1.212.49) by mail-relay.amazon.com (10.252.135.200) with Microsoft SMTP Server id 15.2.1258.28 via Frontend Transport; Mon, 4 Mar 2024 09:01:46 +0000 From: To: CC: , Shai Brandes , Subject: [PATCH 05/33] net/ena: fix fast mbuf free Date: Mon, 4 Mar 2024 11:01:08 +0200 Message-ID: <20240304090136.861-6-shaibran@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240304090136.861-1-shaibran@amazon.com> References: <20240304090136.861-1-shaibran@amazon.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 From: Shai Brandes In case the application enables fast mbuf release optimization, the driver releases 256 TX mbufs in bulk upon reaching the TX free threshold. The existing implementation utilizes rte_mempool_put_bulk for bulk freeing TXs, which exclusively supports direct mbufs. In case the application transmits indirect bufs, the driver must also decrement the mbuf reference count and unlink the mbuf segment. For such case, the driver should employ rte_pktmbuf_free_bulk. Fixes: c339f53823f3 ("net/ena: support fast mbuf free") Cc: stable@dpdk.org Signed-off-by: Shai Brandes Reviewed-by: Amit Bernstein --- doc/guides/rel_notes/release_24_03.rst | 1 + drivers/net/ena/ena_ethdev.c | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst index f47073c7dc..6b73d4fedf 100644 --- a/doc/guides/rel_notes/release_24_03.rst +++ b/doc/guides/rel_notes/release_24_03.rst @@ -105,6 +105,7 @@ New Features * Removed the reporting of `rx_overruns` errors from xstats and instead updated `imissed` stat with its value. * Added support for sub-optimal configuration notifications from the device. + * Restructured fast release of mbufs when RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE optimization is enabled. * **Updated Atomic Rules' Arkville driver.** diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 3157237c0d..537ee9f8c3 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -3122,8 +3122,7 @@ ena_tx_cleanup_mbuf_fast(struct rte_mbuf **mbufs_to_clean, m_next = mbuf->next; mbufs_to_clean[mbuf_cnt++] = mbuf; if (mbuf_cnt == buf_size) { - rte_mempool_put_bulk(mbufs_to_clean[0]->pool, (void **)mbufs_to_clean, - (unsigned int)mbuf_cnt); + rte_pktmbuf_free_bulk(mbufs_to_clean, mbuf_cnt); mbuf_cnt = 0; } mbuf = m_next; @@ -3191,8 +3190,7 @@ static int ena_tx_cleanup(void *txp, uint32_t free_pkt_cnt) } if (mbuf_cnt != 0) - rte_mempool_put_bulk(mbufs_to_clean[0]->pool, - (void **)mbufs_to_clean, mbuf_cnt); + rte_pktmbuf_free_bulk(mbufs_to_clean, mbuf_cnt); /* Notify completion handler that full cleanup was performed */ if (free_pkt_cnt == 0 || total_tx_pkts < cleanup_budget)