Skip to contentSkip to conversation

net/ixgbe: fix device hotplug remove

PATCH Superseded Di ChenxuX 2 participants 8 messages Nov 6, 2019 – Nov 13, 2019 Network drivers

lore
Share & tools
lore

Di ChenxuX

author
#0 lore raw

PATCH 1/1 net/ixgbe: fix device hotplug remove

testpmd will occur infinite loops when device hotplug remove. We can fix the issue by using the pci generic remove function

Fixes f2f4990eff94 ("net/ixgbe: release port upon close")
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +1 -10
index dbce7a80e..84b98071d 100644
@@ -1796,16 +1796,7 @@ eth_ixgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 
 static int eth_ixgbe_pci_remove(struct rte_pci_device *pci_dev)
 {
-	struct rte_eth_dev *ethdev;
-
-	ethdev = rte_eth_dev_allocated(pci_dev->device.name);
-	if (!ethdev)
-		return -ENODEV;
-
-	if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
-		return rte_eth_dev_destroy(ethdev, ixgbe_vf_representor_uninit);
-	else
-		return rte_eth_dev_destroy(ethdev, eth_ixgbe_dev_uninit);
+	return rte_eth_dev_pci_generic_remove(pci_dev, eth_ixgbe_dev_uninit);
 }
 
 static struct rte_pci_driver rte_ixgbe_pmd = {
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v2 1/1 net/ixgbe: fix device hotplug remove

testpmd will occur infinite loops when device hotplug remove. We can fix the issue by using the pci generic remove function

Fixes f2f4990eff94 ("net/ixgbe: release port upon close")

v2:
reverted the code about ixgbe_vf_representor_uninit.

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +3 -2
index dbce7a80e..7ec55a4de 100644
@@ -1800,12 +1800,13 @@ static int eth_ixgbe_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, ixgbe_vf_representor_uninit);
 	else
-		return rte_eth_dev_destroy(ethdev, eth_ixgbe_dev_uninit);
+		return rte_eth_dev_pci_generic_remove(pci_dev,
+						eth_ixgbe_dev_uninit);
 }
 
 static struct rte_pci_driver rte_ixgbe_pmd = {
Signature · 1 line
2.17.1
#2 lore raw
Quoted 18 lines · Di ChenxuX

testpmd will occur infinite loops when device hotplug remove. We can fix the issue by using the pci generic remove function

Fixes f2f4990eff94 ("net/ixgbe: release port upon close")

v2:
reverted the code about ixgbe_vf_representor_uninit.
---
drivers/net/ixgbe/ixgbe_ethdev.c | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
index dbce7a80e..7ec55a4de 100644

drivers/net/ixgbe/ixgbe_ethdev.c static int eth_ixgbe_pci_remove(struct rte_pci_device *pci_dev) · line 1806

Quoted 8 lines
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
@@ -1800,12 +1800,13 @@ static int eth_ixgbe_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, ixgbe_vf_representor_uninit);

Can we use rte_eth_dev_pci_generic_remove for vf representor as well?

Thanks,
Xiaolong

Quoted 10 lines
drivers/net/ixgbe/ixgbe_ethdev.c +2 -1
 	else
-		return rte_eth_dev_destroy(ethdev, eth_ixgbe_dev_uninit);
+		return rte_eth_dev_pci_generic_remove(pci_dev,
+						eth_ixgbe_dev_uninit);
 }
 
 static struct rte_pci_driver rte_ixgbe_pmd = {
Signature · 1 line
2.17.1
#3 lore raw

Hi,

Quoted 34 lines

-----Original Message-----
From: Ye, Xiaolong
Sent: Monday, November 11, 2019 4:42 PM
To: Di, ChenxuX <[email protected]>
Cc: [email protected]; Yang, Qiming <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] net/ixgbe: fix device hotplug remove

Quoted 7 lines · Di ChenxuX

testpmd will occur infinite loops when device hotplug remove. We can fix the issue by using the pci generic remove function

Fixes f2f4990eff94 ("net/ixgbe: release port upon close")

Review

Quoted 7 lines

