path: root/drivers/net/mlx5/mlx5.c
diff options
authorThomas Monjalon <>2018-11-11 23:46:11 +0100
committerFerruh Yigit <>2018-11-14 00:35:53 +0100
commit15febafdd43fd300c7178f95e79013d3a81e8967 (patch)
tree2332ab68a467a8ba3014196b5e447e8305e491b6 /drivers/net/mlx5/mlx5.c
parentf3698c3d09a69ea398a1c5c3c01083a84ee173b0 (diff)
drivers/net: set close behaviour flag at probing
The ethdev flag RTE_ETH_DEV_CLOSE_REMOVE is set for drivers having migrated to the new behaviour of rte_eth_dev_close(). As any other flag, it can be useful to know about its value as soon as the port is probed. Unfortunately, it was set inside the close operation, just before being erased by memset() in rte_eth_dev_release_port(). The flag assignment is moved to the probing stage, so it can be checked by the application in order to anticipate the behaviour. Fixes: 42603bbdb58e ("net/mlx5: release port on close") Fixes: 6c99085d972b ("net/vmxnet3: fix hot-unplug") Fixes: 4d7877fde2ef ("net/ena: remove resources when port is being closed") Signed-off-by: Thomas Monjalon <> Acked-by: Luca Boccassi <> Reviewed-by: Ferruh Yigit <>
Diffstat (limited to 'drivers/net/mlx5/mlx5.c')
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index ed1fcfc..9e5cab1 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -347,11 +347,6 @@ mlx5_dev_close(struct rte_eth_dev *dev)
memset(priv, 0, sizeof(*priv));
- * flag to rte_eth_dev_close() that it should release the port resources
- * (calling rte_eth_dev_release_port()) in addition to closing it.
- */
- dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
- /*
* Reset mac_addrs to NULL such that it is not freed as part of
* rte_eth_dev_release_port(). mac_addrs is part of dev_private so
* it is freed when dev_private is freed.
@@ -1114,6 +1109,8 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
err = ENOMEM;
goto error;
+ /* Flag to call rte_eth_dev_release_port() in rte_eth_dev_close(). */
+ eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
if (priv->representor) {
eth_dev->data->dev_flags |= RTE_ETH_DEV_REPRESENTOR;
eth_dev->data->representor_id = priv->representor_id;