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 6AE61A052B; Fri, 31 Jul 2020 04:29:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 32864262E; Fri, 31 Jul 2020 04:29:45 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 6191611A2; Fri, 31 Jul 2020 04:29:43 +0200 (CEST) IronPort-SDR: hufKFX1M0g4l9NixJmlTGbTyGk107PEOrZBXzrJt93BhjXiJuNiSFD2CGt1kuf7LbrzmTIE+4E SH/aI42cg3HQ== X-IronPort-AV: E=McAfee;i="6000,8403,9698"; a="216179565" X-IronPort-AV: E=Sophos;i="5.75,416,1589266800"; d="scan'208";a="216179565" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2020 19:29:42 -0700 IronPort-SDR: CF55zUKIyzz7t/taUiSxhEzEHTxVRHFBKPOtvdg7glBUFBEIouF5+tvd1jXgd+gZ7f714ECAum c4vFBoSiQnkA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,416,1589266800"; d="scan'208";a="321274972" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga008.jf.intel.com with ESMTP; 30 Jul 2020 19:29:42 -0700 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 30 Jul 2020 19:29:41 -0700 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 30 Jul 2020 19:29:41 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.108) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 30 Jul 2020 19:29:41 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QpozODQojMjP2cuIaJ81gPWL8kSqmIt9+4FAe2G2B6Zd3KGy4mvlfK91DkzWLiytMyMrFKe8TOhErn+iNQHKkiGD2Fnf2y76CQ+zB3rCGAgv4g6spfNI9V4JZl8VVd5UwIHUJ+sxe6sEHVzuucsS5nVJB9LSn1aqvle7RwA1YbkMHCEUryKIYfXBOB2ww2HGA4LLhgdT9+kZwyXpDxyoALXJV3qpcCieo3y4aE5/6kxTNJeFK9+WGuacjFj5ZqxBaGPIVg6n/p6YSGDhRoSojz03dBlfniXjYHhvXEl19fNgFiLCC3CBikGmbM/NjP/uIzyNErWsj+985TJxSQhlMg== 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=va1gRnL22uc8g4vR8TxDbYJvTQLDGhbU5rlHnLIj6to=; b=N0jkt4pGGZQ5PmzzLzcgrrDDM8YpkXcKoiDVsAbqzoKjg+kbR2DqoCYx/+D0KE5YamXV1SzXdt730ZdraT/L1Ui+zjYyihzcLaVAam1IamBgrx6S6IcaSQBT3+qSYbTjeTr2Kjr0u92yswyR3iFurxMRxQd5VQhVySxz/NOHn3jad87u75q8nDmG/J0mzR3cBvI/Ln2V9nOePiw8lRkiL5k5doDWxzJfYhRHVciidMA784oRhoBxzq/tUhTrb4HmNFWfxPeauaAJhIHs2ccGQGYD5HYtHmvtwy80HUxuPSDoGpGbnlEWlGrQnfufHcr4pgTYUc1bBIIBsWFsyJtT5w== 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=va1gRnL22uc8g4vR8TxDbYJvTQLDGhbU5rlHnLIj6to=; b=N2X6n7JGz3qlQ+DHHKu0SQmv1kdudTXXkF3Htaqt9SueKVX1V20kNC9bxNcgSyS30VRieySAwgxBKZ+t1mlTlguuchdyHEwqG8gTsmMFTogk9ABfHbXu4yV56aS47FLJpuNos9kjGyH/iJAtlsT59EL47dSoCiomlHPi/egvNI8= Received: from MN2PR11MB3807.namprd11.prod.outlook.com (2603:10b6:208:f0::24) by MN2PR11MB3822.namprd11.prod.outlook.com (2603:10b6:208:f8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.20; Fri, 31 Jul 2020 02:29:39 +0000 Received: from MN2PR11MB3807.namprd11.prod.outlook.com ([fe80::401c:b4b:31c4:98b8]) by MN2PR11MB3807.namprd11.prod.outlook.com ([fe80::401c:b4b:31c4:98b8%3]) with mapi id 15.20.3239.020; Fri, 31 Jul 2020 02:29:39 +0000 From: "Xing, Beilei" To: "Sun, GuinanX" , "Guo, Jia" , "dev@dpdk.org" CC: "Sun, GuinanX" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2] net/i40e: fix link status Thread-Index: AQHWZl0jSSwyLyvP7UOn9YwAfe5U5qkg9ung Date: Fri, 31 Jul 2020 02:29:39 +0000 Message-ID: References: <20200730082539.24104-1-guinanx.sun@intel.com> <20200730102527.49884-1-guinanx.sun@intel.com> In-Reply-To: <20200730102527.49884-1-guinanx.sun@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.37] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 28d228c7-de1e-4a8b-3c71-08d834f9933e x-ms-traffictypediagnostic: MN2PR11MB3822: 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:2089; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: wninfOVou5lO4zsp2jEgjR3RkDTgLsx47VWenCKpBaHim0iDNoFUYh1/3v7hkvI+Fj7tFQyE0wXRq/dyk5XXN1o15YHRwxV13JarXX6WHXLU9NEocTHFcrdi/lhpN9LtwC5K2YqyMIgUmL/0h5WsSvT2K20qc0a9EXf8vAPkDJdP8ITqCpfcC7wiAi/oW5bBmcUgQdKrzhu7bpXmSV8O1LqqpVkI/yGRwsJqMcAVie/qgpHi5VnN+cKdMgg4cYgtCAXZha+2c6KbESdWmKaNa88yrIeSt7SGS4wUDviIIIpeno4L7SvhtaFShSiaD5weXBjnk0B38tWBekoE4F7Rjw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR11MB3807.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(346002)(366004)(396003)(39860400002)(136003)(8676002)(2906002)(83380400001)(5660300002)(478600001)(450100002)(8936002)(86362001)(9686003)(52536014)(55016002)(66476007)(66446008)(66556008)(64756008)(66946007)(4326008)(6506007)(7696005)(53546011)(76116006)(316002)(54906003)(186003)(26005)(33656002)(71200400001)(110136005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: 7yb4jZFF0vfjVzni8qG9MKB0w2IcXISOn3hkPGVLnBn/M8orWcunzdwDbGYqLwmcLW/lsZjEv83eg9QJuj1WM0i3NJOS+bnbrjpq7tQxyFWzN0sej8SwJ6K2qvVS44eIbSsLUgIGcUAjVH5vTBmjCBqR4pFJePHonLIG2mu8Pppf8H2JbatqbEOxiINeQs7fEgyfgWP+tRBNrLBomsNfQdVMPceVAoELYhHdPo3sDfPCu4WQmSWQKrOMU+VNCNPv4c0P9RibLr7XNi8ToTpTnGqaXwrYCEit4U67tVT6BWyeSNeBz4a9XveadsArNS2DjS0PyaIzcQNFIXbVsrA6elN8fXj73vnfa1dyjx84U0h9zvSQpdDKLqzqK0euHf2lKlCKW+GR8S2/vNj+118YV1VR8OU4HNWJN3DafK2JQonBAEoMFgA86IbePYLpndjwppF7o+B1C8rhOSO8Hl1R6cdVjzS6fjwnTWA/vH7nLM+sauDF38QkY4HLimTmKVUXprf1nBp6zbCx2C9Bnu1wGT4n9wYR2jkQ0pGIGWNzmToUUDxHFJwIgNUY2I7yxg4iWmo8Z8zSH8YR19neQ/7hTGriHyLps215pfT682tBigGtQrPtN6IC2xki0XEsHin+MmM035edeTl++Q66NLmvFg== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR11MB3807.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 28d228c7-de1e-4a8b-3c71-08d834f9933e X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Jul 2020 02:29:39.3846 (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: 9KgiCXb+JuYp/P/gy55S3EJQn/s5FWVBbZGYbacOQWI7w8+lSWMqEykdAmsUvNbtF+3hs1+wQpx/xN04NM8MMA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3822 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix link status 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: dev On Behalf Of Guinan Sun > Sent: Thursday, July 30, 2020 6:25 PM > To: Xing, Beilei ; Guo, Jia ; > dev@dpdk.org > Cc: Sun, GuinanX ; stable@dpdk.org > Subject: [dpdk-dev] [PATCH v2] net/i40e: fix link status >=20 > If the PF driver supports the new speed reporting capabilities then use > link_event_adv instead of link_event to get the speed. >=20 > Fixes: 2a73125b7041 ("i40evf: fix link info update") > Cc: stable@dpdk.org >=20 > Signed-off-by: Guinan Sun > --- > v2: > * Modify commit log. > * Add code comments. > * Delete useless codes. > --- > drivers/net/i40e/base/virtchnl.h | 16 +++++++++++- > drivers/net/i40e/i40e_ethdev_vf.c | 42 +++++++++++++++++++++++++++++-- > 2 files changed, 55 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/net/i40e/base/virtchnl.h b/drivers/net/i40e/base/vir= tchnl.h > index 4f498ca45..9c64fd469 100644 > --- a/drivers/net/i40e/base/virtchnl.h > +++ b/drivers/net/i40e/base/virtchnl.h > @@ -240,7 +240,8 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, > virtchnl_vsi_resource); > #define VIRTCHNL_VF_OFFLOAD_ENCAP 0X00100000 > #define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00200000 > #define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM 0X00400000 > - > +/* Define below the capability flags that are not offloads */ > +#define VIRTCHNL_VF_CAP_ADV_LINK_SPEED 0x00000080 You defined the new capability VIRTCHNL_VF_CAP_ADV_LINK_SPEED in the patch, but didn't request the capability for i40evf? > #define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \ > VIRTCHNL_VF_OFFLOAD_VLAN | \ > VIRTCHNL_VF_OFFLOAD_RSS_PF) > @@ -536,10 +537,23 @@ enum virtchnl_event_codes { struct > virtchnl_pf_event { > enum virtchnl_event_codes event; > union { > + /* 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 and link information. The ability to > understand > + * new speeds is indicated by setting the capability flag > + * VIRTCHNL_VF_CAP_ADV_LINK_SPEED in vf_cap_flags > parameter > + * in virtchnl_vf_resource struct and can be used to determine > + * which link event struct to use below. > + */ > struct { > enum virtchnl_link_speed link_speed; > bool link_status; > } link_event; > + struct { > + /* link_speed provided in Mbps */ > + u32 link_speed; > + u8 link_status; > + } link_event_adv; > } event_data; >=20 > int severity; > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c > b/drivers/net/i40e/i40e_ethdev_vf.c > index 69cab8e73..f8cf45fbe 100644 > --- a/drivers/net/i40e/i40e_ethdev_vf.c > +++ b/drivers/net/i40e/i40e_ethdev_vf.c > @@ -1386,8 +1386,46 @@ i40evf_handle_pf_event(struct rte_eth_dev *dev, > uint8_t *msg, > break; > 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.link_speed; > + > + if (vf->vf_res->vf_cap_flags & > VIRTCHNL_VF_CAP_ADV_LINK_SPEED) { > + vf->link_up =3D > + pf_msg- > >event_data.link_event_adv.link_status; > + > + switch (pf_msg- > >event_data.link_event_adv.link_speed) { > + case ETH_SPEED_NUM_100M: > + vf->link_speed =3D I40E_LINK_SPEED_100MB; > + break; > + case ETH_SPEED_NUM_1G: > + vf->link_speed =3D I40E_LINK_SPEED_1GB; > + break; > + case ETH_SPEED_NUM_2_5G: > + vf->link_speed =3D I40E_LINK_SPEED_2_5GB; > + break; > + case ETH_SPEED_NUM_5G: > + vf->link_speed =3D I40E_LINK_SPEED_5GB; > + break; > + case ETH_SPEED_NUM_10G: > + vf->link_speed =3D I40E_LINK_SPEED_10GB; > + break; > + case ETH_SPEED_NUM_20G: > + vf->link_speed =3D I40E_LINK_SPEED_20GB; > + break; > + case ETH_SPEED_NUM_25G: > + vf->link_speed =3D I40E_LINK_SPEED_25GB; > + break; > + case ETH_SPEED_NUM_40G: > + vf->link_speed =3D I40E_LINK_SPEED_40GB; > + break; > + default: > + vf->link_speed =3D > I40E_LINK_SPEED_UNKNOWN; > + break; > + } > + } else { > + vf->link_up =3D > + pf_msg->event_data.link_event.link_status; > + vf->link_speed =3D > + pf_msg->event_data.link_event.link_speed; > + } > break; > case VIRTCHNL_EVENT_PF_DRIVER_CLOSE: > PMD_DRV_LOG(DEBUG, > "VIRTCHNL_EVENT_PF_DRIVER_CLOSE event"); > -- > 2.17.1