net/netvsc: fix transmit descriptor pool cleanup

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

Fixes: 4e9c73e96e ("net/netvsc: add Hyper-V network device")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
This commit is contained in:
Stephen Hemminger 2018-12-13 17:26:20 -08:00 committed by Ferruh Yigit
parent 3c32fdf432
commit c578d8507b
3 changed files with 14 additions and 0 deletions

View 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);

View 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;

View 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,