From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bruce Richardson Subject: Re: [PATCH v2 1/2] pmd: Modified dev_info structure to include default RX/TX configuration Date: Wed, 1 Oct 2014 09:38:53 +0100 Message-ID: <20141001083853.GA1204@BRICHA3-MOBL> References: <1411741159-6671-1-git-send-email-pablo.de.lara.guarch@intel.com> <1412150458-26213-1-git-send-email-pablo.de.lara.guarch@intel.com> <1412150458-26213-2-git-send-email-pablo.de.lara.guarch@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev-VfR2kkLFssw@public.gmane.org To: Pablo de Lara Return-path: Content-Disposition: inline In-Reply-To: <1412150458-26213-2-git-send-email-pablo.de.lara.guarch-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" On Wed, Oct 01, 2014 at 09:00:57AM +0100, Pablo de Lara wrote: > Many sample apps use duplicated code to set rte_eth_txconf and rte_eth_rxconf > structures. This patch allows the user to get a default optimal RX/TX configuration > through rte_eth_dev_info get, and still any parameters may be tweaked as wished, > before setting up queues. > > Besides, if a NULL pointer is passed to rte_eth_rx_queue_setup or > rte_eth_tx_queue_setup, these functions get internally the default RX/TX > configuration for the user. > > Signed-off-by: Pablo de Lara > --- > lib/librte_ether/rte_ethdev.c | 28 +++++++++++++++++++++----- > lib/librte_ether/rte_ethdev.h | 2 + > lib/librte_pmd_e1000/igb_ethdev.c | 32 ++++++++++++++++++++++++++++++- > lib/librte_pmd_i40e/i40e_ethdev.c | 33 ++++++++++++++++++++++++++++++++ > lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 36 +++++++++++++++++++++++++++++++++++ > 5 files changed, 124 insertions(+), 7 deletions(-) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index fd1010a..2f9eea2 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -928,6 +928,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, > struct rte_eth_dev *dev; > struct rte_pktmbuf_pool_private *mbp_priv; > struct rte_eth_dev_info dev_info; > + const struct rte_eth_rxconf *conf; > > /* This function is only safe when called from the primary process > * in a multi-process setup*/ > @@ -937,6 +938,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > return (-EINVAL); > } > + > dev = &rte_eth_devices[port_id]; > if (rx_queue_id >= dev->data->nb_rx_queues) { > PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id); > @@ -980,8 +982,12 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, > return (-EINVAL); > } > > + conf = rx_conf; > + if (conf == NULL) > + conf = &dev_info.default_rxconf; > + > ret = (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, nb_rx_desc, > - socket_id, rx_conf, mp); > + socket_id, conf, mp); > if (!ret) { > if (!dev->data->min_rx_buf_size || > dev->data->min_rx_buf_size > mbp_buf_size) One very minor nit - I don't think you need the new local variable conf. You can just check "if (rx_conf == NULL) rx_conf = &dev...". The same for the tx_conf too. /Bruce