[dpdk-dev,10/22] net/igb: enable port detach on secondary process
diff mbox series

Message ID 20180607123849.14439-11-qi.z.zhang@intel.com
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series
  • enable hotplug on multi-process
Related show

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/checkpatch success coding style OK

Commit Message

Zhang, Qi Z June 7, 2018, 12:38 p.m. UTC
Previously, detach port on secondary process will mess primary
process and cause same device can't be attached again, by take
advantage of rte_eth_release_port_local, we can support this with
minor change.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/e1000/igb_ethdev.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch
diff mbox series

diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index edc7be319..bd2b2d218 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -1089,6 +1089,15 @@  static int eth_igb_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 
 static int eth_igb_pci_remove(struct rte_pci_device *pci_dev)
 {
+	struct rte_eth_dev *ethdev =
+		rte_eth_dev_allocated(pci_dev->device.name);
+
+	if (!ethdev)
+		return -ENODEV;
+
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return rte_eth_dev_release_port_local(ethdev);
+
 	return rte_eth_dev_pci_generic_remove(pci_dev, eth_igb_dev_uninit);
 }