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 CDB2CA0560; Tue, 18 Oct 2022 21:47:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C35F44281C; Tue, 18 Oct 2022 21:47:57 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2077.outbound.protection.outlook.com [40.107.94.77]) by mails.dpdk.org (Postfix) with ESMTP id 27CFB42802 for ; Tue, 18 Oct 2022 21:47:56 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=faDBFnTpNKh2w8ogm8/xz/BvznZ7Se+np8rkFjZ606ASkK5ggHjU0bSsCEazOOTvG50JNSMGitVXM7FZUX6KdKVIQhu3NieEItUx6yyoXcHw48wjNQgIvHZwb8uaHebl05H1gEJXHctY062mgcsI0N8tdMu/rFzz2VTre3t9nxk8k0NF22edIBuhQquZ94QCCqEo8rk4JtU0dp1or7smG7VnDvhiEpWJNs81MKX036D0bd2Mk+2ftC+I3OGStYuq/jBhKVY3Fv/M9KMDEyxy6rWlREfHdM6vTWWi0rGwLUJgOTs1aL/3tQKU5Mv56UZx/ZOKk8sfbacDsUKog06sYw== 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=RdEiJouBQAUAbVhTfHI+3frGVwy8s8g4zKnqMRnk0+8=; b=Ds0pUQoJ1wZpDtXsIz0hVMhyRwVcpi8FA65Sh7ICyAeyjlaDayJqQbmgT+NFePl5egrsWQJOLWTEmjuMH0PlIwvOjBTQHDrrk+QamZdOMgAWSwjjyTdysr/zsAgLMfg1UBcdFOKXZVi0p7/93bg1aJWINb2qSeCQGx8LX1tM+bOZTMq3igcPYGhzPwpwCtipdjOt1DWwyq1Lh7ThqWfCbk1+Rw6Mv2Eax3Or+NjLdQ3zPqrHwMp3DiFqujVQ3Pn5XyKnmnv5sKNc56ujHrcV60fsfCgpN5EuAR+Kyq1ia1hLVgo8kv5nz20WI7AN0zSX2pziwQpnY6WVyLMHYj54mQ== 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=RdEiJouBQAUAbVhTfHI+3frGVwy8s8g4zKnqMRnk0+8=; b=bH30Phtyezs83J0lTOOtvUv81qx388KbG9+wasTZoI7N6x2ZSqVCPayL+D+BzoHnevXLTgn8IaHyH51Hg1/KtLELyt+MxnB4bXgiAcbt0645Jrl4P9fNj/0y/C1OE2KpEE9X1ZcJZHVDglJJd4KHFwC5vktcserfmQcwdin8A9I= Received: from DS7PR03CA0341.namprd03.prod.outlook.com (2603:10b6:8:55::23) by SJ0PR12MB6807.namprd12.prod.outlook.com (2603:10b6:a03:479::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Tue, 18 Oct 2022 19:47:54 +0000 Received: from DM6NAM11FT111.eop-nam11.prod.protection.outlook.com (2603:10b6:8:55:cafe::10) by DS7PR03CA0341.outlook.office365.com (2603:10b6:8:55::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30 via Frontend Transport; Tue, 18 Oct 2022 19:47:53 +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 DM6NAM11FT111.mail.protection.outlook.com (10.13.173.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5746.16 via Frontend Transport; Tue, 18 Oct 2022 19:47:53 +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.31; Tue, 18 Oct 2022 14:47:52 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 32/36] net/ionic: allow client to specify Tx free threshold Date: Tue, 18 Oct 2022 12:41:27 -0700 Message-ID: <20221018194131.23006-33-andrew.boyer@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221011005032.47584-1-andrew.boyer@amd.com> References: <20221011005032.47584-1-andrew.boyer@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT111:EE_|SJ0PR12MB6807:EE_ X-MS-Office365-Filtering-Correlation-Id: f8c47a90-94f3-478c-c914-08dab141a575 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RiVgsi5z0o8fwq9o1PqPl1QRM9EBzkpvWa/9UUfoHJj/1Ilc+Gr1ySEinR1+Qi9E3tweTZ0lvwZJNuJ6yP2hl0VheDYsiddf4PTrY4LkzQONMnUMfzxKjxhtRPMp2elN93+0Geun3vRquMf40L0eFCJe56YdYQu2uuNK7ra3o8tlj+ErWoykKAd8uoIHMIS64dEawkDAeDE82joPYpe4OW9Q/xaSmsFv9sL2HRT1/NI7QuQ8ghALh4HkfjEqzz9V3KL0QsHswknPjYP/L/AvlgIgcDxv2Dsp7ijbeMyVGvfwRTdLNHVAI3K41DhhzkttoUF2FeOMDzEa22n8Dvqyr2r03q4FD5Lduzlvs/zDGo8d2WHLw83szV+RyXFgzv+BLyoQTQoVIVNa47DFxLb9A9pGvb4mbzk4IePF0nul0wu7VQzb6kOcrXvpNaK0jWzSi0NVWCEIdh9wQj675XOA4XQX/fKjb3L2/mpYhkEsw2L4DYH3Mkn9FxXvywuI3LizLDl8/UQTb4uGle69g3TcpPv2aR445OBfOajFw1vkP9isjV/8/8Ghx/Um7PJYIUC1YXZj+6X7CYVoOGB40hP5q+/j05RgLXCu3MpWjjboKqbBMiNGJmd/uaY495va2mB/wE47qv1RfvJ9FkEsdzK4kyhImuVri8xzdU+e9rIHPHIf137uRi+10a0Pvu9KQZN9a6N7OdTIzkaAhZzaYgtknFs8ys5vzb2XZYCsbvFBkxq/xDO9vH/SgRkEiXs/CbTPcG3jcHexXwtuTFHsmxgbeB82Hci1jqVbxk4/VYy6nEuGipyMnTQCNHF8yAXjG4o4 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)(396003)(346002)(39860400002)(136003)(451199015)(40470700004)(36840700001)(46966006)(36756003)(86362001)(356005)(81166007)(82740400003)(26005)(1076003)(186003)(16526019)(47076005)(426003)(40480700001)(36860700001)(40460700003)(2906002)(44832011)(5660300002)(6666004)(2616005)(478600001)(336012)(83380400001)(8676002)(316002)(6916009)(82310400005)(41300700001)(70586007)(70206006)(4326008)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:47:53.2515 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f8c47a90-94f3-478c-c914-08dab141a575 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: DM6NAM11FT111.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6807 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 7ac86396be..46434f81a4 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 2f720315c3..1092c7a921 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 b9d2e879fb..09ebca7e89 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 1885c5961e..f43f9c1149 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)) { -- 2.17.1