[v6,3/4] net/i40e: install hotplug handler in i40e

Message ID 1534503016-31805-4-git-send-email-jia.guo@intel.com
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • Install eal event handler in i40e/ixgbe
Related show

Checks

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

Commit Message

Jeff Guo Aug. 17, 2018, 10:50 a.m.
This patch aims to enable hotplug detection in i40e 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: Qi Zhang <qi.z.zhang@intel.com>
---
v6->v5:
refine commit log
---
 drivers/net/i40e/i40e_ethdev.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Patch

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 85a6a86..bd9b3ce 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -697,7 +697,7 @@  static int eth_i40e_pci_remove(struct rte_pci_device *pci_dev)
 static struct rte_pci_driver rte_i40e_pmd = {
 	.id_table = pci_id_i40e_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_i40e_pci_probe,
 	.remove = eth_i40e_pci_remove,
 };
@@ -1466,6 +1466,9 @@  eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
 	rte_intr_callback_register(intr_handle,
 				   i40e_dev_interrupt_handler, dev);
 
+	/* install the dev event handler for ethdev. */
+	rte_eth_dev_event_handler_install(dev);
+
 	/* configure and enable device interrupt */
 	i40e_pf_config_irq0(hw, TRUE);
 	i40e_pf_enable_irq0(hw);
@@ -1697,6 +1700,9 @@  eth_i40e_dev_uninit(struct rte_eth_dev *dev)
 	/* Remove all Traffic Manager configuration */
 	i40e_tm_conf_uninit(dev);
 
+	/* uninstall the dev event handler for ethdev. */
+	rte_eth_dev_event_handler_uninstall(dev);
+
 	return 0;
 }