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 4ACE5A00BE; Tue, 28 Apr 2020 10:43:54 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2838D1D591; Tue, 28 Apr 2020 10:43:54 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 4EBAC1D40D for ; Tue, 28 Apr 2020 10:43:52 +0200 (CEST) IronPort-SDR: oHzgC/dTkqV2T1lar79HYTmxcsTDkWMOAdN9UV9HDCnqztywwC2okzTdr8Lx9ulmTLqYzYmNvi BXNOOBMMPG/w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2020 01:43:51 -0700 IronPort-SDR: WXhdv5vy9EZpB0f92QllUh+QSCP6eauuXo6QTVqzHRv9Frwe807uYB2Y6hDat/M1B+gb2GoeIM HjrWKt3yydGw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,327,1583222400"; d="scan'208";a="292789098" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga002.fm.intel.com with ESMTP; 28 Apr 2020 01:43:51 -0700 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 28 Apr 2020 01:43:50 -0700 Received: from cdsmsx103.ccr.corp.intel.com (172.17.3.37) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 28 Apr 2020 01:43:50 -0700 Received: from cdsmsx102.ccr.corp.intel.com ([169.254.2.104]) by CDSMSX103.ccr.corp.intel.com ([169.254.5.221]) with mapi id 14.03.0439.000; Tue, 28 Apr 2020 16:43:47 +0800 From: "Zhang, AlvinX" To: "Xing, Beilei" , "dev@dpdk.org" CC: "Zhang, Qi Z" , "Wu, Jingjing" Thread-Topic: [PATCH] net/iavf: fix link speed Thread-Index: AQHWHSk29ntWBzDOCUCRK+02ZfBDYaiNorgAgACVAvA= Date: Tue, 28 Apr 2020 08:43:46 +0000 Message-ID: <6CE17E955B70FA409286764E3E0B364116473117@CDSMSX102.ccr.corp.intel.com> References: <20200428064858.21392-1-alvinx.zhang@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.17.6.105] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] net/iavf: fix link speed 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" Thanks Beilei. > -----Original Message----- > From: Xing, Beilei > Sent: Tuesday, April 28, 2020 3:50 PM > To: Zhang, AlvinX ; dev@dpdk.org > Cc: Zhang, Qi Z ; Wu, Jingjing > Subject: RE: [PATCH] net/iavf: fix link speed >=20 >=20 >=20 > > -----Original Message----- > > From: Zhang, AlvinX > > Sent: Tuesday, April 28, 2020 2:49 PM > > To: dev@dpdk.org > > Cc: Zhang, Qi Z ; Xing, Beilei > > ; Zhang, AlvinX ; Wu, > > Jingjing > > Subject: [PATCH] net/iavf: fix link speed > > > > From: Alvin Zhang > > > > If the PF driver does not support the new speed reporting capabilities > > then use link_event else use link_event_adv to get the speed. > > > > Fixes: 48de41ca11f0 (net/iavf: enable link status update) > > Cc: jingjing.wu@intel.com >=20 > Cc stable. >=20 > > > > Signed-off-by: Alvin Zhang > > --- > > drivers/net/iavf/iavf_vchnl.c | 47 > > ++++++++++++++++++++++++++++++++++++++++++- > > 1 file changed, 46 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/net/iavf/iavf_vchnl.c > > b/drivers/net/iavf/iavf_vchnl.c index > > 2a0cdd9..104a769 100644 > > --- a/drivers/net/iavf/iavf_vchnl.c > > +++ b/drivers/net/iavf/iavf_vchnl.c > > @@ -130,6 +130,44 @@ > > return err; > > } > > > > +static uint32_t > > +iavf_convert_link_speed(uint32_t virt_link_speed) { >=20 > Why use uint32_t but not enum virtchnl_link_speed for the parameter? >=20 > > +uint32_t speed; > > + > > +switch (virt_link_speed) { > > +case VIRTCHNL_LINK_SPEED_100MB: > > +speed =3D 100; > > +break; > > +case VIRTCHNL_LINK_SPEED_1GB: > > +speed =3D 1000; > > +break; > > +case VIRTCHNL_LINK_SPEED_10GB: > > +speed =3D 10000; > > +break; > > +case VIRTCHNL_LINK_SPEED_40GB: > > +speed =3D 40000; > > +break; > > +case VIRTCHNL_LINK_SPEED_20GB: > > +speed =3D 20000; > > +break; > > +case VIRTCHNL_LINK_SPEED_25GB: > > +speed =3D 25000; > > +break; > > +case VIRTCHNL_LINK_SPEED_2_5GB: > > +speed =3D 2500; > > +break; > > +case VIRTCHNL_LINK_SPEED_5GB: > > +speed =3D 5000; > > +break; > > +default: > > +speed =3D 0; > > +break; > > +} > > + > > +return speed; > > +} > > + > > static void > > iavf_handle_pf_event_msg(struct rte_eth_dev *dev, uint8_t *msg, > > uint16_t msglen) @@ -151,7 +189,14 @@ case > > VIRTCHNL_EVENT_LINK_CHANGE: > > PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_LINK_CHANGE event"); vf- > >link_up > > =3D pf_msg->event_data.link_event.link_status; > > -vf->link_speed =3D pf_msg- > > >event_data.link_event_adv.link_speed; > > +if (vf->vf_res->vf_cap_flags & > > VIRTCHNL_VF_CAP_ADV_LINK_SPEED) { > > +vf->link_speed =3D > > +pf_msg- > > >event_data.link_event_adv.link_speed; > > +} else { > > +enum virtchnl_link_speed speed; > > +speed =3D pf_msg->event_data.link_event.link_speed; > > +vf->link_speed =3D iavf_convert_link_speed(speed); > > +} > > iavf_dev_link_update(dev, 0); > > _rte_eth_dev_callback_process(dev, > > RTE_ETH_EVENT_INTR_LSC, > > NULL); > > -- > > 1.8.3.1 >=20