[2/2] net/ark: remove resources when port is close

Message ID 1563541663-10797-2-git-send-email-ed.czeck@atomicrules.com
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • [1/2] net/ark: remove queue offset based on port id
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Ed Czeck July 19, 2019, 1:07 p.m.
Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the resources
for the port can be freed by rte_eth_dev_close()

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
---
 drivers/net/ark/ark_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)

Patch

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 86e500e..3435728 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -261,6 +261,8 @@  eth_ark_dev_init(struct rte_eth_dev *dev)
 	/* Use dummy function until setup */
 	dev->rx_pkt_burst = &eth_ark_recv_pkts_noop;
 	dev->tx_pkt_burst = &eth_ark_xmit_pkts_noop;
+	/* Let rte_eth_dev_close() release the port resources */
+	dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
 
 	ark->bar0 = (uint8_t *)pci_dev->mem_resource[0].addr;
 	ark->a_bar = (uint8_t *)pci_dev->mem_resource[2].addr;
@@ -706,6 +708,9 @@  eth_ark_dev_close(struct rte_eth_dev *dev)
 		eth_ark_dev_rx_queue_release(dev->data->rx_queues[i]);
 		dev->data->rx_queues[i] = 0;
 	}
+
+	rte_free(dev->data->mac_addrs);
+	dev->data->mac_addrs = 0;
 }
 
 static void