From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-bk0-f41.google.com (mail-bk0-f41.google.com [209.85.214.41]) by dpdk.org (Postfix) with ESMTP id 7D79C1F3 for ; Fri, 13 Sep 2013 15:38:06 +0200 (CEST) Received: by mail-bk0-f41.google.com with SMTP id na10so477334bkb.14 for ; Fri, 13 Sep 2013 06:38:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=ofulmlZOqNP7ltDsV680KD6LWnDAh0+rCphKEcmqUQg=; b=GziFCIE5kRWhoqM9FTTQkyJCb4N8YxphNmNW2CxJHnizxqrFx/IZtftGcd94OB3/uT z/1ydMScqqqkU+0KX2GyG/GtxP3AjICwoqV/HyA6efvzAjiUQs6cHAGpX506fDqfDDKu 9UKDT/+7CqH0hlcT3lNXBOAVGdgV6m60FFht4dZU45wUYEorn8I/GIVxIOkpG/j9GuQH LVF8W5so+LdM9rLCxJSBFo5+/yw3JNOUFpjdYsLPMIb+W/yT/0I6G50XNyCl1rgGC6Nf kUWGCu9BB3Rf9ZCAj/F5f+E2qtpBCsnfXS1SYktvoXQtb39YTv+CMG3nBicL2N2fbRBt SlFA== X-Gm-Message-State: ALoCoQncRakjdkAJGYcJRQH/jwutmZ45k8wZcVP1LmxqkOHZ54A27W3fWHL726qBglLRTXI0EZZy X-Received: by 10.205.76.133 with SMTP id ze5mr1606330bkb.37.1379079523332; Fri, 13 Sep 2013 06:38:43 -0700 (PDT) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by mx.google.com with ESMTPSA id on10sm2938238bkb.13.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:38:43 -0700 (PDT) Received: by 6wind.com (sSMTP sendmail emulation); Fri, 13 Sep 2013 15:38:41 +0200 From: Thomas Monjalon To: dev@dpdk.org Date: Fri, 13 Sep 2013 15:38:41 +0200 Message-Id: <1379079521-28859-1-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 1.7.10.4 Subject: [dpdk-dev] [PATCH] ethdev: fix non-reconfigurable pmd init 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: Fri, 13 Sep 2013 13:38:06 -0000 Some Poll-Mode Drivers (PMD) are not reconfigurable and, thus, do not implement (rx|tx)_queue_release functions. For these drivers, the functions rte_eth_dev_(rx|tx)_queue_config must return an ENOTSUP error only when reconfiguring, but not at initial configuration. Move the FUNC_PTR_OR_ERR_RET check into the case of reconfiguration. Signed-off-by: Thomas Monjalon --- lib/librte_ether/rte_ethdev.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index cb3d424..509cf11 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -253,9 +253,7 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) void **rxq; unsigned i; - FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release, -ENOTSUP); - - if (dev->data->rx_queues == NULL) { + if (dev->data->rx_queues == NULL) { /* first time configuration */ dev->data->rx_queues = rte_zmalloc("ethdev->rx_queues", sizeof(dev->data->rx_queues[0]) * nb_queues, CACHE_LINE_SIZE); @@ -263,7 +261,9 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) dev->data->nb_rx_queues = 0; return -(ENOMEM); } - } else { + } else { /* re-configure */ + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release, -ENOTSUP); + rxq = dev->data->rx_queues; for (i = nb_queues; i < old_nb_queues; i++) @@ -291,9 +291,7 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) void **txq; unsigned i; - FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_release, -ENOTSUP); - - if (dev->data->tx_queues == NULL) { + if (dev->data->tx_queues == NULL) { /* first time configuration */ dev->data->tx_queues = rte_zmalloc("ethdev->tx_queues", sizeof(dev->data->tx_queues[0]) * nb_queues, CACHE_LINE_SIZE); @@ -301,7 +299,9 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) dev->data->nb_tx_queues = 0; return -(ENOMEM); } - } else { + } else { /* re-configure */ + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_release, -ENOTSUP); + txq = dev->data->tx_queues; for (i = nb_queues; i < old_nb_queues; i++) -- 1.7.10.4