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 E439BA0548 for ; Sun, 28 Nov 2021 16:00:10 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DCAE74274C; Sun, 28 Nov 2021 16:00:10 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2044.outbound.protection.outlook.com [40.107.236.44]) by mails.dpdk.org (Postfix) with ESMTP id 8608D4068E for ; Sun, 28 Nov 2021 16:00:09 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cHv69iFif5qcWaeIsxEHaVYUlwMsNJpe2DIax/+JCko6T2OzxITA2vxgJZzJW2bUP6aJw+5dJ2H8csxFdhUIViGP3paU87a8yVSNsuE9o7ipBgp34InxpjpmZ5Q1jy9PrQ8mkvKb+eJ8OsmO5v1+Y6kG9544r99wCRq2k3+CsYz9ehbpeSSX2m9hXJilViazmukKJ7gwzSQEKiaQj0HL0uUmZlH9JTHKQO6018OwCRnUR+Pbc0YB6EuwKbW5UbhveNaa/TLsnxwhiUIuzDsDov1MFYV3gqV8k817zjh3oGU+whrCf4thlWqNC95NvriwpQ3TNGeca0ZrAhi7LyHgvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2pqJosd9a1BR46c7C8OUN7Wcve23J60IiC5BcA/MFZw=; b=ePKrMxTeJUaRERl8Dqcc6lFasJXmmAKviLZqlYc54Kw7GHr3qxuyXsDhW02MaWtusfDtA7CzXXKTFXHDEUfqPtRyFKoimxU3H9EPgx0yWeEyr9me3BP6bHnnE28WttdLpmD3bPDNI7/UGCcOsqG0a4T+t/cISutEsXLv84hmsaKODqRm06Y41ihhLnCOA3UWDp8AL+nCW0uh1XZW6ynMs0D1GAjyfGt67s4LXZTY8j+n4h3JAlKrR8c57DKbsSUpvQ2WBLhEzbA5H4Pf5R9VKdcaOJlsz8xmIiGljRerDx7KG1+DjoQyRSSxSnFhIebtXUOSzk1YloRqZKkx9KztwA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=huawei.com smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2pqJosd9a1BR46c7C8OUN7Wcve23J60IiC5BcA/MFZw=; b=ujhTB/NZYeU3kTUrPvu4pAzuL2dBineL2STIDDX9ZuHjcS+K67fdEibRSF2WwGfJT1a1LCRRMc5fjNvcCZPX8+t1qxFRmjVJRx9FPOjIlZrm8bUAG3cKgzi1k8WfrKBpC2iC+LgqBasW7Ewy2gjc8Pd6duoG/DiwTLJsmz95wtwsgM77S1xKtoWjso81dQgsQCphjj2xMdTE+Tgo4T4C++b8LWAsZCK+6dpLQDznyS3mKgdrAMguS4iKz4txFxNndeX9Dn20ok+M/aVljQcHnwhVqcV37uzsA1yqcyHNqVmgNcg0xkGAjONm9rtogK7Ex63v8dhh6ndJOJMIv0FJIQ== Received: from DM6PR03CA0088.namprd03.prod.outlook.com (2603:10b6:5:333::21) by BN9PR12MB5225.namprd12.prod.outlook.com (2603:10b6:408:11e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23; Sun, 28 Nov 2021 15:00:07 +0000 Received: from DM6NAM11FT056.eop-nam11.prod.protection.outlook.com (2603:10b6:5:333:cafe::51) by DM6PR03CA0088.outlook.office365.com (2603:10b6:5:333::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23 via Frontend Transport; Sun, 28 Nov 2021 15:00:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT056.mail.protection.outlook.com (10.13.173.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4734.22 via Frontend Transport; Sun, 28 Nov 2021 15:00:07 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 28 Nov 2021 15:00:04 +0000 From: Xueming Li To: Chengwen Feng CC: Luca Boccassi , Min Hu , dpdk stable Subject: patch 'net/hns3: optimize Tx performance by mbuf fast free' has been queued to stable release 20.11.4 Date: Sun, 28 Nov 2021 22:53:53 +0800 Message-ID: <20211128145423.3974892-50-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211128145423.3974892-1-xuemingl@nvidia.com> References: <20211110063216.2744012-1-xuemingl@nvidia.com> <20211128145423.3974892-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81928be1-ad42-4b08-6ac0-08d9b27fc439 X-MS-TrafficTypeDiagnostic: BN9PR12MB5225: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6/T3JK54bdDgHRrnMjUWU3AnQrF5bMddj4YQXFedF2fMsbNixNF10O1eC8IK/oiCR3zF9dfGbYuUU4etS8K9En9ok+ReSgJ+y2vnxEa2wkjHZe/DJeoV3rEj2qHyB9l8SUHJQMYDIzYFJfntaswma9Y8UWH6EKFx13IAumuqKsVe9q+zjXxtEUUWGMR3BEffD/RWvltBaz2ZuBKoY4JOPUQ9hAqfUHuffnSGTJvOUamHhdYSKPgfRKQKNJBkgfBFfd6c6n7koxK1IoW4hj6u2nJLFaqPyaZJK9OvW6xJdZQGOIwl6rYraAwmmPggCHj23duEGLR8ViMIcYSJV8Q4e7xA8mjfsnE9tNUlKf+rnS2OWgLbtq8srS1zt/aleiGstAh5DrBRgemGaJHzpj2ISl2jgN4aookY1GZ3dj6yxiQlfdfx/PIPoMvPLK4eg9ts83szlqyEyAIaaZpN7bGpa9o05cAjW4bRXm70hKHor8Z8NS5WEQK8WLXyE4IAOBwTxAE/ZqJzA+GDTuBTafAqO9+FfmAsoREeV75M9lesu0jeWQxI8RlJTKfWiOhnj6sshy3vj902D2aTbRPRQ3jRfXe7t7gUspXVK+X6A0+SuDRnnMBfnrSEgqJAuuwquKnAa8WrXWhovjVrzAD8DABoT6k5rOgj/cy6QHxplerwtef5W57jJ99jA7MmNDWqfp68/gnLMR9NcTTgFI5hLQutLY/z1b5EeOuXbAuImDReb0itKtbb1RseIA77zT/V8d7je5mA5X4KrQ2neSZYkKqnocd59Q+YoSALjpKVAPb0n2SIl1LA+O8Bu6HXFHr5KW2wcXSrStsiQHupIE3eTWxmrw== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(82310400004)(2906002)(86362001)(54906003)(36756003)(426003)(6916009)(47076005)(336012)(83380400001)(7636003)(55016003)(7696005)(4326008)(316002)(6666004)(6286002)(2616005)(186003)(70206006)(70586007)(508600001)(36860700001)(966005)(53546011)(8676002)(4001150100001)(1076003)(356005)(26005)(5660300002)(8936002)(16526019); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2021 15:00:07.1274 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81928be1-ad42-4b08-6ac0-08d9b27fc439 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT056.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5225 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 20.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/30/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/6a4f262ed3ffb82a92332825230bab668f18ca7b Thanks. Xueming Li --- >From 6a4f262ed3ffb82a92332825230bab668f18ca7b Mon Sep 17 00:00:00 2001 From: Chengwen Feng Date: Tue, 16 Nov 2021 09:22:11 +0800 Subject: [PATCH] net/hns3: optimize Tx performance by mbuf fast free Cc: Xueming Li [ upstream commit 3cc817c195cc8e3bf54b5cadd89c5c7776d3727e ] Currently the vector and simple xmit algorithm don't support multi_segs, so if Tx offload support MBUF_FAST_FREE, driver could invoke rte_mempool_put_bulk() to free Tx mbufs in this situation. In the testpmd single core MAC forwarding scenario, the performance is improved by 8% at 64B on Kunpeng920 platform. Signed-off-by: Chengwen Feng Signed-off-by: Min Hu (Connor) --- doc/guides/nics/features/hns3.ini | 1 + drivers/net/hns3/hns3_rxtx.c | 11 +++++++++++ drivers/net/hns3/hns3_rxtx.h | 2 ++ drivers/net/hns3/hns3_rxtx_vec.h | 9 +++++++++ 4 files changed, 23 insertions(+) diff --git a/doc/guides/nics/features/hns3.ini b/doc/guides/nics/features/hns3.ini index a1dc7eb9eb..00d9b1aef2 100644 --- a/doc/guides/nics/features/hns3.ini +++ b/doc/guides/nics/features/hns3.ini @@ -10,6 +10,7 @@ Queue start/stop = Y Runtime Rx queue setup = Y Runtime Tx queue setup = Y Burst mode info = Y +Fast mbuf free = Y MTU update = Y Jumbo frame = Y Scattered Rx = Y diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index 4ae7c1f00a..235197ce55 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -2722,6 +2722,8 @@ hns3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc, txq->udp_cksum_mode = hw->udp_cksum_mode; txq->over_length_pkt_cnt = 0; txq->exceed_limit_bd_pkt_cnt = 0; + txq->mbuf_fast_free_en = !!(dev->data->dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_MBUF_FAST_FREE); txq->exceed_limit_bd_reassem_fail = 0; txq->unsupported_tunnel_pkt_cnt = 0; txq->queue_full_cnt = 0; @@ -3592,6 +3594,14 @@ hns3_tx_free_buffer_simple(struct hns3_tx_queue *txq) tx_entry = &txq->sw_ring[txq->next_to_clean]; + if (txq->mbuf_fast_free_en) { + rte_mempool_put_bulk(tx_entry->mbuf->pool, + (void **)tx_entry, txq->tx_rs_thresh); + for (i = 0; i < txq->tx_rs_thresh; i++) + tx_entry[i].mbuf = NULL; + goto update_field; + } + for (i = 0; i < txq->tx_rs_thresh; i++) rte_prefetch0((tx_entry + i)->mbuf); for (i = 0; i < txq->tx_rs_thresh; i++, tx_entry++) { @@ -3599,6 +3609,7 @@ hns3_tx_free_buffer_simple(struct hns3_tx_queue *txq) tx_entry->mbuf = NULL; } +update_field: txq->next_to_clean = (tx_next_clean + 1) % txq->nb_tx_desc; txq->tx_bd_ready += txq->tx_rs_thresh; } diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h index dc9c89b5af..f425c9e8a3 100644 --- a/drivers/net/hns3/hns3_rxtx.h +++ b/drivers/net/hns3/hns3_rxtx.h @@ -423,6 +423,8 @@ struct hns3_tx_queue { */ bool pvid_sw_shift_en; bool enabled; /* indicate if Tx queue has been enabled */ + /* check whether the mbuf fast free offload is enabled */ + uint16_t mbuf_fast_free_en:1; /* * The following items are used for the abnormal errors statistics in diff --git a/drivers/net/hns3/hns3_rxtx_vec.h b/drivers/net/hns3/hns3_rxtx_vec.h index 67c75e44ef..4985a7cae8 100644 --- a/drivers/net/hns3/hns3_rxtx_vec.h +++ b/drivers/net/hns3/hns3_rxtx_vec.h @@ -18,6 +18,14 @@ hns3_tx_bulk_free_buffers(struct hns3_tx_queue *txq) int i; tx_entry = &txq->sw_ring[txq->next_to_clean]; + if (txq->mbuf_fast_free_en) { + rte_mempool_put_bulk(tx_entry->mbuf->pool, (void **)tx_entry, + txq->tx_rs_thresh); + for (i = 0; i < txq->tx_rs_thresh; i++) + tx_entry[i].mbuf = NULL; + goto update_field; + } + for (i = 0; i < txq->tx_rs_thresh; i++, tx_entry++) { m = rte_pktmbuf_prefree_seg(tx_entry->mbuf); tx_entry->mbuf = NULL; @@ -36,6 +44,7 @@ hns3_tx_bulk_free_buffers(struct hns3_tx_queue *txq) if (nb_free) rte_mempool_put_bulk(free[0]->pool, (void **)free, nb_free); +update_field: /* Update numbers of available descriptor due to buffer freed */ txq->tx_bd_ready += txq->tx_rs_thresh; txq->next_to_clean += txq->tx_rs_thresh; -- 2.34.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-28 22:41:05.866400503 +0800 +++ 0049-net-hns3-optimize-Tx-performance-by-mbuf-fast-free.patch 2021-11-28 22:41:03.370206742 +0800 @@ -1 +1 @@ -From 3cc817c195cc8e3bf54b5cadd89c5c7776d3727e Mon Sep 17 00:00:00 2001 +From 6a4f262ed3ffb82a92332825230bab668f18ca7b Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 3cc817c195cc8e3bf54b5cadd89c5c7776d3727e ] @@ -13,2 +15,0 @@ -Cc: stable@dpdk.org - @@ -25 +26 @@ -index c3464c8396..405b94f05c 100644 +index a1dc7eb9eb..00d9b1aef2 100644 @@ -28 +29 @@ -@@ -12,6 +12,7 @@ Queue start/stop = Y +@@ -10,6 +10,7 @@ Queue start/stop = Y @@ -33 +33,0 @@ - Free Tx mbuf on demand = Y @@ -34,0 +35 @@ + Jumbo frame = Y @@ -37 +38 @@ -index d26e262335..f0a57611ec 100644 +index 4ae7c1f00a..235197ce55 100644 @@ -40,3 +41 @@ -@@ -3059,6 +3059,8 @@ hns3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc, - txq->min_tx_pkt_len = hw->min_tx_pkt_len; - txq->tso_mode = hw->tso_mode; +@@ -2722,6 +2722,8 @@ hns3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc, @@ -43,0 +43,2 @@ + txq->over_length_pkt_cnt = 0; + txq->exceed_limit_bd_pkt_cnt = 0; @@ -45,5 +46,5 @@ -+ RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE); - memset(&txq->basic_stats, 0, sizeof(struct hns3_tx_basic_stats)); - memset(&txq->dfx_stats, 0, sizeof(struct hns3_tx_dfx_stats)); - -@@ -3991,6 +3993,14 @@ hns3_tx_free_buffer_simple(struct hns3_tx_queue *txq) ++ DEV_TX_OFFLOAD_MBUF_FAST_FREE); + txq->exceed_limit_bd_reassem_fail = 0; + txq->unsupported_tunnel_pkt_cnt = 0; + txq->queue_full_cnt = 0; +@@ -3592,6 +3594,14 @@ hns3_tx_free_buffer_simple(struct hns3_tx_queue *txq) @@ -64 +65 @@ -@@ -3998,6 +4008,7 @@ hns3_tx_free_buffer_simple(struct hns3_tx_queue *txq) +@@ -3599,6 +3609,7 @@ hns3_tx_free_buffer_simple(struct hns3_tx_queue *txq) @@ -73 +74 @@ -index 63bafc68b6..df731856ef 100644 +index dc9c89b5af..f425c9e8a3 100644 @@ -76,2 +77 @@ -@@ -495,6 +495,8 @@ struct hns3_tx_queue { - * this point. +@@ -423,6 +423,8 @@ struct hns3_tx_queue { @@ -79 +79,2 @@ - uint16_t pvid_sw_shift_en:1; + bool pvid_sw_shift_en; + bool enabled; /* indicate if Tx queue has been enabled */ @@ -84 +85 @@ - * For better performance in tx datapath, releasing mbuf in batches is + * The following items are used for the abnormal errors statistics in