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 2AA2147CD; Thu, 24 Nov 2016 12:35:41 +0100 (CET) Received: by mail-wm0-f65.google.com with SMTP id a20so4726591wme.2; Thu, 24 Nov 2016 03:35:41 -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=ImkIsSJfsG6GWEt/FqSziKrGZaDIZMgRfIfyjP3S/h/o+Z1NUFH5lH/+Mv0mGSATx+ XAf8x5ngFudQBQj5r7Y8VuwyUcCn2kVOtjJ++nOsbDiIaYJ0EcEyk6uqiZYadnn/Zhjq /IJbdoCqrpwI48bKqoBJ6PsbxmL86EG4o3Cu9vDdNEtgbigXJSpiseIvRlQR0umT0IeY P6iDbuVcMCMNJ+WiMvG8GyY0lopZhtN9W/xXmDbv4XDJ8QXwjxZMFIEnwoh2q4Q7tda7 obKuZxZ1leQYzXklwrQ6v9IUVtOM+wwFA3vuqenEHCi4EEnaMjqaotc4nZA7Ck8KOJA2 yCow== 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=SKBMcIRyw+N6ZnB01Y9FvObg+1wiWWYiWJdsuwaenSX38YONwgha66MScJQA+35CUB aEszxOe+hBDmgcTje3MVh51UPFKk7n4KQmKkgE3/yu7XdYnNpxf1B8sc/ZRB1EJQ+bjK h91jNWEZ7d29OxWnpLLUSSq5p9rN5/F7CbL8BCMvydmNR/hzrbpgQ91FCSVSk4dKrI5x 64hUXtwfo/7OzVAm+X2+4zIiAEAH5hhij4Qqlqyod9yne/QgyWOTWs/IjRNNjp+nuKjk 1E9LKwE39m3GED6M7fs6VFEgiiHA0bbv8QCfIJS4bl3sEeZw6ZXC5GrZXgtcQgVmzqXY /6kw== X-Gm-Message-State: AKaTC023Tpybuhwg9DvruzdAzaCI+KSWWC7MNZj7Q0ZyPFYIGDVVMaxSWIc+P8gP2Ej0vg== X-Received: by 10.28.54.3 with SMTP id d3mr1921237wma.34.1479987340890; Thu, 24 Nov 2016 03:35:40 -0800 (PST) Received: from weierstrass.local.net ([91.200.110.70]) by smtp.gmail.com with ESMTPSA id l74sm7786020wmg.2.2016.11.24.03.35.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Nov 2016 03:35:40 -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, ehkinzie@gmail.com, bernard.iremonger@intel.com, stable@dpdk.org Date: Thu, 24 Nov 2016 12:26:45 +0100 Message-Id: <1479986809-14934-2-git-send-email-jblunck@infradead.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479986809-14934-1-git-send-email-jblunck@infradead.org> References: <1479986809-14934-1-git-send-email-jblunck@infradead.org> Subject: [dpdk-dev] [PATCH v2 1/5] 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: Thu, 24 Nov 2016 11:35:41 -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