From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 1DDA45598 for ; Wed, 23 Nov 2016 20:40:03 +0100 (CET) Received: by mail-wm0-f65.google.com with SMTP id g23so2967897wme.1 for ; Wed, 23 Nov 2016 11:40:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=rYFVcxcjdn9XA0qR2NovLtyE2iY8AJ92+X7UM7nGwi4=; b=cPPACsV6St79rufGcwtusgEPIZiQFg8PdkANFUu4T1Eta4U0G9DVMsJsyPCXpMJG2N 9my32Lqwv814LAY2bY7kDy6innrAeh4yYtph9COoAKUAV8aqdl2tgdm+uxsw4ZCyQgvA GQJiMvJF1Vhlj0dfaAjYBr+LsBAZJ9ybMPN6Qnt4guUsnf9Aj59Ymvf0f2LefcdJhf3k yq+sQk8mnS8oASe2vFPzIO8vSN5IdoLhEuR89CalsMwUQNvq+R/x6rsK9E59vZVqS8zC /zM0GEj3h3taeCewmZmmvcip27vYCfKcchKP0JpwI6/g2Pisbe998M7Udu3AIw8jc8xn SP1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=rYFVcxcjdn9XA0qR2NovLtyE2iY8AJ92+X7UM7nGwi4=; b=CHNU9KaZzhL5ChFGRcjNaj9DQ9G0yOFwi1Kd0qee97KrkopaAuV0zOBi06mhmK8V4t jFzTZ/K6OlP9H7lWryGcxzTTbcS06HZSRtsygeXV7NIfc7gH+Pp1cNUAHW/2hgq+ak1U 1O9n99VOT6UNA2qDn27KUvpJ+4zKm8AXxo3nUYj6dl2Ra8WWP5uEcgpZlqF8hwVKSKLx 6igNZcQFhgNf7vGrSed6FfrtdP29/kvqkVEGxKGs+KZ2CdwEG7o1w4CEl1A+8xddYIZr SH1avAtoerPpSNASek7+m/F5H8GadIE5WteVTF53Wo9zJV4iLjmGF6oPv0gTtA2BYmqh OjNw== X-Gm-Message-State: AKaTC01j71Lq0sYNjtlDjqJCBkr7/RoV+D8uuNIJ4f81i6hGqnL3SCTOvYPmsw+0AkFLOQ== X-Received: by 10.28.63.16 with SMTP id m16mr4939512wma.113.1479930002787; Wed, 23 Nov 2016 11:40:02 -0800 (PST) Received: from weierstrass.local.net ([91.200.110.70]) by smtp.gmail.com with ESMTPSA id g184sm4339684wme.23.2016.11.23.11.40.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Nov 2016 11:40:02 -0800 (PST) Sender: Jan Blunck From: Jan Blunck To: dev@dpdk.org Cc: ferruh.yigit@intel.com, i.maximets@samsung.com, bruce.richardson@intel.com, declan.doherty@intel.com Date: Wed, 23 Nov 2016 20:38:29 +0100 Message-Id: <1479929912-32079-1-git-send-email-jblunck@infradead.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Subject: [dpdk-dev] [PATCH 1/4] ethdev: Call rx/tx_queue_release before rx/tx_queue_setup 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, 23 Nov 2016 19:40:03 -0000 If a queue has been setup before lets release it before we setup. Otherwise we might leak resources. Signed-off-by: Jan Blunck --- lib/librte_ether/rte_ethdev.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index fde8112..8c4b6cd 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1010,6 +1010,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, uint32_t mbp_buf_size; struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; + void **rxq; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); @@ -1068,6 +1069,14 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, return -EINVAL; } + rxq = dev->data->rx_queues; + if (rxq[rx_queue_id]) { + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release, + -ENOTSUP); + (*dev->dev_ops->rx_queue_release)(rxq[rx_queue_id]); + rxq[rx_queue_id] = NULL; + } + if (rx_conf == NULL) rx_conf = &dev_info.default_rxconf; @@ -1089,6 +1098,7 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, { struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; + void **txq; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); @@ -1121,6 +1131,14 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, return -EINVAL; } + txq = dev->data->tx_queues; + if (txq[tx_queue_id]) { + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_release, + -ENOTSUP); + (*dev->dev_ops->tx_queue_release)(txq[tx_queue_id]); + txq[tx_queue_id] = NULL; + } + if (tx_conf == NULL) tx_conf = &dev_info.default_txconf; -- 2.7.4