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 66D2FA04FD; Fri, 7 Oct 2022 19:47:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3ABA142B76; Fri, 7 Oct 2022 19:45:12 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2052.outbound.protection.outlook.com [40.107.237.52]) by mails.dpdk.org (Postfix) with ESMTP id 238ED42C04 for ; Fri, 7 Oct 2022 19:45:09 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TVukYCoo/XbRB1sI2r/NDu+iE6WDgnA9nFIAtyAQapLezU5rmIoeMOSRq6ThJHTolQP0n6MJDOcTsfod1dVvT0003MMP5DrgZBfE3NRzmKsr1i/qSKO2z9VRjdPDOzGS+eCwhIE/0K8d2rHPktjxdbS2wxJRsj0H89qYWCaflsbvS8/BBOkCM/xhIlegcaCDiLdDrVlbpMQvSTL7ypXmyA4ICDLAbCe0LfAH4cg4QvW7BCy42TVO2AO0b9B7DoboV/jqBh4/eHGLKw+kT9AR6jPduk26mgH3K4SbFia9tM8itL+ht3foUecQOW4RKyoYAi2ZsH4Y3o+FQzGzeKZ5Rw== 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=QAcV/a252wddd0gwzC7qEKGxMKiPfWtL56QUkMXZOBSRaJxOPhPeFzH4dKBKK7rGN0x6AIk225yKm0d+AKbxnPnC8S1I76kxjq6/ZZEBTN66U+fqtByEn6wuAa2cbsb0mQj8gsabWFWwez+d2UzsEzy1AQtVciGgc2SatA2LYwuox7bsyCG1bcRqR27dxWggv0jO49+R/DlaF4r0HX6cPaOVZmXnd7UFwUis4TukgvQYxml4cUrUprY1sgjSuym6y0orE87I4NnJxqdF5QRSSKqfLaQZRYGXGXIvI47/hI9n0eP2v4H/5sWZiepMx7zI0aNOnnyshTSFs0JsnsdgEw== 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=pgTBs1jR4kMgP+FqvDqAUw2dYLPmOlw0B+3Xqzi+7pM3v2Pz/bQFOM9mJ3X09F8NIO8cMgPGatOUjv+KCdcRrZYi81KgE3Kb2Qoie7X+7B5i0JzcdcSC1Vmde2j/OrzmHbuEfpoJpa4jQPb8N2Goi2yp4P7sooUZnr4LkyWSQ/Y= Received: from MW4PR03CA0340.namprd03.prod.outlook.com (2603:10b6:303:dc::15) by MW5PR12MB5600.namprd12.prod.outlook.com (2603:10b6:303:195::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.34; Fri, 7 Oct 2022 17:45:07 +0000 Received: from CO1NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:303:dc:cafe::96) by MW4PR03CA0340.outlook.office365.com (2603:10b6:303:dc::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.24 via Frontend Transport; Fri, 7 Oct 2022 17:45:07 +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 CO1NAM11FT068.mail.protection.outlook.com (10.13.175.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5709.10 via Frontend Transport; Fri, 7 Oct 2022 17:45:06 +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; Fri, 7 Oct 2022 12:45:03 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH 31/35] net/ionic: allow client to specify Tx free threshold Date: Fri, 7 Oct 2022 10:43:32 -0700 Message-ID: <20221007174336.54354-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 Content-Type: text/plain 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: CO1NAM11FT068:EE_|MW5PR12MB5600:EE_ X-MS-Office365-Filtering-Correlation-Id: aaf39cbe-5574-4e3a-663b-08daa88bac3c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PuavUIFFvK3TPZSwLWVupDGoDMUlKr/cOMuWbs1MmWeACOKInZ/Qcny+F35XcIxywaXDDebscETiUfrUJYHRNYUz0EFuJ3Ij8rNb4v8NZqPGincgTpsvE9k4sMl5qL9OesSozRzvGAs3Hc4evVgb0+xMxXv0o4L/828L5mu/eb9dxllt/R0SeXGKu+t7hXD7kwZitnrZzqU7Dn6oC9aoPAH90TRQNJ0XnJ5dhqYrJvfsoAdJZZPPTD7WOy8l9vPA9ndtd5PALkQhAOV6D450cDmrxzEJ50k3s8FJNFCUu1WV4ThQBVpb2wCOSrj2ZVBYlFMp5j1nqd3FLQ9EuVKEHyBayq3j1MXV8zY/trK3pvYm5tDKE0XaL5ay10S+3TKpZDCjLd9Qd28tnms7/l9ZrOS946DSnibEX6geWeA1uHK2W3n+YsGMkCuTKDOEZxkFfX3DUDp/fQKRNAB3s+Z5zPxdCg5xBcgmOOpENMZbyA9JEDNxW6NCC+L+224s7eCYaaJ6RbwcFYc10Drgy8uDnb2/M33xDsV0geLCqXpZeIw+TejlDFugyFwy/l6zKFXHvLuVAnFKOKMPe6y7q+lJYgQZSqR7BgWlkg424uOxn4BRGbcpyBs3LEZIOwjRp1vXNw1lAPdBalsJXaDoal6ZmYsiYqDTbCDBt7cYk70wVYHs1yOGyH9C6GMi2BFhrDsSiN2/UafUSCj4FKYTjHbR0pBoWr59GGAstjHEXb3JChGW5e2qUPq8K8+bjpD3YorcHhE6Eq1a263t8b0lpu3m50aHjkVkiC4s2IbwayD06+AiD3AR8Xnb9yNiiKqAbU2e 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)(39860400002)(376002)(346002)(396003)(136003)(451199015)(36840700001)(40470700004)(46966006)(86362001)(2906002)(70586007)(5660300002)(4326008)(8676002)(81166007)(70206006)(41300700001)(36756003)(186003)(16526019)(82310400005)(40460700003)(426003)(83380400001)(44832011)(40480700001)(336012)(8936002)(356005)(36860700001)(6666004)(2616005)(82740400003)(478600001)(6916009)(1076003)(26005)(47076005)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2022 17:45:06.7875 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aaf39cbe-5574-4e3a-663b-08daa88bac3c 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: CO1NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR12MB5600 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)) { -- 2.17.1