summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRastislav Cernay <cernay@netcope.com>2019-08-27 23:04:19 +0200
committerFerruh Yigit <ferruh.yigit@intel.com>2019-08-28 15:09:28 +0200
commit3890413fc50abe0bafb0c0a1dccfa569e92dbcb3 (patch)
treed355adb18b6cf21e1652ee16038bf9b29e2b696e
parentf1d59d3fc8adc8338c010f0ab742a8abb761c4c8 (diff)
downloaddpdk-next-eventdev-3890413fc50abe0bafb0c0a1dccfa569e92dbcb3.zip
dpdk-next-eventdev-3890413fc50abe0bafb0c0a1dccfa569e92dbcb3.tar.gz
dpdk-next-eventdev-3890413fc50abe0bafb0c0a1dccfa569e92dbcb3.tar.xz
net/szedata2: remove resources when port is closed
The rte_eth_dev_close() function now handles freeing resources for devices (e.g., mac_addrs). To conform with the new close() behaviour we are asserting the RTE_ETH_DEV_CLOSE_REMOVE flag so that rte_eth_dev_close() releases all device level dynamic memory. Signed-off-by: Rastislav Cernay <cernay@netcope.com> Acked-by: Jan Remes <remes@netcope.com>
-rw-r--r--drivers/net/szedata2/rte_eth_szedata2.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index d5dec1b..99d5ca5 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1157,12 +1157,15 @@ eth_tx_queue_release(void *q)
static void
eth_dev_close(struct rte_eth_dev *dev)
{
+ struct pmd_internals *internals = dev->data->dev_private;
uint16_t i;
uint16_t nb_rx = dev->data->nb_rx_queues;
uint16_t nb_tx = dev->data->nb_tx_queues;
eth_dev_stop(dev);
+ free(internals->sze_dev_path);
+
for (i = 0; i < nb_rx; i++) {
eth_rx_queue_release(dev->data->rx_queues[i]);
dev->data->rx_queues[i] = NULL;
@@ -1173,6 +1176,9 @@ eth_dev_close(struct rte_eth_dev *dev)
dev->data->tx_queues[i] = NULL;
}
dev->data->nb_tx_queues = 0;
+
+ rte_free(dev->data->mac_addrs);
+ dev->data->mac_addrs = NULL;
}
static int
@@ -1475,6 +1481,9 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev, struct port_info *pi)
PMD_INIT_LOG(INFO, "Initializing eth_dev %s (driver %s)", data->name,
RTE_STR(RTE_SZEDATA2_DRIVER_NAME));
+ /* Let rte_eth_dev_close() release the port resources */
+ dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
/* Fill internal private structure. */
internals->dev = dev;
/* Get index of szedata2 device file and create path to device file */
@@ -1537,12 +1546,9 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev, struct port_info *pi)
static int
rte_szedata2_eth_dev_uninit(struct rte_eth_dev *dev)
{
- struct pmd_internals *internals = (struct pmd_internals *)
- dev->data->dev_private;
-
PMD_INIT_FUNC_TRACE();
- free(internals->sze_dev_path);
+ eth_dev_close(dev);
PMD_DRV_LOG(INFO, "%s device %s successfully uninitialized",
RTE_STR(RTE_SZEDATA2_DRIVER_NAME), dev->data->name);