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 BD8E2A034F; Tue, 28 Apr 2020 09:49:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 482E01D51A; Tue, 28 Apr 2020 09:49:50 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 49F991D50E for ; Tue, 28 Apr 2020 09:49:48 +0200 (CEST) IronPort-SDR: Cf1rg9wbcA9gYiTHsCXrhhVzT/IZ6/AbWoMUCHB5POlcg/QFLsxZ/YbQ+/F8dCBzy7ap8l41bq fSRJgtVMEebg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2020 00:49:47 -0700 IronPort-SDR: LYOuXt2TlBs8r8AmwXdPVVUVKr0kHql6Wo0ypEwsNjaHUJHloASpog+6x3cJ8R9n0b5ZUFt2U+ dbX5adKdG84g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,327,1583222400"; d="scan'208";a="275753039" Received: from orsmsx109.amr.corp.intel.com ([10.22.240.7]) by orsmga002.jf.intel.com with ESMTP; 28 Apr 2020 00:49:46 -0700 Received: from orsmsx157.amr.corp.intel.com (10.22.240.23) by ORSMSX109.amr.corp.intel.com (10.22.240.7) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 28 Apr 2020 00:49:46 -0700 Received: from ORSEDG002.ED.cps.intel.com (10.7.248.5) by ORSMSX157.amr.corp.intel.com (10.22.240.23) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 28 Apr 2020 00:49:46 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.107) by edgegateway.intel.com (134.134.137.101) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 28 Apr 2020 00:49:46 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H2J3dILBUK2u8Xv3WEfGs0zpu5l2q7+boo8BC3prnTnwhbHsSob4Aivm456841CKTeFfukInw4mXSHOzKaiD41qOqzSJnA970h1CG8pBZtiGtNGQxandUFGYQu7Vvcu7uUWKbKQLeMtWuC8XVAFDevSDjYZtKmQB9aI+bJGcBXbURB2wTAvFiNRLW2OyhR3yfT3K/oFkJnoCa7sXCuXw8J8Oia13Q6dFd7TPl9+KS7i7tIUwBIWZHgjjq5Yjz8VTKMWVHm903ZgPA7FCmW3sxfFUU/W/Up08Fk9dVFN1JCERD5b9qHbv8PBxBa/KK/Q9QzojPiD3rvF35MCYWghcBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hW7J2MLOBQ+sohNG+iby4rkgnoEd2J31uM3/P4qIM2k=; b=QLboZpIkzuNeZN9SwMqMA54Gc9nbQVBY20Qa/P8N7OzQf1o8KX5Gk0u2Y2mJBnxq5uNriRncXmCeCf6U4Ewt/iYhLXF6FmofYpWkGmcMlNojb9pI5or+fuQMvspZrqK0R4NG5dCgMa6vV/F9yQ+7oN6V1qsyiNEKMC2A/UVO91qtD4is0443Du9hR8oAMt2d3Tyhr+OTVuefUHjeWZjXNwTmW1sROJeYRSboKuZiIK6uXUWly24pkZz3lqO00hqcyxNm8zaa3u1liqMjt7ruVxi7yX3Kf7JVlgjgJazUHdxzzm5iozCxY8354M2J1yh+Tc4A3MAssNEHGv3ZeSPe2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hW7J2MLOBQ+sohNG+iby4rkgnoEd2J31uM3/P4qIM2k=; b=VZrqHdfVfsSCqqDyDCaIUr2k2UJUSvH0uHowiiaHuq4m9HWK2gCbZKVNQSIZbDvFevaac+0ZeXE+zYjcxDuOYCs5zhC1OZKk0q65i4k3zi3rDO1ZvqNYJR/Ja9dVB7vFbMB79L4V0/TQi/yAcdZlIM7UIwTsBMGYLCDsIaDHFgc= Received: from BYAPR11MB3541.namprd11.prod.outlook.com (2603:10b6:a03:f5::16) by BYAPR11MB3798.namprd11.prod.outlook.com (2603:10b6:a03:b3::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Tue, 28 Apr 2020 07:49:42 +0000 Received: from BYAPR11MB3541.namprd11.prod.outlook.com ([fe80::2c4f:22b:b8b0:27f9]) by BYAPR11MB3541.namprd11.prod.outlook.com ([fe80::2c4f:22b:b8b0:27f9%5]) with mapi id 15.20.2937.023; Tue, 28 Apr 2020 07:49:42 +0000 From: "Xing, Beilei" To: "Zhang, AlvinX" , "dev@dpdk.org" CC: "Zhang, Qi Z" , "Wu, Jingjing" Thread-Topic: [PATCH] net/iavf: fix link speed Thread-Index: AQHWHSlEghf07cX+RUiFzIcm2F9zkKiOJy4g Date: Tue, 28 Apr 2020 07:49:42 +0000 Message-ID: References: <20200428064858.21392-1-alvinx.zhang@intel.com> In-Reply-To: <20200428064858.21392-1-alvinx.zhang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.45] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 24326397-5bf9-4e11-c9ea-08d7eb48b679 x-ms-traffictypediagnostic: BYAPR11MB3798: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-forefront-prvs: 0387D64A71 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3541.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(39860400002)(136003)(346002)(366004)(376002)(396003)(86362001)(55016002)(8676002)(9686003)(2906002)(81156014)(110136005)(54906003)(316002)(26005)(186003)(71200400001)(4326008)(33656002)(7696005)(66556008)(53546011)(8936002)(76116006)(478600001)(52536014)(66476007)(107886003)(6506007)(5660300002)(64756008)(66446008)(66946007); DIR:OUT; SFP:1102; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: XmhOobZNG2jwOQNZIzwvYw1kvzBagMCjwljwqzxT+z3fgwJr0w5NDqAo8k2TFqsog1URRmX8eT+zr/eWq4gdbjMue5d9iGv3WwANKy+CiJV+tTK2lYUbjjATiL7m3ABu3QtKpaur8PUzFmhgHNiK+1xfmPF54eztZtCPj6Bt8z/xt5vsZPU3DMyb9WvB99DgWQOG6d5nvIRL5qK0CHgztfJaAlohR9T46vTT76554sdapdV3hQDlxvBC74F0STGUCDOWV9mCjTsACbpIUb0hQdHUeozufovEq7/SHa16i375p2h3LC3Dh63rMGbiH36CwUBIr5XBlvBgP1jzSZMNJs6T2h5y8Gj0W3xb6MeHXf/2ULIgkT2kb1y8dSlNEW7leAk9n4R9rb6wrvzOVIH3e3XUCL62okwzle1IXx6sXtyBCgCwqDTzTABwCCymQ6/E x-ms-exchange-antispam-messagedata: QaW/sKCDCCRvstHu0HAYceTRBJigh9fK4BA4tl4IRNNPl95T73uKuOgZuoKrJy6moUhNIs3CmHC6g6UO9QchGXsnijzjdzPJ7vPY2RGSTbGjk63hCTFpf6gbCbxBW+OlhwRINHWK/nyLhdBeMmgxTARWcGEo2bkT8gdYRND8iNyn1/2sMdY4mIejspp+AwKoVojfQNGIO4e/bPh1RJoTKFFJew15Od/ZRB56m66YKVakf5MH67nLlAbE5ZmCAomI9sUsC7GC7iZO0IicIHnMjEd4jFAO3eftr/ayMyBAHpOMG6sEwkN/yuZWJ7GpBA3pEUc+mSLQKPgMgr0fUC7OLv9auwNNxuyz+8tIYfCi9/2z0RS4oQaxSUdDK0hyejdFt69XGg18EQ36Xug8txZ0jOGgEgLCkAFtKg70wDWQt6N/81X8yYAPXNg/5phOrIx2TLj83Oh8CZ/NViANP8vyAu4bJJekHrWQMDU4x/1J7MKY14mbohgWJsGgMYIJlGLIjnDCNgd8ld8p8KI6gc7lknjzRvNuKRVNGIqaDHkNOyOO8igzLj5psOBrxC9krv0N26rwfZi67W9kotgM3n6t6wpObLjNALyVe1LVl/bhXUZSlaq7u4FC/50lwzuD6Fh5i35TYVvbFd6hC96rcpQuzCIXl/crpB9/o/nO/2ePJvx5aG9SnV5zalOMbMRi/xbvQ23OkrC+owYJabGnys0dz9vduPybwKh0AF/X2QNdQP2lrL88AtcJyHl+B+0GPreNBkoVPz45grrLEpfJQWJk400NVZzesGMAUnutHy8aIAs= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 24326397-5bf9-4e11-c9ea-08d7eb48b679 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Apr 2020 07:49:42.3484 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: PT8U/PVuioH2bA1iLHO/cxuIKO2NM+/FDuNu4JhVVfSu2AjXdTgRA/eIp1u64pRoNLK+aJIRy6ylK3sp5WieNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3798 X-OriginatorOrg: intel.com 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" > -----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 >=20 > From: Alvin Zhang >=20 > If the PF driver does not support the new speed reporting capabilities th= en > use link_event else use link_event_adv to get the speed. >=20 > Fixes: 48de41ca11f0 (net/iavf: enable link status update) > Cc: jingjing.wu@intel.com Cc stable. >=20 > Signed-off-by: Alvin Zhang > --- > drivers/net/iavf/iavf_vchnl.c | 47 > ++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 46 insertions(+), 1 deletion(-) >=20 > 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; > } >=20 > +static uint32_t > +iavf_convert_link_speed(uint32_t virt_link_speed) { Why use uint32_t but not enum virtchnl_link_speed for the parameter? > + 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