From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 5C18E69D4 for ; Thu, 6 Dec 2018 03:56:39 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Dec 2018 18:56:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,320,1539673200"; d="scan'208";a="299731846" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga006.fm.intel.com with ESMTP; 05 Dec 2018 18:56:38 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 5 Dec 2018 18:56:38 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.201]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.59]) with mapi id 14.03.0415.000; Thu, 6 Dec 2018 10:56:36 +0800 From: "Yang, Qiming" To: "dev@dpdk.org" , "Zhang, Qi Z" , "Wang, Haiyue" CC: "Yan, Zhirun" Thread-Topic: [dpdk-dev] [PATCH v2] net/i40e: fix VF/PF port reset Thread-Index: AQHUjFjSe7y7GclTCk68P6Yfp3Zyg6VxBD/g Date: Thu, 6 Dec 2018 02:56:35 +0000 Message-ID: References: <20181205124625.24398-1-zhirun.yan@intel.com> In-Reply-To: <20181205124625.24398-1-zhirun.yan@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTQ3NTNkMTYtMmZmNi00NjhhLWJhZGEtNDRhY2MzMDkyOGYzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiRXRxVG1WZWNFMEVqNnJlRHNxa3J4Ym5XTXVHd0VIajJYTnhKNDhkazZHMzh0TDhmN3ZRMXZsQVc3TlRqN09BSCJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 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] net/i40e: fix VF/PF port reset 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, 06 Dec 2018 02:56:40 -0000 Hi, Zhirun > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhirun Yan > Sent: Wednesday, December 5, 2018 8:46 PM > To: dev@dpdk.org; Zhang, Qi Z ; Wang, Haiyue > > Cc: Yan, Zhirun > Subject: [dpdk-dev] [PATCH v2] net/i40e: fix VF/PF port reset >=20 > Port reset will call i40evf_uninit_vf() to release resource. It wants to = call > i40evf_dev_close() to do some clean work. Before this patch, port reset w= ill > never call i40evf_dev_close() to shutdown adminq. So the i40evf_dev_init(= ) will > failed. >=20 > The status of stop/start should be flaged by dev->data->dev_started. > Close should be flaged by hw->adapter_stopped. This patch modify these fl= ags > both in VF and PF. >=20 For the fix patch need to add Fix line like: Fixes: commit number ("commit log"), just refer to the old patch. > Signed-off-by: Zhirun Yan > Signed-off-by: Haiyue Wang > --- > drivers/net/i40e/i40e_ethdev.c | 13 ++++++------- > drivers/net/i40e/i40e_ethdev_vf.c | 17 ++++++++--------- > 2 files changed, 14 insertions(+), 16 deletions(-) >=20 > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethde= v.c > index 7030eb1fa..8eaf6eba6 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -2391,15 +2391,11 @@ static void > i40e_dev_stop(struct rte_eth_dev *dev) > { > struct i40e_pf *pf =3D I40E_DEV_PRIVATE_TO_PF(dev->data- > >dev_private); > - struct i40e_hw *hw =3D I40E_DEV_PRIVATE_TO_HW(dev->data- > >dev_private); > struct i40e_vsi *main_vsi =3D pf->main_vsi; > struct rte_pci_device *pci_dev =3D RTE_ETH_DEV_TO_PCI(dev); > struct rte_intr_handle *intr_handle =3D &pci_dev->intr_handle; > int i; >=20 > - if (hw->adapter_stopped =3D=3D 1) > - return; > - adapter_stopped is used to avoid double call dev_stop, why you remove the c= heck here? Do you add another mechanism to do the same thing? > if (dev->data->dev_conf.intr_conf.rxq =3D=3D 0) { > rte_eal_alarm_cancel(i40e_dev_alarm_handler, dev); > rte_intr_enable(intr_handle); > @@ -2442,8 +2438,6 @@ i40e_dev_stop(struct rte_eth_dev *dev) >=20 > /* reset hierarchy commit */ > pf->tm_conf.committed =3D false; > - > - hw->adapter_stopped =3D 1; > } >=20 > static void > @@ -2460,7 +2454,10 @@ i40e_dev_close(struct rte_eth_dev *dev) >=20 > PMD_INIT_FUNC_TRACE(); >=20 > - i40e_dev_stop(dev); > + if (dev->data->dev_started !=3D 0) { > + dev->data->dev_started =3D 0; > + i40e_dev_stop(dev); > + } >=20 > /* Remove all mirror rules */ > while ((p_mirror =3D TAILQ_FIRST(&pf->mirror_list))) { @@ -2523,6 > +2520,8 @@ i40e_dev_close(struct rte_eth_dev *dev) > I40E_WRITE_REG(hw, I40E_PFGEN_CTRL, > (reg | I40E_PFGEN_CTRL_PFSWR_MASK)); > I40E_WRITE_FLUSH(hw); > + > + hw->adapter_stopped =3D 1; If you remove all the other hw->adapter_stopped, it's useless to add here. > } >=20 > /* > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c > b/drivers/net/i40e/i40e_ethdev_vf.c > index ae55b9b18..cbe9bec3c 100644 > --- a/drivers/net/i40e/i40e_ethdev_vf.c > +++ b/drivers/net/i40e/i40e_ethdev_vf.c > @@ -1924,15 +1924,12 @@ static int > i40evf_dev_start(struct rte_eth_dev *dev) { > struct i40e_vf *vf =3D I40EVF_DEV_PRIVATE_TO_VF(dev->data- > >dev_private); > - struct i40e_hw *hw =3D I40E_DEV_PRIVATE_TO_HW(dev->data- > >dev_private); > struct rte_pci_device *pci_dev =3D RTE_ETH_DEV_TO_PCI(dev); > struct rte_intr_handle *intr_handle =3D &pci_dev->intr_handle; > uint32_t intr_vector =3D 0; >=20 > PMD_INIT_FUNC_TRACE(); >=20 > - hw->adapter_stopped =3D 0; > - Question the same, will induce any problem? > vf->max_pkt_len =3D dev->data->dev_conf.rxmode.max_rx_pkt_len; > vf->num_queue_pairs =3D RTE_MAX(dev->data->nb_rx_queues, > dev->data->nb_tx_queues); > @@ -2004,7 +2001,6 @@ i40evf_dev_stop(struct rte_eth_dev *dev) { > struct rte_pci_device *pci_dev =3D RTE_ETH_DEV_TO_PCI(dev); > struct rte_intr_handle *intr_handle =3D &pci_dev->intr_handle; > - struct i40e_hw *hw =3D I40E_DEV_PRIVATE_TO_HW(dev->data- > >dev_private); > struct i40e_vf *vf =3D I40EVF_DEV_PRIVATE_TO_VF(dev->data- > >dev_private); >=20 > PMD_INIT_FUNC_TRACE(); > @@ -2012,8 +2008,6 @@ i40evf_dev_stop(struct rte_eth_dev *dev) > if (dev->data->dev_conf.intr_conf.rxq !=3D 0) > rte_intr_disable(intr_handle); >=20 > - if (hw->adapter_stopped =3D=3D 1) > - return; > i40evf_stop_queues(dev); > i40evf_disable_queues_intr(dev); > i40e_dev_clear_queues(dev); > @@ -2029,7 +2023,6 @@ i40evf_dev_stop(struct rte_eth_dev *dev) > /* remove all multicast addresses */ > i40evf_add_del_mc_addr_list(dev, vf->mc_addrs, vf->mc_addrs_num, > FALSE); > - hw->adapter_stopped =3D 1; >=20 > } >=20 > @@ -2246,7 +2239,11 @@ i40evf_dev_close(struct rte_eth_dev *dev) { > struct i40e_hw *hw =3D I40E_DEV_PRIVATE_TO_HW(dev->data- > >dev_private); >=20 > - i40evf_dev_stop(dev); > + if (dev->data->dev_started !=3D 0) { > + dev->data->dev_started =3D 0; > + i40evf_dev_stop(dev); > + } > + > i40e_dev_free_queues(dev); > /* > * disable promiscuous mode before reset vf @@ -2255,11 +2252,13 > @@ i40evf_dev_close(struct rte_eth_dev *dev) > */ > i40evf_dev_promiscuous_disable(dev); > i40evf_dev_allmulticast_disable(dev); > - > i40evf_reset_vf(hw); > + > i40e_shutdown_adminq(hw); > i40evf_disable_irq0(hw); > rte_eal_alarm_cancel(i40evf_dev_alarm_handler, dev); > + > + hw->adapter_stopped =3D 1; > } >=20 > /* > -- > 2.17.1