From d1d1e664c6c4bab692b47d714c4063d34b396201 Mon Sep 17 00:00:00 2001 From: Bernard Iremonger Date: Mon, 27 Jul 2015 16:54:36 +0100 Subject: [PATCH] bonding: free queue memory when closing Add function bond_ethdev_free_queues() and call from the bond_ethdev_close() function. Signed-off-by: Bernard Iremonger --- drivers/net/bonding/rte_eth_bond_pmd.c | 21 ++++++++++++++++++++- drivers/net/bonding/rte_eth_bond_private.h | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index e1a9e7bcc7..5cc637239e 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -1512,6 +1512,24 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev) return 0; } +static void +bond_ethdev_free_queues(struct rte_eth_dev *dev) +{ + uint8_t i; + + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rte_free(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++) { + rte_free(dev->data->tx_queues[i]); + dev->data->tx_queues[i] = NULL; + } + dev->data->nb_tx_queues = 0; +} + void bond_ethdev_stop(struct rte_eth_dev *eth_dev) { @@ -1553,8 +1571,9 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev) } void -bond_ethdev_close(struct rte_eth_dev *dev __rte_unused) +bond_ethdev_close(struct rte_eth_dev *dev) { + bond_ethdev_free_queues(dev); } /* forward declaration */ diff --git a/drivers/net/bonding/rte_eth_bond_private.h b/drivers/net/bonding/rte_eth_bond_private.h index 9f57f4dd17..038bca64ff 100644 --- a/drivers/net/bonding/rte_eth_bond_private.h +++ b/drivers/net/bonding/rte_eth_bond_private.h @@ -288,6 +288,6 @@ void bond_ethdev_stop(struct rte_eth_dev *eth_dev); void -bond_ethdev_close(struct rte_eth_dev *dev __rte_unused); +bond_ethdev_close(struct rte_eth_dev *dev); #endif -- 2.20.1