summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5.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/mlx5/mlx5.c
parentf6a12685a5ff64188b5191f52fd486465e4919db (diff)
downloaddpdk-next-eventdev-e16adf08e54d5b1ff3b1116c372bbca279fced9d.zip
dpdk-next-eventdev-e16adf08e54d5b1ff3b1116c372bbca279fced9d.tar.gz
dpdk-next-eventdev-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/mlx5/mlx5.c')
-rw-r--r--drivers/net/mlx5/mlx5.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 8cbfee1..b2be74b 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1223,11 +1223,16 @@ error:
if (own_domain_id)
claim_zero(rte_eth_switch_domain_free(priv->domain_id));
rte_free(priv);
+ if (eth_dev != NULL)
+ eth_dev->data->dev_private = NULL;
}
if (pd)
claim_zero(mlx5_glue->dealloc_pd(pd));
- if (eth_dev)
+ if (eth_dev != NULL) {
+ /* mac_addrs must not be freed alone because part of dev_private */
+ eth_dev->data->mac_addrs = NULL;
rte_eth_dev_release_port(eth_dev);
+ }
if (ctx)
claim_zero(mlx5_glue->close_device(ctx));
assert(err > 0);
@@ -1447,8 +1452,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
if (!list[i].eth_dev)
continue;
mlx5_dev_close(list[i].eth_dev);
- if (rte_eal_process_type() == RTE_PROC_PRIMARY)
- rte_free(list[i].eth_dev->data->dev_private);
+ /* mac_addrs must not be freed because in dev_private */
+ list[i].eth_dev->data->mac_addrs = NULL;
claim_zero(rte_eth_dev_release_port(list[i].eth_dev));
}
/* Restore original error. */