[v3] net/i40e: fix device hotplug remove
diff mbox series

Message ID 20191107062300.32720-1-chenxux.di@intel.com
State Superseded
Delegated to: xiaolong ye
Headers show
Series
  • [v3] net/i40e: fix device hotplug remove
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-compilation success Compile Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Di ChenxuX Nov. 7, 2019, 6:23 a.m. UTC
testpmd will occur infinite loops when device hotplug remove.
We can fix the issue by using the pci generic remove function

Fixes: ac89d46096d5 ("net/i40e: release port upon close")

Signed-off-by: Di ChenxuX <chenxux.di@intel.com>

v3:
reverted the code about i40e_vf_representor_uninit.
v2:
change the code in driver.
---
 drivers/net/i40e/i40e_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Ye Xiaolong Nov. 11, 2019, 8:42 a.m. UTC | #1
On 11/07, Di ChenxuX wrote:
>testpmd will occur infinite loops when device hotplug remove.
>We can fix the issue by using the pci generic remove function
>
>Fixes: ac89d46096d5 ("net/i40e: release port upon close")
>
>Signed-off-by: Di ChenxuX <chenxux.di@intel.com>
>
>v3:
>reverted the code about i40e_vf_representor_uninit.
>v2:
>change the code in driver.
>---
> drivers/net/i40e/i40e_ethdev.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
>index 77a46832c..d67c08c0f 100644
>--- a/drivers/net/i40e/i40e_ethdev.c
>+++ b/drivers/net/i40e/i40e_ethdev.c
>@@ -698,13 +698,13 @@ static int eth_i40e_pci_remove(struct rte_pci_device *pci_dev)
> 
> 	ethdev = rte_eth_dev_allocated(pci_dev->device.name);
> 	if (!ethdev)
>-		return -ENODEV;
>-
>+		return 0;
> 
> 	if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
> 		return rte_eth_dev_destroy(ethdev, i40e_vf_representor_uninit);

Can we use rte_eth_dev_pci_generic_remove for i40e vf representor as well?

Thanks,
Xiaolong
> 	else
>-		return rte_eth_dev_destroy(ethdev, eth_i40e_dev_uninit);
>+		return rte_eth_dev_pci_generic_remove(pci_dev,
>+						eth_i40e_dev_uninit);
> }
> 
> static struct rte_pci_driver rte_i40e_pmd = {
>-- 
>2.17.1
>

Patch
diff mbox series

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 77a46832c..d67c08c0f 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -698,13 +698,13 @@  static int eth_i40e_pci_remove(struct rte_pci_device *pci_dev)
 
 	ethdev = rte_eth_dev_allocated(pci_dev->device.name);
 	if (!ethdev)
-		return -ENODEV;
-
+		return 0;
 
 	if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
 		return rte_eth_dev_destroy(ethdev, i40e_vf_representor_uninit);
 	else
-		return rte_eth_dev_destroy(ethdev, eth_i40e_dev_uninit);
+		return rte_eth_dev_pci_generic_remove(pci_dev,
+						eth_i40e_dev_uninit);
 }
 
 static struct rte_pci_driver rte_i40e_pmd = {