From: Bernard Iremonger Date: Thu, 2 Jul 2015 14:36:51 +0000 (+0100) Subject: ixgbe: free queue memory when closing X-Git-Tag: spdx-start~8695 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=5b5edfd0406d95a0432db62bd48ad442bebd896b;p=dpdk.git ixgbe: free queue memory when closing Add ixgbe_dev_free_queues() function and call it from close() functions. Signed-off-by: Bernard Iremonger Acked-by: Konstantin Ananyev --- diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index ec470f6bfe..3a8cff0b17 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1939,6 +1939,8 @@ ixgbe_dev_close(struct rte_eth_dev *dev) ixgbe_dev_stop(dev); hw->adapter_stopped = 1; + ixgbe_dev_free_queues(dev); + ixgbe_disable_pcie_master(hw); /* reprogram the RAR[0] in case user changed it. */ @@ -3338,6 +3340,8 @@ ixgbevf_dev_close(struct rte_eth_dev *dev) ixgbevf_dev_stop(dev); + ixgbe_dev_free_queues(dev); + /* reprogram the RAR[0] in case user changed it. */ ixgbe_set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV); } diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index a79d569eea..c16c11dc74 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -313,6 +313,8 @@ struct ixgbe_adapter { */ void ixgbe_dev_clear_queues(struct rte_eth_dev *dev); +void ixgbe_dev_free_queues(struct rte_eth_dev *dev); + void ixgbe_dev_rx_queue_release(void *rxq); void ixgbe_dev_tx_queue_release(void *txq); diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index a7c94a943f..9b2d6377fe 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -2658,6 +2658,26 @@ ixgbe_dev_clear_queues(struct rte_eth_dev *dev) } } +void +ixgbe_dev_free_queues(struct rte_eth_dev *dev) +{ + unsigned i; + + PMD_INIT_FUNC_TRACE(); + + for (i = 0; i < dev->data->nb_rx_queues; i++) { + ixgbe_dev_rx_queue_release(dev->data->rx_queues[i]); + dev->data->rx_queues[i] = NULL; + } + dev->data->nb_rx_queues = 0; + + for (i = 0; i < dev->data->nb_tx_queues; i++) { + ixgbe_dev_tx_queue_release(dev->data->tx_queues[i]); + dev->data->tx_queues[i] = NULL; + } + dev->data->nb_tx_queues = 0; +} + /********************************************************************* * * Device RX/TX init functions