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 A6F8C98 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="76129682" 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:08 -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:15 +0800 Message-Id: <1534503016-31805-4-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 3/4] net/i40e: install hotplug handler in i40e 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 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 Acked-by: Qi Zhang --- v6->v5: refine commit log --- drivers/net/i40e/i40e_ethdev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; } -- 2.7.4