summaryrefslogtreecommitdiff
path: root/drivers/net/netvsc/hn_ethdev.c
diff options
context:
space:
mode:
authorThomas Monjalon <thomas@monjalon.net>2018-10-19 04:07:55 +0200
committerFerruh Yigit <ferruh.yigit@intel.com>2018-10-26 22:14:05 +0200
commite16adf08e54d5b1ff3b1116c372bbca279fced9d (patch)
tree7c837a548bafd12bffa9ef8ee74143243f0af6d7 /drivers/net/netvsc/hn_ethdev.c
parentf6a12685a5ff64188b5191f52fd486465e4919db (diff)
downloaddpdk-e16adf08e54d5b1ff3b1116c372bbca279fced9d.zip
dpdk-e16adf08e54d5b1ff3b1116c372bbca279fced9d.tar.gz
dpdk-e16adf08e54d5b1ff3b1116c372bbca279fced9d.tar.xz
ethdev: free all common data when releasing port
This is a clean-up of common ethdev data freeing. All data freeing are moved to rte_eth_dev_release_port() and done only in case of primary process. It is probably fixing some memory leaks for PMDs which were not freeing all data. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Diffstat (limited to 'drivers/net/netvsc/hn_ethdev.c')
-rw-r--r--drivers/net/netvsc/hn_ethdev.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 8e728d6..aa38ee7 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -118,20 +118,11 @@ eth_dev_vmbus_allocate(struct rte_vmbus_device *dev, size_t private_data_size)
static void
eth_dev_vmbus_release(struct rte_eth_dev *eth_dev)
{
+ /* mac_addrs must not be freed alone because part of dev_private */
+ eth_dev->data->mac_addrs = NULL;
/* free ether device */
rte_eth_dev_release_port(eth_dev);
- if (rte_eal_process_type() == RTE_PROC_PRIMARY)
- rte_free(eth_dev->data->dev_private);
-
- eth_dev->data->dev_private = NULL;
-
- /*
- * Secondary process will check the name to attach.
- * Clear this field to avoid attaching a released ports.
- */
- eth_dev->data->name[0] = '\0';
-
eth_dev->device = NULL;
eth_dev->intr_handle = NULL;
}
@@ -829,8 +820,6 @@ eth_hn_dev_uninit(struct rte_eth_dev *eth_dev)
rte_free(hv->primary);
rte_eth_dev_owner_delete(hv->owner.id);
- eth_dev->data->mac_addrs = NULL;
-
return 0;
}