From patchwork Mon Jan 19 13:02:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wodkowski, PawelX" X-Patchwork-Id: 2384 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id C3CDA5A82; Mon, 19 Jan 2015 14:12:31 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 34FD55A80 for ; Mon, 19 Jan 2015 14:12:29 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 19 Jan 2015 05:11:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,426,1418112000"; d="scan'208";a="639312509" Received: from unknown (HELO Sent) ([10.217.248.233]) by orsmga001.jf.intel.com with SMTP; 19 Jan 2015 05:11:01 -0800 Received: by Sent (sSMTP sendmail emulation); Mon, 19 Jan 2015 14:05:06 +0100 From: Pawel Wodkowski To: dev@dpdk.org Date: Mon, 19 Jan 2015 14:02:28 +0100 Message-Id: <1421672551-11652-2-git-send-email-pawelx.wodkowski@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1421672551-11652-1-git-send-email-pawelx.wodkowski@intel.com> References: <1421077843-8492-1-git-send-email-michalx.k.jastrzebski@intel.com> <1421672551-11652-1-git-send-email-pawelx.wodkowski@intel.com> Subject: [dpdk-dev] [PATCH v2 1/4] 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 077d430..62d7f6e 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 */