From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 329102BF1 for ; Wed, 7 Mar 2018 13:08:55 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Mar 2018 04:08:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,435,1515484800"; d="scan'208";a="209562594" Received: from rhorton-mobl1.ger.corp.intel.com (HELO FC23.ir.intel.com) ([163.33.230.83]) by fmsmga006.fm.intel.com with ESMTP; 07 Mar 2018 04:08:54 -0800 From: Remy Horton To: dev@dpdk.org Cc: Wenzhuo Lu , Jingjing Wu , Qi Zhang , Beilei Xing , Shreyansh Jain , Thomas Monjalon Date: Wed, 7 Mar 2018 12:08:48 +0000 Message-Id: <20180307120851.5822-2-remy.horton@intel.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180307120851.5822-1-remy.horton@intel.com> References: <20180307120851.5822-1-remy.horton@intel.com> Subject: [dpdk-dev] [RFC PATCH v1 1/4] ethdev: add support for PMD-tuned Tx/Rx parameters X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Mar 2018 12:08:56 -0000 The optimal values of several transmission & reception related parameters, such as burst sizes, descriptor ring sizes, and number of queues, varies between different network interface devices. This patch allows individual PMDs to specify preferred parameter values. Signed-off-by: Remy Horton --- lib/librte_ether/rte_ethdev.c | 18 ++++++++++++++++++ lib/librte_ether/rte_ethdev.h | 15 +++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 0590f0c..1630407 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1461,6 +1461,10 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, return -EINVAL; } + /* Use default specified by driver, if nb_rc_desc is zero */ + if (nb_rx_desc == 0) + nb_rx_desc = dev_info.preferred_queue_values.rx_ring_size; + if (nb_rx_desc > dev_info.rx_desc_lim.nb_max || nb_rx_desc < dev_info.rx_desc_lim.nb_min || nb_rx_desc % dev_info.rx_desc_lim.nb_align != 0) { @@ -1584,6 +1588,10 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id, rte_eth_dev_info_get(port_id, &dev_info); + /* Use default specified by driver, if nb_tx_desc is zero */ + if (nb_tx_desc == 0) + nb_tx_desc = dev_info.preferred_queue_values.tx_ring_size; + if (nb_tx_desc > dev_info.tx_desc_lim.nb_max || nb_tx_desc < dev_info.tx_desc_lim.nb_min || nb_tx_desc % dev_info.tx_desc_lim.nb_align != 0) { @@ -2394,6 +2402,16 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info) dev_info->rx_desc_lim = lim; dev_info->tx_desc_lim = lim; + /* Defaults for drivers that don't implement preferred + * queue parameters. + */ + dev_info->preferred_queue_values.rx_burst_size = 0; + dev_info->preferred_queue_values.tx_burst_size = 0; + dev_info->preferred_queue_values.nb_rx_queues = 1; + dev_info->preferred_queue_values.nb_tx_queues = 1; + dev_info->preferred_queue_values.rx_ring_size = 1024; + dev_info->preferred_queue_values.tx_ring_size = 1024; + RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get); (*dev->dev_ops->dev_infos_get)(dev, dev_info); dev_info->driver_name = dev->device->driver->name; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 0361533..67ce82d 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -988,6 +988,18 @@ struct rte_eth_conf { struct rte_pci_device; +/* + * Preferred queue parameters. + */ +struct rte_eth_dev_pref_queue_info { + uint16_t rx_burst_size; + uint16_t tx_burst_size; + uint16_t rx_ring_size; + uint16_t tx_ring_size; + uint16_t nb_rx_queues; + uint16_t nb_tx_queues; +}; + /** * Ethernet device information */ @@ -1029,6 +1041,9 @@ struct rte_eth_dev_info { /** Configured number of rx/tx queues */ uint16_t nb_rx_queues; /**< Number of RX queues. */ uint16_t nb_tx_queues; /**< Number of TX queues. */ + + /** Queue size recommendations */ + struct rte_eth_dev_pref_queue_info preferred_queue_values; }; /** -- 2.9.5