From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 6977E2A62 for ; Fri, 17 Aug 2018 12:53:22 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Aug 2018 03:53:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,250,1531810800"; d="scan'208";a="76129679" Received: from jeffguo-z170x-ud5.sh.intel.com (HELO localhost.localdomain) ([10.67.104.10]) by orsmga003.jf.intel.com with ESMTP; 17 Aug 2018 03:53:04 -0700 From: Jeff Guo To: stephen@networkplumber.org, bruce.richardson@intel.com, ferruh.yigit@intel.com, konstantin.ananyev@intel.com, gaetan.rivet@6wind.com, jingjing.wu@intel.com, thomas@monjalon.net, motih@mellanox.com, matan@mellanox.com, harry.van.haaren@intel.com, qi.z.zhang@intel.com, shaopeng.he@intel.com, bernard.iremonger@intel.com, arybchenko@solarflare.com Cc: jblunck@infradead.org, shreyansh.jain@nxp.com, dev@dpdk.org, jia.guo@intel.com, helin.zhang@intel.com Date: Fri, 17 Aug 2018 18:50:14 +0800 Message-Id: <1534503016-31805-3-git-send-email-jia.guo@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534503016-31805-1-git-send-email-jia.guo@intel.com> References: <1530787185-5915-1-git-send-email-jia.guo@intel.com> <1534503016-31805-1-git-send-email-jia.guo@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v6 2/4] net/ixgbe: install ethdev hotplug handler in ixgbe X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Aug 2018 10:53:23 -0000 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 Acked-by: Wenzhuo Lu --- v6->v5: refine commit log --- drivers/net/ixgbe/ixgbe_ethdev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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, }; -- 2.7.4