From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8C65DA0C47; Tue, 26 Oct 2021 10:55:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0F56541C27; Tue, 26 Oct 2021 10:55:22 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 109DA407FF; Tue, 26 Oct 2021 10:55:19 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10148"; a="210638724" X-IronPort-AV: E=Sophos;i="5.87,182,1631602800"; d="scan'208";a="210638724" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2021 01:55:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,182,1631602800"; d="scan'208";a="578586733" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga002.fm.intel.com with ESMTP; 26 Oct 2021 01:55:16 -0700 Received: from shsmsx605.ccr.corp.intel.com (10.109.6.215) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 26 Oct 2021 01:55:15 -0700 Received: from shsmsx601.ccr.corp.intel.com (10.109.6.141) by SHSMSX605.ccr.corp.intel.com (10.109.6.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 26 Oct 2021 16:55:10 +0800 Received: from shsmsx601.ccr.corp.intel.com ([10.109.6.141]) by SHSMSX601.ccr.corp.intel.com ([10.109.6.141]) with mapi id 15.01.2242.012; Tue, 26 Oct 2021 16:55:10 +0800 From: "Zhang, Qi Z" To: "Yu, DapengX" , "Yang, Qiming" CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH v4] net/ice: simplify the use of DCF device reset Thread-Index: AQHXykWmpYFm8PIoRUCfTEPsT8AACKvk97dQ Date: Tue, 26 Oct 2021 08:55:09 +0000 Message-ID: <14a12a2966ec48b99dc79a8ec2ec8de5@intel.com> References: <20211026081845.1669802-1-dapengx.yu@intel.com> <20211026084401.1681489-1-dapengx.yu@intel.com> In-Reply-To: <20211026084401.1681489-1-dapengx.yu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.200.16 dlp-product: dlpe-windows x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v4] net/ice: simplify the use of DCF device reset X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" > -----Original Message----- > From: Yu, DapengX > Sent: Tuesday, October 26, 2021 4:44 PM > To: Yang, Qiming ; Zhang, Qi Z > > Cc: dev@dpdk.org; Yu, DapengX ; stable@dpdk.org > Subject: [PATCH v4] net/ice: simplify the use of DCF device reset >=20 > From: Dapeng Yu >=20 > After DCF is reset by PF, the DCF device un-initialization cannot functio= n > normally since the resource is already invalidated. So reset DCF twice is > necessary, the first simplified reset re-initializes the AdminQ of DCF, o= nly then > second reset can clean the filters successfully. >=20 > This patch detects the reset flag, which is set by PF on DCF reset, if th= e flag is > true, do DCF reset twice automatically. >=20 > Fixes: 1a86f4dbdf42 ("net/ice: support DCF device reset") > Cc: stable@dpdk.org >=20 > Signed-off-by: Dapeng Yu > --- > V2: > * Ignore the returned error of dev_uninit when DCF is reset by PF > V3: > * Add a reset function to re-initialize AdminQ resource > * Add a function to check the reset flag > V4: > * Remove redundant reset flag setting > --- > drivers/net/ice/ice_dcf.c | 2 ++ > drivers/net/ice/ice_dcf_ethdev.c | 33 +++++++++++++++++++++++++++++++- > 2 files changed, 34 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index > 084f7a53db..366ff0a907 100644 > --- a/drivers/net/ice/ice_dcf.c > +++ b/drivers/net/ice/ice_dcf.c > @@ -593,6 +593,8 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct > ice_dcf_hw *hw) > struct rte_pci_device *pci_dev =3D RTE_ETH_DEV_TO_PCI(eth_dev); > int ret, size; >=20 > + hw->resetting =3D false; > + > hw->avf.hw_addr =3D pci_dev->mem_resource[0].addr; > hw->avf.back =3D hw; >=20 > diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_e= thdev.c > index 7c71a48010..171b58a748 100644 > --- a/drivers/net/ice/ice_dcf_ethdev.c > +++ b/drivers/net/ice/ice_dcf_ethdev.c > @@ -1025,11 +1025,43 @@ ice_dcf_tm_ops_get(struct rte_eth_dev *dev > __rte_unused, > return 0; > } >=20 > +static inline void > +ice_dcf_simple_reset(struct rte_eth_dev *eth_dev, struct ice_dcf_hw=09 Better to rename the function to ice_dcf_reset_hw=20 > +*hw) { > + ice_dcf_uninit_hw(eth_dev, hw); > + ice_dcf_init_hw(eth_dev, hw); > +} > + > +/* Check if reset has been triggered by PF */ static inline bool > +dcf_is_reset(struct rte_eth_dev *dev) { > + struct ice_dcf_adapter *ad =3D dev->data->dev_private; > + struct iavf_hw *hw =3D &ad->real_hw.avf; > + > + return !(IAVF_READ_REG(hw, IAVF_VF_ARQLEN1) & > + IAVF_VF_ARQLEN1_ARQENABLE_MASK); > +} > + > static int > ice_dcf_dev_reset(struct rte_eth_dev *dev) { > + struct ice_dcf_adapter *ad =3D dev->data->dev_private; > + struct ice_dcf_hw *hw =3D &ad->real_hw; > int ret; >=20 > + if (dcf_is_reset(dev)) { > + if (!ad->real_hw.resetting) > + ad->real_hw.resetting =3D true; > + PMD_DRV_LOG(ERR, "The DCF has been reset by PF"); > + > + /* > + * Do the simplified reset to make DCF get AdminQ resource. > + * Then the next uninit/init can clean filters successfully. > + */ =09 Can reword as below: Simply reset hw to trigger an additional DCF enable/disable cycle which hel= p to workaround the issue that kernel driver may not clean up resource during previous rese= t. > + ice_dcf_simple_reset(dev, hw); > + } > + > ret =3D ice_dcf_dev_uninit(dev); > if (ret) > return ret; > @@ -1072,7 +1104,6 @@ ice_dcf_dev_init(struct rte_eth_dev *eth_dev) { > struct ice_dcf_adapter *adapter =3D eth_dev->data->dev_private; >=20 > - adapter->real_hw.resetting =3D false; > eth_dev->dev_ops =3D &ice_dcf_eth_dev_ops; > eth_dev->rx_pkt_burst =3D ice_dcf_recv_pkts; > eth_dev->tx_pkt_burst =3D ice_dcf_xmit_pkts; > -- > 2.27.0