From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 9924CAD86 for ; Thu, 19 Feb 2015 17:00:40 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 19 Feb 2015 08:00:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,609,1418112000"; d="scan'208";a="687950738" Received: from unknown (HELO Sent) ([10.217.248.233]) by orsmga002.jf.intel.com with SMTP; 19 Feb 2015 08:00:35 -0800 Received: by Sent (sSMTP sendmail emulation); Thu, 19 Feb 2015 16:59:20 +0100 From: Pawel Wodkowski To: dev@dpdk.org Date: Thu, 19 Feb 2015 16:54:43 +0100 Message-Id: <1424361289-30718-2-git-send-email-pawelx.wodkowski@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1424361289-30718-1-git-send-email-pawelx.wodkowski@intel.com> References: <1421672551-11652-1-git-send-email-pawelx.wodkowski@intel.com> <1424361289-30718-1-git-send-email-pawelx.wodkowski@intel.com> Subject: [dpdk-dev] [PATCH v4 1/7] ethdev: Allow zero rx/tx queues in SRIOV mode 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: Thu, 19 Feb 2015 16:00:41 -0000 Allow zero rx/tx queues to be passed to rte_eth_dev_configure(). This way PF might be used only for configuration purpose when no receive and/or transmit functionality is needed. Rationale: in SRIOV mode PF use first free VF to RX/TX (at least ixgbe based NICs). For example: if using 82599EB based NIC and VF count is 16, 32 or 64 all recources are assigned to VFs so PF might be used only for configuration purpose. Signed-off-by: Pawel Wodkowski --- lib/librte_ether/rte_ethdev.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index ea3a1fb..2e814db 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -333,7 +333,7 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) dev->data->rx_queues = rte_zmalloc("ethdev->rx_queues", sizeof(dev->data->rx_queues[0]) * nb_queues, RTE_CACHE_LINE_SIZE); - if (dev->data->rx_queues == NULL) { + if (dev->data->rx_queues == NULL && nb_queues > 0) { dev->data->nb_rx_queues = 0; return -(ENOMEM); } @@ -475,7 +475,7 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) dev->data->tx_queues = rte_zmalloc("ethdev->tx_queues", sizeof(dev->data->tx_queues[0]) * nb_queues, RTE_CACHE_LINE_SIZE); - if (dev->data->tx_queues == NULL) { + if (dev->data->tx_queues == NULL && nb_queues > 0) { dev->data->nb_tx_queues = 0; return -(ENOMEM); } @@ -731,7 +731,10 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, } if (nb_rx_q == 0) { PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_q == 0\n", port_id); - return (-EINVAL); + /* In SRIOV there can be no free resource for PF. So permit use only + * for configuration. */ + if (RTE_ETH_DEV_SRIOV(dev).active == 0) + return (-EINVAL); } if (nb_tx_q > dev_info.max_tx_queues) { @@ -739,9 +742,13 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, port_id, nb_tx_q, dev_info.max_tx_queues); return (-EINVAL); } + if (nb_tx_q == 0) { PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_q == 0\n", port_id); - return (-EINVAL); + /* In SRIOV there can be no free resource for PF. So permit use only + * for configuration. */ + if (RTE_ETH_DEV_SRIOV(dev).active == 0) + return (-EINVAL); } /* Copy the dev_conf parameter into the dev structure */ -- 1.9.1