v2:
reverted the code about ixgbe_vf_representor_uninit.
---
drivers/net/ixgbe/ixgbe_ethdev.c | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/net/ixgbe/ixgbe_ethdev.c

drivers/net/ixgbe/ixgbe_ethdev.c static int eth_ixgbe_pci_remove(struct

Quoted 4 lines

index dbce7a80e..7ec55a4de 100644

drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
@@ -1800,12 +1800,13 @@ static int eth_ixgbe_pci_remove(struct

rte_pci_device *pci_dev)

Quoted 6 lines
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
 	ethdev = rte_eth_dev_allocated(pci_dev->device.name);
 	if (!ethdev)
-		return -ENODEV;
+		return 0;
 
Quoted 6 lines

drivers/net/ixgbe/ixgbe_ethdev.c static int eth_ixgbe_pci_remove(struct · line 1805

Quoted 2 lines
drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
 	if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
 		return rte_eth_dev_destroy(ethdev,

ixgbe_vf_representor_uninit);

Can we use rte_eth_dev_pci_generic_remove for vf representor as well?

I think it can be used. Should I do it and send a new patch?

Thx
Di Chenxu

Quoted 12 lines

Thanks,
Xiaolong

Quoted 10 lines
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
 	else
-		return rte_eth_dev_destroy(ethdev, eth_ixgbe_dev_uninit);
+		return rte_eth_dev_pci_generic_remove(pci_dev,
+						eth_ixgbe_dev_uninit);
 }
 
 static struct rte_pci_driver rte_ixgbe_pmd = {
--

2.17.1

#4 lore raw
Quoted 36 lines · ChenxuX

Hi,

Quoted 34 lines

-----Original Message-----
From: Ye, Xiaolong
Sent: Monday, November 11, 2019 4:42 PM
To: Di, ChenxuX <[email protected]>
Cc: [email protected]; Yang, Qiming <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] net/ixgbe: fix device hotplug remove

Quoted 7 lines · Di ChenxuX

testpmd will occur infinite loops when device hotplug remove. We can fix the issue by using the pci generic remove function

Fixes f2f4990eff94 ("net/ixgbe: release port upon close")

Review

Quoted 7 lines

v2:
reverted the code about ixgbe_vf_representor_uninit.
---
drivers/net/ixgbe/ixgbe_ethdev.c | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/net/ixgbe/ixgbe_ethdev.c

drivers/net/ixgbe/ixgbe_ethdev.c static int eth_ixgbe_pci_remove(struct

Quoted 4 lines

index dbce7a80e..7ec55a4de 100644

drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
@@ -1800,12 +1800,13 @@ static int eth_ixgbe_pci_remove(struct

rte_pci_device *pci_dev)

Quoted 6 lines
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
 	ethdev = rte_eth_dev_allocated(pci_dev->device.name);
 	if (!ethdev)
-		return -ENODEV;
+		return 0;
 
Quoted 8 lines
Quoted 6 lines

drivers/net/ixgbe/ixgbe_ethdev.c static int eth_ixgbe_pci_remove(struct · line 1805

Quoted 2 lines
drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
 	if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
 		return rte_eth_dev_destroy(ethdev,

ixgbe_vf_representor_uninit);

Can we use rte_eth_dev_pci_generic_remove for vf representor as well?

I think it can be used. Should I do it and send a new patch?

Yes, please send a new patch after verification, and don't forget to remove rte_eth_dev_allocated check int eth_ixgbe_pci_remove, since it has been contained in rte_eth_dev_pci_generic_remove.

Same for i40e patch.

Thanks,
Xiaolong

Quoted 16 lines

Thx
Di Chenxu

Quoted 12 lines

Thanks,
Xiaolong

Quoted 10 lines
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
 	else
-		return rte_eth_dev_destroy(ethdev, eth_ixgbe_dev_uninit);
+		return rte_eth_dev_pci_generic_remove(pci_dev,
+						eth_ixgbe_dev_uninit);
 }
 
 static struct rte_pci_driver rte_ixgbe_pmd = {
--

2.17.1

#5 lore raw
Quoted 51 lines

-----Original Message-----
From: Ye, Xiaolong
Sent: Monday, November 11, 2019 5:00 PM
To: Di, ChenxuX <[email protected]>
Cc: [email protected]; Yang, Qiming <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] net/ixgbe: fix device hotplug remove

Quoted 41 lines · ChenxuX

Hi,

Quoted 39 lines

-----Original Message-----
From: Ye, Xiaolong
Sent: Monday, November 11, 2019 4:42 PM
To: Di, ChenxuX <[email protected]>
Cc: [email protected]; Yang, Qiming <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] net/ixgbe: fix device hotplug remove

Quoted 7 lines · Di ChenxuX

testpmd will occur infinite loops when device hotplug remove. We can fix the issue by using the pci generic remove function

Fixes f2f4990eff94 ("net/ixgbe: release port upon close")

Review

Quoted 7 lines

v2:
reverted the code about ixgbe_vf_representor_uninit.
---
drivers/net/ixgbe/ixgbe_ethdev.c | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/net/ixgbe/ixgbe_ethdev.c

drivers/net/ixgbe/ixgbe_ethdev.c static int eth_ixgbe_pci_remove(struct

Quoted 4 lines

index dbce7a80e..7ec55a4de 100644

drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
@@ -1800,12 +1800,13 @@ static int eth_ixgbe_pci_remove(struct

rte_pci_device *pci_dev)

drivers/net/ixgbe/ixgbe_ethdev.c static int eth_ixgbe_pci_remove(struct rte_pci_device *pci_dev)

Quoted 8 lines
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
 	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,

ixgbe_vf_representor_uninit);

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

Can we use rte_eth_dev_pci_generic_remove for vf representor as well?

I think it can be used. Should I do it and send a new patch?

Yes, please send a new patch after verification, and don't forget to remove rte_eth_dev_allocated check int eth_ixgbe_pci_remove, since it has been contained in rte_eth_dev_pci_generic_remove.

Ok,I will prepare new patch.
however the ethdev->data->dev_flags need to be check, I don't think rte_eth_dev_allocated
Can be removed.

Thx
Di Chenxu

Quoted 21 lines

Same for i40e patch.

Thanks,
Xiaolong

Quoted 16 lines

Thx
Di Chenxu

Quoted 12 lines

Thanks,
Xiaolong

Quoted 10 lines
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
 	else
-		return rte_eth_dev_destroy(ethdev, eth_ixgbe_dev_uninit);
+		return rte_eth_dev_pci_generic_remove(pci_dev,
+						eth_ixgbe_dev_uninit);
 }
 
 static struct rte_pci_driver rte_ixgbe_pmd = {
--

2.17.1

author
#6 lore raw

PATCH v3 1/1 net/ixgbe: fix device hotplug remove

In reply to Di ChenxuX

testpmd will occur infinite loops when device hotplug remove. We can fix the issue by using the pci generic remove function

Fixes f2f4990eff94 ("net/ixgbe: release port upon close")

v4:
used generic remove function for ixgbe_vf_representor_uninit. v3:
reverted the code about ixgbe_vf_representor_uninit.

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +5 -3
index dbce7a80e..94721141a 100644
@@ -1800,12 +1800,14 @@ static int eth_ixgbe_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, ixgbe_vf_representor_uninit);
+		return rte_eth_dev_pci_generic_remove(pci_dev,
+					ixgbe_vf_representor_uninit);
 	else
-		return rte_eth_dev_destroy(ethdev, eth_ixgbe_dev_uninit);
+		return rte_eth_dev_pci_generic_remove(pci_dev,
+						eth_ixgbe_dev_uninit);
 }
 
 static struct rte_pci_driver rte_ixgbe_pmd = {
Signature · 1 line
2.17.1
Acked-by on v3 1/1 Applied
#7 lore raw
Quoted 5 lines · Di ChenxuX

testpmd will occur infinite loops when device hotplug remove. We can fix the issue by using the pci generic remove function

Fixes f2f4990eff94 ("net/ixgbe: release port upon close")
Quoted 7 lines

v4:
used generic remove function for ixgbe_vf_representor_uninit. v3:
reverted the code about ixgbe_vf_representor_uninit.
---

Please put the change log after '---' marker.

Applied to dpdk-next-net-intel with changelog removed. Thanks.