[2/3] net/netvsc: cleanup transmit descriptor pool
Checks
Commit Message
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(+)
Comments
On 12/14/2018 1:26 AM, Stephen Hemminger wrote:
> On device close or startup errors, the transmit descriptor pool
> was being left behind.
So this is fixing possible memory leak, should this be an "fix" commit, so that
it can be backported to stable trees?
>
> Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
<...>
On 12/17/2018 10:46 AM, Ferruh Yigit wrote:
> On 12/14/2018 1:26 AM, Stephen Hemminger wrote:
>> On device close or startup errors, the transmit descriptor pool
>> was being left behind.
>
> So this is fixing possible memory leak, should this be an "fix" commit, so that
> it can be backported to stable trees?
Added:
Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device")
Cc: stable@dpdk.org
>
>>
>> Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
>
> <...>
>
@@ -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);
@@ -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;
@@ -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,