summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Iremonger <bernard.iremonger@intel.com>2015-07-15 14:51:03 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2015-07-19 22:24:42 +0200
commit941d64b5bfa6cc360e7ad9442a17dde13e00e1d0 (patch)
treeacdad8cc5332b2ef966453ff976e368de9ae917f
parent5382b188fb8a6f2ffd5e9c884e53f84c526c8b50 (diff)
downloaddpdk-941d64b5bfa6cc360e7ad9442a17dde13e00e1d0.zip
dpdk-941d64b5bfa6cc360e7ad9442a17dde13e00e1d0.tar.gz
dpdk-941d64b5bfa6cc360e7ad9442a17dde13e00e1d0.tar.xz
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 <bernard.iremonger@intel.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
-rw-r--r--drivers/net/virtio/virtio_ethdev.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 4d5412a..9ca9bb2 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -439,6 +439,22 @@ virtio_dev_cq_queue_setup(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx,
}
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)
{
struct virtio_hw *hw = dev->data->dev_private;
@@ -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