From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 78F9AA04A2 for ; Tue, 5 Nov 2019 03:40:14 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2F6982C16; Tue, 5 Nov 2019 03:40:14 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 07A652C16; Tue, 5 Nov 2019 03:40:11 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Nov 2019 18:40:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,269,1569308400"; d="scan'208";a="200671175" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga007.fm.intel.com with ESMTP; 04 Nov 2019 18:40:10 -0800 Received: from fmsmsx162.amr.corp.intel.com (10.18.125.71) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 4 Nov 2019 18:40:10 -0800 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by fmsmsx162.amr.corp.intel.com (10.18.125.71) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 4 Nov 2019 18:40:10 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.213]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.200]) with mapi id 14.03.0439.000; Tue, 5 Nov 2019 10:40:06 +0800 From: "Yang, Qiming" To: "Stillwell Jr, Paul M" , "dev@dpdk.org" CC: "Lu, Wenzhuo" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] net/ice: fix link status recovery Thread-Index: AQHVktOAuHWIsAFxXkmQwikIFBR+kad6lf+AgAFI16A= Date: Tue, 5 Nov 2019 02:40:06 +0000 Message-ID: References: <20191104054005.146150-1-qiming.yang@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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-stable] [dpdk-dev] [PATCH] net/ice: fix link status recovery X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Yes, I know this bug, will fix it in the next version. -----Original Message----- From: Stillwell Jr, Paul M=20 Sent: Monday, November 4, 2019 23:03 To: Yang, Qiming ; dev@dpdk.org Cc: Lu, Wenzhuo ; Yang, Qiming ; stable@dpdk.org Subject: RE: [dpdk-dev] [PATCH] net/ice: fix link status recovery > -----Original Message----- > From: dev On Behalf Of Qiming Yang > Sent: Sunday, November 3, 2019 9:40 PM > To: dev@dpdk.org > Cc: Lu, Wenzhuo ; Yang, Qiming=20 > ; stable@dpdk.org > Subject: [dpdk-dev] [PATCH] net/ice: fix link status recovery >=20 > This patch fix a kernel driver link status issue by recovering link=20 > status when device stop. >=20 > Fixes: e6161345d8a9 ("net/ice: support link status change") > Cc: stable@dpdk.org >=20 > Signed-off-by: Qiming Yang > --- > drivers/net/ice/ice_ethdev.c | 26 +++++++++++++++++++++++++-=20 > drivers/net/ice/ice_ethdev.h | 1 + > 2 files changed, 26 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/net/ice/ice_ethdev.c=20 > b/drivers/net/ice/ice_ethdev.c index d746758..c9972cf 100644 > --- a/drivers/net/ice/ice_ethdev.c > +++ b/drivers/net/ice/ice_ethdev.c > @@ -2277,7 +2277,10 @@ ice_dev_stop(struct rte_eth_dev *dev) > /* Clear all queues and release mbufs */ ice_clear_queues(dev); >=20 > -ice_dev_set_link_down(dev); > +if (pf->init_link_status) > +ice_dev_set_link_up(dev); > +else > +ice_dev_set_link_down(dev); >=20 > /* Clean datapath event and queue/vec mapping */ =20 > rte_intr_efd_disable(intr_handle); > @@ -2648,6 +2651,25 @@ ice_rxq_intr_setup(struct rte_eth_dev *dev) =20 > return 0; } >=20 > +static void ice_get_init_link_status(struct rte_eth_dev *dev) {=20 > +struct ice_hw *hw =3D ICE_DEV_PRIVATE_TO_HW(dev->data- > >dev_private); > +struct ice_pf *pf =3D ICE_DEV_PRIVATE_TO_PF(dev->data- > >dev_private); > +bool enable_lse =3D dev->data->dev_conf.intr_conf.lsc ? true : false;=20 > +struct ice_link_status link_status; int ret; > + > +ret =3D ice_aq_get_link_info(hw->port_info, enable_lse, > + &link_status, NULL); > +if (ret !=3D ICE_SUCCESS) { > +PMD_DRV_LOG(ERR, "Failed to get link info"); > +pf->init_link_status =3D false; You should probably just return here instead of continuing on. If the FW do= esn't clear out the link_status variable then there could be garbage in the= re that would match the test below for link_info & ICE_AQ_LINK_UP, thus set= ting init_link_status to true after you just set it to false. > +} > + > +if (link_status.link_info & ICE_AQ_LINK_UP) > +pf->init_link_status =3D true; > +} > + > static int > ice_dev_start(struct rte_eth_dev *dev) { @@ -2717,6 +2739,8 @@=20 > ice_dev_start(struct rte_eth_dev *dev) if (ret !=3D ICE_SUCCESS) =20 > PMD_DRV_LOG(WARNING, "Fail to set phy mask"); >=20 > +ice_get_init_link_status(dev); > + > ice_dev_set_link_up(dev); >=20 > /* Call get_link_info aq commond to enable/disable LSE */ diff --git=20 > a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index > de67e59..27db4e7 100644 > --- a/drivers/net/ice/ice_ethdev.h > +++ b/drivers/net/ice/ice_ethdev.h > @@ -369,6 +369,7 @@ struct ice_pf { > struct ice_parser_list rss_parser_list; struct ice_parser_list=20 > perm_parser_list; struct ice_parser_list dist_parser_list; > +bool init_link_status; > }; >=20 > #define ICE_MAX_QUEUE_NUM 2048 > -- > 2.9.5