From patchwork Wed Jun 28 11:07:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Jia" X-Patchwork-Id: 25854 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 7B98537B7; Wed, 28 Jun 2017 13:11:31 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 4DAA52C8 for ; Wed, 28 Jun 2017 13:11:27 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jun 2017 04:11:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,275,1496127600"; d="scan'208";a="119770998" Received: from dpdk-py-purley.sh.intel.com ([10.239.129.223]) by fmsmga005.fm.intel.com with ESMTP; 28 Jun 2017 04:11:07 -0700 From: Jeff Guo To: helin.zhang@intel.com, jingjing.wu@intel.com Cc: dev@dpdk.org, jia.guo@intel.com Date: Wed, 28 Jun 2017 19:07:24 +0800 Message-Id: <1498648044-57541-2-git-send-email-jia.guo@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1498648044-57541-1-git-send-email-jia.guo@intel.com> References: <1495986280-26207-1-git-send-email-jia.guo@intel.com> <1498648044-57541-1-git-send-email-jia.guo@intel.com> Subject: [dpdk-dev] [PATCH v2 2/2] net/i40e: add hot plug monitor 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: "Guo, Jia" This patch enable the hot plug feature in i40e, by monitoring the hot plug uevent of the device. When remove event got, call the app callback function to handle the detach process. Signed-off-by: Guo, Jia --- v2->v1: remove unused part for current stage. --- drivers/net/i40e/i40e_ethdev.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 4ee1113..122187e 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1283,6 +1283,7 @@ static inline void i40e_GLQF_reg_init(struct i40e_hw *hw) /* enable uio intr after callback register */ rte_intr_enable(intr_handle); + /* * Add an ethertype filter to drop all flow control frames transmitted * from VSIs. By doing so, we stop VF from sending out PAUSE or PFC @@ -5832,11 +5833,28 @@ struct i40e_vsi * { struct rte_eth_dev *dev = (struct rte_eth_dev *)param; struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct rte_uevent event; uint32_t icr0; + struct rte_pci_device *pci_dev; + struct rte_intr_handle *intr_handle; + + pci_dev = RTE_ETH_DEV_TO_PCI(dev); + intr_handle = &pci_dev->intr_handle; /* Disable interrupt */ i40e_pf_disable_irq0(hw); + /* check device uevent */ + if (rte_uevent_get(intr_handle->uevent_fd, &event) > 0) { + if (event.subsystem == RTE_UEVENT_SUBSYSTEM_UIO) { + if (event.action == RTE_UEVENT_REMOVE) { + _rte_eth_dev_callback_process(dev, + RTE_ETH_EVENT_INTR_RMV, NULL); + } + } + goto done; + } + /* read out interrupt causes */ icr0 = I40E_READ_REG(hw, I40E_PFINT_ICR0);