[v6,2/4] net/ixgbe: install ethdev hotplug handler in ixgbe

Message ID 1534503016-31805-3-git-send-email-jia.guo@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series Install eal event handler in i40e/ixgbe |

Checks

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

Commit Message

Guo, Jia Aug. 17, 2018, 10:50 a.m. UTC
  This patch aims to enable hotplug detection in ixgbe PMD.

First, it sets the “RTE_PCI_DRV_INTR_RMV” flag in drv_flags to
announce the ability of hotplug processing. Then, it calls the
“rte_eth_dev_event_handler_install” API to install the device
event handler for ethdev. When the eal device event be detected,
it calls the ethdev callback to process it. If the event is the
hotplug-out event, it will trigger the “RTE_ETH_EVENT_INTR_RMV”
event into the ethdev callback to allow the application's callback
to process hotplug for this ethdev.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
v6->v5:
refine commit log
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 26b1927..37404cf 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1678,6 +1678,9 @@  eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
 	rte_intr_enable(intr_handle);
 	ixgbevf_intr_enable(eth_dev);
 
+	/* install the dev event handler for ethdev. */
+	rte_eth_dev_event_handler_install(eth_dev);
+
 	PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x mac.type=%s",
 		     eth_dev->data->port_id, pci_dev->id.vendor_id,
 		     pci_dev->id.device_id, "ixgbe_mac_82599_vf");
@@ -1718,6 +1721,9 @@  eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
 	rte_intr_callback_unregister(intr_handle,
 				     ixgbevf_dev_interrupt_handler, eth_dev);
 
+	/* uninstall the dev event handler for ethdev. */
+	rte_eth_dev_event_handler_uninstall(eth_dev);
+
 	return 0;
 }
 
@@ -1801,7 +1807,7 @@  static int eth_ixgbe_pci_remove(struct rte_pci_device *pci_dev)
 static struct rte_pci_driver rte_ixgbe_pmd = {
 	.id_table = pci_id_ixgbe_map,
 	.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
-		     RTE_PCI_DRV_IOVA_AS_VA,
+		     RTE_PCI_DRV_IOVA_AS_VA | RTE_PCI_DRV_INTR_RMV,
 	.probe = eth_ixgbe_pci_probe,
 	.remove = eth_ixgbe_pci_remove,
 };