From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id E7230106A for ; Wed, 1 Oct 2014 10:32:12 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 01 Oct 2014 01:36:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,630,1406617200"; d="scan'208";a="581748923" Received: from bricha3-mobl.ger.corp.intel.com (HELO bricha3-mobl.ir.intel.com) ([10.243.20.27]) by orsmga001.jf.intel.com with SMTP; 01 Oct 2014 01:38:54 -0700 Received: by bricha3-mobl.ir.intel.com (sSMTP sendmail emulation); Wed, 01 Oct 2014 09:38:53 +0001 Date: Wed, 1 Oct 2014 09:38:53 +0100 From: Bruce Richardson To: Pablo de Lara 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 Content-Disposition: inline In-Reply-To: <1412150458-26213-2-git-send-email-pablo.de.lara.guarch@intel.com> Organization: Intel Shannon Ltd. User-Agent: Mutt/1.5.22 (2013-10-16) Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v2 1/2] pmd: Modified dev_info structure to include default RX/TX configuration X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Oct 2014 08:32:13 -0000 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