From: Bernard Iremonger Date: Wed, 15 Jul 2015 13:51:03 +0000 (+0100) Subject: virtio: free queue memory when closing X-Git-Tag: spdx-start~8682 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=941d64b5bfa6cc360e7ad9442a17dde13e00e1d0;p=dpdk.git virtio: free queue memory when closing Add function virtio_free_queues() and call from virtio_dev_close() Use virtio_dev_rx_queue_release() and virtio_dev_tx_queue_release() Signed-off-by: Bernard Iremonger Acked-by: Stephen Hemminger --- diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 4d5412a54e..9ca9bb265b 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -438,6 +438,22 @@ virtio_dev_cq_queue_setup(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx, return 0; } +static void +virtio_free_queues(struct rte_eth_dev *dev) +{ + unsigned int i; + + for (i = 0; i < dev->data->nb_rx_queues; i++) + virtio_dev_rx_queue_release(dev->data->rx_queues[i]); + + dev->data->nb_rx_queues = 0; + + for (i = 0; i < dev->data->nb_tx_queues; i++) + virtio_dev_tx_queue_release(dev->data->tx_queues[i]); + + dev->data->nb_tx_queues = 0; +} + static void virtio_dev_close(struct rte_eth_dev *dev) { @@ -452,6 +468,7 @@ virtio_dev_close(struct rte_eth_dev *dev) vtpci_reset(hw); hw->started = 0; virtio_dev_free_mbufs(dev); + virtio_free_queues(dev); } static void