net/netvsc: fix transmit descriptor pool cleanup
authorStephen Hemminger <stephen@networkplumber.org>
Fri, 14 Dec 2018 01:26:20 +0000 (17:26 -0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 21 Dec 2018 15:22:40 +0000 (16:22 +0100)
On device close or startup errors, the transmit descriptor pool
was being left behind.

Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
drivers/net/netvsc/hn_ethdev.c
drivers/net/netvsc/hn_rxtx.c
drivers/net/netvsc/hn_var.h

index 2256147..6c40ac7 100644 (file)
@@ -801,6 +801,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;
 }
@@ -823,6 +824,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);
index 622a839..6197118 100644 (file)
@@ -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;
index cd173f6..7f3266c 100644 (file)
@@ -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,