On 3/7/2018 12:08 PM, Remy Horton wrote: > 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 <remy.hor...@intel.com> > --- > lib/librte_ether/rte_ethdev.c | 18 ++++++++++++++++++ > lib/librte_ether/rte_ethdev.h | 15 +++++++++++++++
Can you please remove deprecation notice in this patch. > 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; Not sure about having these defaults here. It is OK to have defaults in driver, in application or in config file, but I am not sure if putting them into device abstraction layer hides them. What about not providing any default in ethdev layer, and get zero as invalid when using them? > + > 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 */ Not only queue size. > + struct rte_eth_dev_pref_queue_info preferred_queue_values; Although these are queue related values, not per-queue but per-port, the variable name "preferred_queue_values" gives the impression that these are per queue. And "rx_burst_size" is not related to queue at all I think. What do you think renaming structure and variable name, "preferred_dev_config" perhaps? > }; > > /** >