From patchwork Tue Oct 11 00:50:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 117859 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 C3756A0544; Tue, 11 Oct 2022 02:54:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 88F3242C3D; Tue, 11 Oct 2022 02:52:29 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2078.outbound.protection.outlook.com [40.107.220.78]) by mails.dpdk.org (Postfix) with ESMTP id 432D242C2D for ; Tue, 11 Oct 2022 02:52:23 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g2m7Xk+cpqftW9C/1AwoUsQoMDoaR45tkw1DTrIVtBsnx7fbD2vUeNRTDZte1nAJdyAtS+t+0BBWjxET9YD6a5hZ2QWmGZsCSC0GHcHtu3TYfrVyeHboFJuh/rbYZkB55f67arkpinXmnKYknhOUGihRYO9OeAeKxSnWX34S/m2D4ysKwRds05VQtaK10SZNmdx9PeX/6nWI6AwPdbbtHnHfL1pEJiXPYTvOU1hnv/GwDaUBboWPJCPdm3xpfhH1OHSAZtq0DO9SZluD3sirTwMnynDGhqljR2ZRHDKPBaUrKy9JjjpZNT//E8/tWwkp/rJ4L31s1VegRcpkBwUUyw== 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=+d24/ofUOlesiNWDNQDIv6rLFf3ZL534BBo/iy3t9iQ=; b=P6wewPbl/13miZup4ki2jZr2BW4bhymj9qcG/OmN87/OACarH0pltEPIpYXpKs6C9oQYuUm6X+vuttF9SM47+Myq83nhYCtZzZA9uJ/srnca3TrGskOBxshaeTBW8WeCfaLT5RSjEfHFjQlTe2v26AI5tL6CETtT3SYwDbysD4SSgeAG4kDi6/yXDtQ4VA3jtqGNOMH7RfoRcjK+UCO7VbL3splNSmcGRrTT/cyisEafsyoxAwYFnb4fkCcAMreJX9D3NnkJCZ+EWXqbLoSLyCGydsOMBw7ih2I/f+G6TEdX9HUbiCFVeUuNlwzmcS43iRCwedkC79nn9ipJJWA8nA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=dpdk.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+d24/ofUOlesiNWDNQDIv6rLFf3ZL534BBo/iy3t9iQ=; b=yD4hZy2Ds/c220IlaIxKVrrYCZ6Nev4djh66ZcX2SVD7m63JqkHI9Q/grh6p5hv82U3mF2GPLGMSEkvjzQo94rDWhmq1fqKiILptUMWOJdyzrc06k06eD+lMbNChAKowZK+Ik/jPTPtfuK1HKSBm+ShdZN1Hl1nlipr7TSlRtRw= Received: from BN0PR02CA0004.namprd02.prod.outlook.com (2603:10b6:408:e4::9) by CY8PR12MB7194.namprd12.prod.outlook.com (2603:10b6:930:5a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Tue, 11 Oct 2022 00:52:21 +0000 Received: from BN8NAM11FT019.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e4:cafe::24) by BN0PR02CA0004.outlook.office365.com (2603:10b6:408:e4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.19 via Frontend Transport; Tue, 11 Oct 2022 00:52:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT019.mail.protection.outlook.com (10.13.176.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5709.10 via Frontend Transport; Tue, 11 Oct 2022 00:52:20 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 10 Oct 2022 19:52:20 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v1 31/35] net/ionic: allow client to specify Tx free threshold Date: Mon, 10 Oct 2022 17:50:28 -0700 Message-ID: <20221011005032.47584-32-andrew.boyer@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221007174336.54354-1-andrew.boyer@amd.com> References: <20221007174336.54354-1-andrew.boyer@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT019:EE_|CY8PR12MB7194:EE_ X-MS-Office365-Filtering-Correlation-Id: 1115f8b6-bdfa-4e4b-e623-08daab22da7c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ss0OJSTO0H5Cy1TmNT2Ax9qC4MXVf7lISxE5iw+yoKE5rLGdncRMlrOSV7boHYEsIPtDgVrQEV/9Gpx81FVfR08/y+9slYSpKVGN78pzPO1t4K7vs9ZzZw81sYrNHEfsnUmOme/iigDIzWE8tS/F9xug43mhod3fE2pioo+Sr7vIqDaKqUxJVfQyCXEkLeKatcTGs7LGqcoUoagm1uUP4Hb+S3aiF+/1Eqat5vAt6aMKd8AuOs9wtDHHUNtCY8PyrDTkMhBbgphL76q/u3hxFEJEP5bSLJP07Yi1FYF5oflfYwOugE75wRLvnh5dfTm7U7CAyK92qlNnMQZFXPvF4w45vDze3UntC/Jy5aVJwPefWubyA2/IBNq0TOPVY95rMjDHTulluHmZ6lybPc6YcsCrj6s54DJsY4sVNFQocJ7qIJx7q534ermSZR39QY/1AI07ZcpZSYY0jiSb+WQo2x9Gn/hmBKAi+bO1n1VNA5u5SjF/NcdspRcS9Mw8YcY/UOfl7TMi/Sebwtnf2wlQm5uYhkDOE6L41RlkA6+dVBsIm/HUmSdGOHZ5s70z+lrGLeRyfuTHI7AdiltclZx3LbBXo//KPELHcuf31Y1bXbS9myfNQFtGW+382vRVMXnoFhnmAabWxZuoNZMYrJV3cQ1uxNZcLBS3CQSmyJFOLGTHEt0JXCw+jHpObFKa3n1hexBM3xMfZgNX4I1MUEtPfkqHK49osfp6ydRVGgLUCLWmSgYqjhFyJaG6T5nmyc/QuqkVDX2xBAs6SXBANRLVUXJa3gt03PPQ8bbo45rF28R40F+xUb3+iXMG+nMjZ24T X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(136003)(396003)(346002)(39860400002)(451199015)(46966006)(36840700001)(40470700004)(5660300002)(83380400001)(426003)(336012)(47076005)(82310400005)(4326008)(8676002)(26005)(36756003)(2906002)(40480700001)(8936002)(2616005)(70586007)(36860700001)(16526019)(316002)(356005)(1076003)(44832011)(40460700003)(70206006)(41300700001)(81166007)(86362001)(478600001)(186003)(6916009)(82740400003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 00:52:20.8734 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1115f8b6-bdfa-4e4b-e623-08daab22da7c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT019.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7194 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 Some clients have opinions about how often to flush the transmit ring. The default value is the number of Tx descriptors minus the default Tx burst size. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_dev.h | 1 + drivers/net/ionic/ionic_ethdev.c | 4 ++-- drivers/net/ionic/ionic_lif.h | 1 + drivers/net/ionic/ionic_rxtx.c | 17 +++++++++++++++-- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index 6b0540f615..d696de45e0 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -20,6 +20,7 @@ #define IONIC_MAX_RING_DESC 32768 #define IONIC_MIN_RING_DESC 16 #define IONIC_DEF_TXRX_DESC 4096 +#define IONIC_DEF_TXRX_BURST 32 #define IONIC_DEVCMD_TIMEOUT 5 /* devcmd_timeout */ #define IONIC_DEVCMD_CHECK_PERIOD_US 10 /* devcmd status chk period */ diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index 36fb09b810..28297879cf 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -429,8 +429,8 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev, dev_info->tx_desc_lim = tx_desc_lim_v1; /* Driver-preferred Rx/Tx parameters */ - dev_info->default_rxportconf.burst_size = 32; - dev_info->default_txportconf.burst_size = 32; + dev_info->default_rxportconf.burst_size = IONIC_DEF_TXRX_BURST; + dev_info->default_txportconf.burst_size = IONIC_DEF_TXRX_BURST; dev_info->default_rxportconf.nb_queues = 1; dev_info->default_txportconf.nb_queues = 1; dev_info->default_rxportconf.ring_size = IONIC_DEF_TXRX_DESC; diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index ec9cb24a61..e4af138a51 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -104,6 +104,7 @@ struct ionic_tx_qcq { /* cacheline2 */ uint16_t num_segs_fw; /* # segs supported by current FW */ + uint16_t free_thresh; uint16_t flags; struct ionic_tx_stats stats; diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index fceb8333f6..9a346f4143 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -223,6 +223,13 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id, if (!rte_is_power_of_2(nb_desc) || nb_desc < IONIC_MIN_RING_DESC) return -EINVAL; /* or use IONIC_DEFAULT_RING_DESC */ + if (tx_conf->tx_free_thresh > nb_desc) { + IONIC_PRINT(ERR, + "tx_free_thresh must be less than nb_desc (%u)", + nb_desc); + return -EINVAL; + } + /* Free memory prior to re-allocation if needed... */ if (eth_dev->data->tx_queues[tx_queue_id] != NULL) { ionic_dev_tx_queue_release(eth_dev, tx_queue_id); @@ -252,6 +259,10 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id, if (offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) txq->flags |= IONIC_QCQ_F_FAST_FREE; + txq->free_thresh = + tx_conf->tx_free_thresh ? tx_conf->tx_free_thresh : + nb_desc - IONIC_DEF_TXRX_BURST; + eth_dev->data->tx_queues[tx_queue_id] = txq; return 0; @@ -609,8 +620,10 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, rte_mbuf_prefetch_part2(tx_pkts[0]); } - /* Cleaning old buffers */ - ionic_tx_flush(txq); + if (unlikely(ionic_q_space_avail(q) < txq->free_thresh)) { + /* Cleaning old buffers */ + ionic_tx_flush(txq); + } nb_avail = ionic_q_space_avail(q); if (unlikely(nb_avail < nb_pkts)) {