summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Qiu <michael.qiu@intel.com>2015-07-14 20:45:44 +0800
committerThomas Monjalon <thomas.monjalon@6wind.com>2015-07-19 22:24:41 +0200
commit2cb9c53449d390b3d5de15f361006fb364c4bf9d (patch)
tree00dbccb08cf6f47dbdcdf5838c1737b61d74019d
parent6b4537128394ab15b943145f3d1e03a1fb07bbb8 (diff)
downloaddpdk-2cb9c53449d390b3d5de15f361006fb364c4bf9d.zip
dpdk-2cb9c53449d390b3d5de15f361006fb364c4bf9d.tar.gz
dpdk-2cb9c53449d390b3d5de15f361006fb364c4bf9d.tar.xz
fm10k: free queue memory when closing
When close a port, lots of memory should be released, such as software rings, queues, etc. Signed-off-by: Michael Qiu <michael.qiu@intel.com>
-rw-r--r--drivers/net/fm10k/fm10k_ethdev.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 902ccae..2f9dc3e 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -65,6 +65,8 @@ static void
fm10k_MAC_filter_set(struct rte_eth_dev *dev, const u8 *mac, bool add);
static void
fm10k_MACVLAN_remove_all(struct rte_eth_dev *dev);
+static void fm10k_tx_queue_release(void *queue);
+static void fm10k_rx_queue_release(void *queue);
static void
fm10k_mbx_initlock(struct fm10k_hw *hw)
@@ -804,11 +806,31 @@ fm10k_dev_stop(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
- for (i = 0; i < dev->data->nb_tx_queues; i++)
- fm10k_dev_tx_queue_stop(dev, i);
+ if (dev->data->tx_queues)
+ for (i = 0; i < dev->data->nb_tx_queues; i++)
+ fm10k_dev_tx_queue_stop(dev, i);
- for (i = 0; i < dev->data->nb_rx_queues; i++)
- fm10k_dev_rx_queue_stop(dev, i);
+ if (dev->data->rx_queues)
+ for (i = 0; i < dev->data->nb_rx_queues; i++)
+ fm10k_dev_rx_queue_stop(dev, i);
+}
+
+static void
+fm10k_dev_queue_release(struct rte_eth_dev *dev)
+{
+ int i;
+
+ PMD_INIT_FUNC_TRACE();
+
+ if (dev->data->tx_queues) {
+ for (i = 0; i < dev->data->nb_tx_queues; i++)
+ fm10k_tx_queue_release(dev->data->tx_queues[i]);
+ }
+
+ if (dev->data->rx_queues) {
+ for (i = 0; i < dev->data->nb_rx_queues; i++)
+ fm10k_rx_queue_release(dev->data->rx_queues[i]);
+ }
}
static void
@@ -823,6 +845,7 @@ fm10k_dev_close(struct rte_eth_dev *dev)
/* Stop mailbox service first */
fm10k_close_mbx_service(hw);
fm10k_dev_stop(dev);
+ fm10k_dev_queue_release(dev);
fm10k_stop_hw(hw);
}