DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Stephen Hemminger <sthemmin@microsoft.com>
Subject: [dpdk-dev] [PATCH 2/3] net/netvsc: cleanup transmit descriptor pool
Date: Thu, 13 Dec 2018 17:26:20 -0800	[thread overview]
Message-ID: <20181214012621.15213-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20181214012621.15213-1-stephen@networkplumber.org>

On device close or startup errors, the transmit descriptor pool
was being left behind.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
 drivers/net/netvsc/hn_ethdev.c |  2 ++
 drivers/net/netvsc/hn_rxtx.c   | 11 +++++++++++
 drivers/net/netvsc/hn_var.h    |  1 +
 3 files changed, 14 insertions(+)

diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index d7ac0c7320b0..de872212d3f3 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -796,6 +796,7 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev)
 failed:
 	PMD_INIT_LOG(NOTICE, "device init failed");
 
+	hn_tx_pool_uninit(eth_dev);
 	hn_detach(hv);
 	return err;
 }
@@ -818,6 +819,7 @@ eth_hn_dev_uninit(struct rte_eth_dev *eth_dev)
 	eth_dev->rx_pkt_burst = NULL;
 
 	hn_detach(hv);
+	hn_tx_pool_uninit(eth_dev);
 	rte_vmbus_chan_close(hv->primary->chan);
 	rte_free(hv->primary);
 	rte_eth_dev_owner_delete(hv->owner.id);
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 622a83983e10..6197118b01ee 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -199,6 +199,17 @@ hn_tx_pool_init(struct rte_eth_dev *dev)
 	return 0;
 }
 
+void
+hn_tx_pool_uninit(struct rte_eth_dev *dev)
+{
+	struct hn_data *hv = dev->data->dev_private;
+
+	if (hv->tx_pool) {
+		rte_mempool_free(hv->tx_pool);
+		hv->tx_pool = NULL;
+	}
+}
+
 static void hn_reset_txagg(struct hn_tx_queue *txq)
 {
 	txq->agg_szleft = txq->agg_szmax;
diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h
index cd173f6af942..7f3266c451fb 100644
--- a/drivers/net/netvsc/hn_var.h
+++ b/drivers/net/netvsc/hn_var.h
@@ -150,6 +150,7 @@ uint16_t hn_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		      uint16_t nb_pkts);
 
 int	hn_tx_pool_init(struct rte_eth_dev *dev);
+void	hn_tx_pool_uninit(struct rte_eth_dev *dev);
 int	hn_dev_link_update(struct rte_eth_dev *dev, int wait);
 int	hn_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			      uint16_t nb_desc, unsigned int socket_id,
-- 
2.19.2

  parent reply	other threads:[~2018-12-14  1:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14  1:26 [dpdk-dev] [PATCH 0/3] net/netvsc: misc fixes Stephen Hemminger
2018-12-14  1:26 ` [dpdk-dev] [PATCH 1/3] net/netvsc: support receive without vlan strip Stephen Hemminger
2018-12-14 16:09   ` Ferruh Yigit
2018-12-14 16:28     ` Stephen Hemminger
2018-12-17 10:27       ` Ferruh Yigit
2018-12-14  1:26 ` Stephen Hemminger [this message]
2018-12-17 10:46   ` [dpdk-dev] [PATCH 2/3] net/netvsc: cleanup transmit descriptor pool Ferruh Yigit
2018-12-17 22:11     ` Ferruh Yigit
2018-12-14  1:26 ` [dpdk-dev] [PATCH 3/3] net/netvsc: not finding VF should not cause failure Stephen Hemminger
2018-12-17 10:49   ` Ferruh Yigit
     [not found]     ` <DM5PR21MB0698C89DE76C533F41190931CCBC0@DM5PR21MB0698.namprd21.prod.outlook.com>
2018-12-17 22:11       ` Ferruh Yigit
2018-12-17 22:12         ` Ferruh Yigit
2018-12-17 22:13 ` [dpdk-dev] [PATCH 0/3] net/netvsc: misc fixes Ferruh Yigit
2018-12-18  6:32   ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181214012621.15213-3-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=sthemmin@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).