[v1] drivers/net: release port upon close
Checks
Commit Message
From: Di ChenxuX <chenxux.di@intel.com>
Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private
resources for the port can be freed by rte_eth_dev_close().
This patch cover all the intel drivers
Signed-off-by: Di ChenxuX <chenxux.di@intel.com>
---
drivers/net/e1000/igb_ethdev.c | 5 +++++
drivers/net/fm10k/fm10k_ethdev.c | 5 +++++
drivers/net/i40e/i40e_ethdev.c | 5 +++++
drivers/net/ice/ice_ethdev.c | 5 +++++
drivers/net/ixgbe/ixgbe_ethdev.c | 5 +++++
5 files changed, 25 insertions(+)
@@ -843,6 +843,11 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)
rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr,
ð_dev->data->mac_addrs[0]);
+ /* Pass the information to the rte_eth_dev_close() that it should also
+ * release the private port resources.
+ */
+ dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
/* initialize the vfta */
memset(shadow_vfta, 0, sizeof(*shadow_vfta));
@@ -3103,6 +3103,11 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
&dev->data->mac_addrs[0]);
}
+ /* Pass the information to the rte_eth_dev_close() that it should also
+ * release the private port resources.
+ */
+ dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
/* Reset the hw statistics */
fm10k_stats_reset(dev);
@@ -1520,6 +1520,11 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr,
&dev->data->mac_addrs[0]);
+ /* Pass the information to the rte_eth_dev_close() that it should also
+ * release the private port resources.
+ */
+ dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
/* Init dcb to sw mode by default */
ret = i40e_dcb_init_configure(dev, TRUE);
if (ret != I40E_SUCCESS) {
@@ -1488,6 +1488,11 @@ ice_dev_init(struct rte_eth_dev *dev)
goto err_init_mac;
}
+ /* Pass the information to the rte_eth_dev_close() that it should also
+ * release the private port resources.
+ */
+ dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
ret = ice_res_pool_init(&pf->msix_pool, 1,
hw->func_caps.common_cap.num_msix_vectors - 1);
if (ret) {
@@ -1245,6 +1245,11 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
return -ENOMEM;
}
+ /* Pass the information to the rte_eth_dev_close() that it should also
+ * release the private port resources.
+ */
+ dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
/* initialize the vfta */
memset(shadow_vfta, 0, sizeof(*shadow_vfta));