From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 898272C8 for ; Thu, 29 Jun 2017 06:32:00 +0200 (CEST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jun 2017 21:31:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,278,1496127600"; d="scan'208";a="118711880" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga005.jf.intel.com with ESMTP; 28 Jun 2017 21:31:59 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 28 Jun 2017 21:31:59 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 28 Jun 2017 21:31:58 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.146]) by SHSMSX104.ccr.corp.intel.com ([10.239.4.70]) with mapi id 14.03.0319.002; Thu, 29 Jun 2017 12:31:56 +0800 From: "Guo, Jia" To: "Wu, Jingjing" , "Zhang, Helin" CC: "dev@dpdk.org" Thread-Topic: [PATCH v2 2/2] net/i40e: add hot plug monitor in i40e Thread-Index: AQHS7/8+mde7/q7Nj0+fGmEJuTbU4aI6i5UAgAC1EuA= Date: Thu, 29 Jun 2017 04:31:55 +0000 Message-ID: <01BA8470C017D6468C8290E4B9C5E1E83B23E1F1@shsmsx102.ccr.corp.intel.com> References: <1495986280-26207-1-git-send-email-jia.guo@intel.com> <1498648044-57541-1-git-send-email-jia.guo@intel.com> <1498648044-57541-2-git-send-email-jia.guo@intel.com> <9BB6961774997848B5B42BEC655768F810DB57FE@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <9BB6961774997848B5B42BEC655768F810DB57FE@SHSMSX103.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [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: , X-List-Received-Date: Thu, 29 Jun 2017 04:32:01 -0000 Yes, if got remove uevent might be directly return to avoid invalid i/o. bu= t if got other uevent such as add and change, must be go done to keep the i= nterrupt process in device. I will refine this part, thanks.=20 Best regards, Jeff Guo -----Original Message----- From: Wu, Jingjing=20 Sent: Thursday, June 29, 2017 9:42 AM To: Guo, Jia ; Zhang, Helin Cc: dev@dpdk.org Subject: RE: [PATCH v2 2/2] net/i40e: add hot plug monitor in i40e > -----Original Message----- > From: Guo, Jia > Sent: Wednesday, June 28, 2017 7:07 PM > To: Zhang, Helin ; Wu, Jingjing=20 > > Cc: dev@dpdk.org; Guo, Jia > Subject: [PATCH v2 2/2] net/i40e: add hot plug monitor in i40e >=20 > From: "Guo, Jia" >=20 > This patch enable the hot plug feature in i40e, by monitoring the hot=20 > plug uevent of the device. When remove event got, call the app=20 > callback function to handle the detach process. >=20 > 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(+) >=20 > diff --git a/drivers/net/i40e/i40e_ethdev.c=20 > 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=20 > i40e_hw > *hw) >=20 > /* 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=20 > @@ -5832,11 +5833,28 @@ struct i40e_vsi * { > struct rte_eth_dev *dev =3D (struct rte_eth_dev *)param; > struct i40e_hw *hw =3D 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 =3D RTE_ETH_DEV_TO_PCI(dev); > + intr_handle =3D &pci_dev->intr_handle; >=20 > /* Disable interrupt */ > i40e_pf_disable_irq0(hw); >=20 > + /* check device uevent */ > + if (rte_uevent_get(intr_handle->uevent_fd, &event) > 0) { You declare the rte_uevnet_get like + * @return + * - On success, zero. + * - On failure, a negative value. + */ +int +rte_uevent_get(int fd, struct rte_uevent *uevent); But here you check if it > 0? > + if (event.subsystem =3D=3D RTE_UEVENT_SUBSYSTEM_UIO) { > + if (event.action =3D=3D RTE_UEVENT_REMOVE) { > + _rte_eth_dev_callback_process(dev, > + RTE_ETH_EVENT_INTR_RMV, NULL); > + } > + } > + goto done; I think when the remove happen, no need to goto done, you can just return. > + } > + > /* read out interrupt causes */ > icr0 =3D I40E_READ_REG(hw, I40E_PFINT_ICR0); >=20 > -- > 1.8.3.1