From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 0725D58F6 for ; Tue, 30 Apr 2019 19:19:07 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 10:19:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,414,1549958400"; d="scan'208";a="166454401" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 10:19:07 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Apr 2019 10:19:06 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Apr 2019 10:19:06 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.129]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.70]) with mapi id 14.03.0415.000; Wed, 1 May 2019 01:19:04 +0800 From: "Wang, Haiyue" To: "Stillwell Jr, Paul M" , "dev@dpdk.org" , "Zhang, Qi Z" , "Lu, Wenzhuo" Thread-Topic: [dpdk-dev] [PATCH v1] net/ice: add link-up and link-down functions Thread-Index: AQHU/yS37pWp5McO10O2J6n5f/OynKZUXbcAgACTLwA= Date: Tue, 30 Apr 2019 17:19:04 +0000 Message-ID: References: <1556608319-5135-1-git-send-email-haiyue.wang@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMzc2YmU4ZTgtMTFiNy00NDVjLWFmZDktMGZhZTJmYWFkMDQyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoicDhLSUNrTUE2eGRsUXljSXdlMFhaVDhtTUxTZWltM2lFWVZsdlhvcnlyT2Q4eE5kN2p1SWZmWmNpdFFXbUt4SSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 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 v1] net/ice: add link-up and link-down functions 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: Tue, 30 Apr 2019 17:19:08 -0000 > -----Original Message----- > From: Stillwell Jr, Paul M > Sent: Wednesday, May 1, 2019 00:24 > To: Wang, Haiyue ; dev@dpdk.org; Zhang, Qi Z > ; Lu, Wenzhuo > Cc: Wang, Haiyue > Subject: RE: [dpdk-dev] [PATCH v1] net/ice: add link-up and link-down fun= ctions >=20 >=20 > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Haiyue Wang > > Sent: Tuesday, April 30, 2019 12:12 AM > > To: dev@dpdk.org; Zhang, Qi Z ; Lu, Wenzhuo > > > > Cc: Wang, Haiyue > > Subject: [dpdk-dev] [PATCH v1] net/ice: add link-up and link-down > > functions > > > > Support link up and down functions for ice, and when stop the ice, > > makes the link down also. > > > > Signed-off-by: Haiyue Wang > > --- > > drivers/net/ice/ice_ethdev.c | 83 > > ++++++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 83 insertions(+) > > > > diff --git a/drivers/net/ice/ice_ethdev.c > > b/drivers/net/ice/ice_ethdev.c index 1f06a2c..8f58150 100644 > > --- a/drivers/net/ice/ice_ethdev.c > > +++ b/drivers/net/ice/ice_ethdev.c > > @@ -32,6 +32,9 @@ static void ice_dev_info_get(struct rte_eth_dev *dev, > > struct rte_eth_dev_info *dev_info); static int > > ice_link_update(struct rte_eth_dev *dev, > > + if (link_up) > > + cfg.caps |=3D ICE_AQ_PHY_ENA_LINK; > > + else > > + cfg.caps &=3D ~ICE_AQ_PHY_ENA_LINK; > > + > > + status =3D ice_aq_set_phy_cfg(hw, pi->lport, &cfg, NULL); > > + >=20 > It seems like you should either check the return value here and tell the = user if it > didn't work or change the code that calls this to tell the user if someth= ing went > wrong. Otherwise the user thinks things worked when it didn't. >=20 I just make use of 'ICE_SUCCESS =3D=3D 0' be treated as successful, and oth= er value defined in 'enum ice_status ' will be treated as error code by function ' eth_err '= through ' rte_eth_dev_set_link_down/up'. > > +out: > > + ice_free(hw, pcaps); > > + return status; > > +} > > + > > +static int > > +ice_dev_set_link_up(struct rte_eth_dev *dev) { > > + struct ice_hw *hw =3D ICE_DEV_PRIVATE_TO_HW(dev->data- > > >dev_private); > > + > > + return ice_force_phys_link_state(hw, true); } > > + > > +static int > > +ice_dev_set_link_down(struct rte_eth_dev *dev) { > > + struct ice_hw *hw =3D ICE_DEV_PRIVATE_TO_HW(dev->data- > > >dev_private); > > + > > + return ice_force_phys_link_state(hw, false); } > > + > > static int > > ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { > > -- > > 2.7.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id E6B05A0679 for ; Tue, 30 Apr 2019 19:19:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0C8715A6A; Tue, 30 Apr 2019 19:19:10 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 0725D58F6 for ; Tue, 30 Apr 2019 19:19:07 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 10:19:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,414,1549958400"; d="scan'208";a="166454401" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 10:19:07 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Apr 2019 10:19:06 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Apr 2019 10:19:06 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.129]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.70]) with mapi id 14.03.0415.000; Wed, 1 May 2019 01:19:04 +0800 From: "Wang, Haiyue" To: "Stillwell Jr, Paul M" , "dev@dpdk.org" , "Zhang, Qi Z" , "Lu, Wenzhuo" Thread-Topic: [dpdk-dev] [PATCH v1] net/ice: add link-up and link-down functions Thread-Index: AQHU/yS37pWp5McO10O2J6n5f/OynKZUXbcAgACTLwA= Date: Tue, 30 Apr 2019 17:19:04 +0000 Message-ID: References: <1556608319-5135-1-git-send-email-haiyue.wang@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMzc2YmU4ZTgtMTFiNy00NDVjLWFmZDktMGZhZTJmYWFkMDQyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoicDhLSUNrTUE2eGRsUXljSXdlMFhaVDhtTUxTZWltM2lFWVZsdlhvcnlyT2Q4eE5kN2p1SWZmWmNpdFFXbUt4SSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v1] net/ice: add link-up and link-down functions 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" Message-ID: <20190430171904.IQl0LnCmgpLZDOlIbxxlpeL6f4GV_MvjLOrgc4P81Z0@z> > -----Original Message----- > From: Stillwell Jr, Paul M > Sent: Wednesday, May 1, 2019 00:24 > To: Wang, Haiyue ; dev@dpdk.org; Zhang, Qi Z > ; Lu, Wenzhuo > Cc: Wang, Haiyue > Subject: RE: [dpdk-dev] [PATCH v1] net/ice: add link-up and link-down fun= ctions >=20 >=20 > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Haiyue Wang > > Sent: Tuesday, April 30, 2019 12:12 AM > > To: dev@dpdk.org; Zhang, Qi Z ; Lu, Wenzhuo > > > > Cc: Wang, Haiyue > > Subject: [dpdk-dev] [PATCH v1] net/ice: add link-up and link-down > > functions > > > > Support link up and down functions for ice, and when stop the ice, > > makes the link down also. > > > > Signed-off-by: Haiyue Wang > > --- > > drivers/net/ice/ice_ethdev.c | 83 > > ++++++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 83 insertions(+) > > > > diff --git a/drivers/net/ice/ice_ethdev.c > > b/drivers/net/ice/ice_ethdev.c index 1f06a2c..8f58150 100644 > > --- a/drivers/net/ice/ice_ethdev.c > > +++ b/drivers/net/ice/ice_ethdev.c > > @@ -32,6 +32,9 @@ static void ice_dev_info_get(struct rte_eth_dev *dev, > > struct rte_eth_dev_info *dev_info); static int > > ice_link_update(struct rte_eth_dev *dev, > > + if (link_up) > > + cfg.caps |=3D ICE_AQ_PHY_ENA_LINK; > > + else > > + cfg.caps &=3D ~ICE_AQ_PHY_ENA_LINK; > > + > > + status =3D ice_aq_set_phy_cfg(hw, pi->lport, &cfg, NULL); > > + >=20 > It seems like you should either check the return value here and tell the = user if it > didn't work or change the code that calls this to tell the user if someth= ing went > wrong. Otherwise the user thinks things worked when it didn't. >=20 I just make use of 'ICE_SUCCESS =3D=3D 0' be treated as successful, and oth= er value defined in 'enum ice_status ' will be treated as error code by function ' eth_err '= through ' rte_eth_dev_set_link_down/up'. > > +out: > > + ice_free(hw, pcaps); > > + return status; > > +} > > + > > +static int > > +ice_dev_set_link_up(struct rte_eth_dev *dev) { > > + struct ice_hw *hw =3D ICE_DEV_PRIVATE_TO_HW(dev->data- > > >dev_private); > > + > > + return ice_force_phys_link_state(hw, true); } > > + > > +static int > > +ice_dev_set_link_down(struct rte_eth_dev *dev) { > > + struct ice_hw *hw =3D ICE_DEV_PRIVATE_TO_HW(dev->data- > > >dev_private); > > + > > + return ice_force_phys_link_state(hw, false); } > > + > > static int > > ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { > > -- > > 2.7.4