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 8F782A0351; Thu, 6 Aug 2020 11:46:37 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AABAB1C0AF; Thu, 6 Aug 2020 11:46:35 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id BB34E1C038; Thu, 6 Aug 2020 11:46:33 +0200 (CEST) IronPort-SDR: 0TjRD9um93sEG5qcgjm8Ol/0nni0nmhw9XV3RfdHanKHtygPRZoIhDxdSTqvhcl1IfqdAGnRiH 9boY36Uy6iFA== X-IronPort-AV: E=McAfee;i="6000,8403,9704"; a="150222083" X-IronPort-AV: E=Sophos;i="5.75,441,1589266800"; d="scan'208";a="150222083" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Aug 2020 02:46:33 -0700 IronPort-SDR: kFoofqBDl/FNPChNi2bkZaV/6m04XLyEauRWExlPRtEfePaQG2Q5mvFIOZC0jQvps5ovyuhojP jY4H03qu1q4g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,441,1589266800"; d="scan'208";a="437484027" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga004.jf.intel.com with ESMTP; 06 Aug 2020 02:46:32 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 6 Aug 2020 02:46:32 -0700 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 6 Aug 2020 02:46:31 -0700 Received: from ORSEDG002.ED.cps.intel.com (10.7.248.5) by orsmsx609.amr.corp.intel.com (10.22.229.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 6 Aug 2020 02:46:31 -0700 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (104.47.44.52) by edgegateway.intel.com (134.134.137.101) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 6 Aug 2020 02:46:31 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XblIdEhSbmQ03hlRh1NVQSI+pY2JXP2RKNhTnLLXTW30cpF53DstIVYF9IDbXkwu0lcI/p2HxuhsQefC5Tqr8XLA4reXZMTK9sW79YgVTzKOZvtW3k2Agbw8JawV30OCc5H5eMeCSNFflQCubkneQp+4YI6/h8DY17gugoq5G6u6vp7e5eRbkHdideMmJaF/KJrakWeNcjC3IfEz0KwmFhurqbN+uyTdDQctdMMRkhS4XMZFCOqOIMSx3PTwVyqGPoscC1yjegNM6rQiSE/JwoeIMfB26nYHY27OERtAQYB7/P+kgDfHH6edf/WNwlPhQq9JyNxZ9yFFfn6ES469gw== 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=tUEMIHSjSIhzePLoWSg/cs1L47nUYDxSf17HL7m1ZZ4=; b=nY10WhilUTYjSF3cW3XLhhUO827Gfu0kUDQHilnxz1J4t2cPypn97DwnEDFV34k8tgSikZnQWHG/PkqFkSzeFvfeT+B7ELzJlJUKra2AUVF2j0R/lYR5l4eicL/Y6jFMExUXSfmavI/IhPGlm6c/S54EBqFLWH7cZNF18AamcQRGxxJyjd6qLTnwYb9nrWBVHrMn2SxO3u4tJc/QZvGL8u/VEobuOwL9KuZJo2l9nwHdsqzMHd4oxyhxx+Iw0dubcMdYgnKr8EQFv9jlS03dog3hUp9IG5f9QIOwjZ/P4NtsH2WT7/7JG9Jdnc/sPIhQD8j8B6OARQ9ZhIfpfY91jQ== 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=tUEMIHSjSIhzePLoWSg/cs1L47nUYDxSf17HL7m1ZZ4=; b=iqnd3C2R/en3uN4h1nw2JS+78zDgXay4kdr+198DlTNTywrXbpXDeE6qZQw/95BNzl+TndrbYubxXSPhCrocBFi4N6WSrlWk3XIJxrourqk70CqqJtNE9Bp7aU2IZTwR92smXUpCPvbkP8FlchyWaRXR9+PUrJyyPVrSCGkR+S8= Received: from BYAPR11MB3477.namprd11.prod.outlook.com (2603:10b6:a03:7c::28) by BY5PR11MB4150.namprd11.prod.outlook.com (2603:10b6:a03:190::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.17; Thu, 6 Aug 2020 09:46:25 +0000 Received: from BYAPR11MB3477.namprd11.prod.outlook.com ([fe80::d1dd:de76:4e99:7c85]) by BYAPR11MB3477.namprd11.prod.outlook.com ([fe80::d1dd:de76:4e99:7c85%7]) with mapi id 15.20.3261.019; Thu, 6 Aug 2020 09:46:25 +0000 From: "Wang, ShougangX" To: "Sun, GuinanX" , "dev@dpdk.org" CC: "Xing, Beilei" , "Guo, Jia" , "Sun, GuinanX" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v3] net/i40e: fix link status Thread-Index: AQHWa819X1M/arDRsUieVjmvS+vupKkq1Tog Date: Thu, 6 Aug 2020 09:46:25 +0000 Message-ID: References: <20200730082539.24104-1-guinanx.sun@intel.com> <20200806081641.19916-1-guinanx.sun@intel.com> In-Reply-To: <20200806081641.19916-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.36] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 29f3c9b0-7769-4fe8-e7c3-08d839ed9587 x-ms-traffictypediagnostic: BY5PR11MB4150: 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:1824; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: M9eXOdoJ2Jthp8wWJVetJXjwmnUhTYtlNwRE0iDZMtnYs8gL3yqUvh+/FU/S8SC2P41VyJBuro77EuuHHXOvHnBnj/EjdJRZz9PKI+DXCac1K1pL/foSgiilmzlUufNsDZr+BVk++6zbHPawNkRQRUKREnSrdWHjs3iH5xBYGFPmrG8u56uuCd5LPNxQlLrQEULn7n90ltfU6BiHehNbwlfBz1ZNNm0VgC3HclCm/hGg2jRVdBo4rrsG4hB+e+cggULQaXtNxbZVaEhX+WDI4ONUATBc13f+PelaG5uvLuZYv9R+OUzAD9EEuF3mSboM/AoNUwZ6t/Q1fx2IW/PzKw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3477.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(396003)(39860400002)(346002)(136003)(376002)(478600001)(9686003)(2906002)(76116006)(110136005)(4326008)(86362001)(26005)(54906003)(52536014)(5660300002)(8936002)(55016002)(316002)(8676002)(71200400001)(450100002)(33656002)(53546011)(66476007)(66946007)(83380400001)(66446008)(66556008)(64756008)(186003)(6506007)(7696005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: QTs4APgdDruN5YY8YsCrsqGUvrT4xj2W8W6BvyEvmw21bflbW2tFa/t7IvDqMjfLsFMOiMf9LXWEVJ9jg+ujmD5r5U8NT67fzauZxWl7v42POEvi7o4BhF/UHED6/qTKtWgRZuV9HHmYJNVNg8oV5wHFdF6OJtPxXW5YoUPN8KqFYmRJHzU3JVXGV1XEtCBTMsjPwp0l74s6+ZXy5MwIhM1Y34M09NCIjx0Df3Z68FGkohFBCmngK0H10FCz60xCD6sEs21IJV+Cy4JUVDiJ7MAOFCejVwVoRml5pPFUR8KniwQYl3pankiASLf5zWuqSZNMB3N6VIFiYELRS8voxDe0lwJgFQXlgp/CtbvJLM6Tp8pKXuSUxNf/v80WS0lUFtJC6wDOph2joyqRCea7WHIuB2Z2Y8HvfUENUNXm7DPkkV97wJg4ZzrxuKw3YGylfbBLTrfdbIK/5e7cVGqoKuTAA6rCvu2o37XswDRdxSlTfDy1RqD7u4TCO8u8QDQtKBzRhT9UFeHcrZkMoMGkxIpUx7PkRoVDxec7oyr8HsUhHveWLmMHE6/XANCzNo9Cc82dC5bUWzg819AkFJl6eUypu86L44VIolb3JtJvNPO95dtgtB4D5xDUwyt0N0wMGX4Cld4P/qRNTDBDcXBg4g== 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: BYAPR11MB3477.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 29f3c9b0-7769-4fe8-e7c3-08d839ed9587 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Aug 2020 09:46:25.0450 (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: RtZ6vkfLC1r8n+c4phxymP8u/BhLf1j21R6XgcSLoyvSOkm/jmlxgKlhZKdAKYKBeXWzIOv3DOBwACycC2mASv3P1uFjBaal2p8YXNmir0U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR11MB4150 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v3] 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" Tested-by: Shougang Wang Thanks. Shougang > -----Original Message----- > From: dev On Behalf Of Guinan Sun > Sent: Thursday, August 6, 2020 4:17 PM > To: dev@dpdk.org > Cc: Xing, Beilei ; Guo, Jia ; S= un, > GuinanX ; stable@dpdk.org > Subject: [dpdk-dev] [PATCH v3] 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 > --- > v3: > * request the capability for i40evf > v2: > * modify commit log > * add code comments > * delete useless code > --- > drivers/net/i40e/base/virtchnl.h | 16 ++++++++++- > drivers/net/i40e/i40e_ethdev_vf.c | 45 > ++++++++++++++++++++++++++++--- > 2 files changed, 57 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/net/i40e/base/virtchnl.h > b/drivers/net/i40e/base/virtchnl.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 > #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..ccf5d8c57 100644 > --- a/drivers/net/i40e/i40e_ethdev_vf.c > +++ b/drivers/net/i40e/i40e_ethdev_vf.c > @@ -469,7 +469,8 @@ i40evf_get_vf_resource(struct rte_eth_dev *dev) > VIRTCHNL_VF_OFFLOAD_RSS_AQ | > VIRTCHNL_VF_OFFLOAD_RSS_REG | > VIRTCHNL_VF_OFFLOAD_VLAN | > - VIRTCHNL_VF_OFFLOAD_RX_POLLING; > + VIRTCHNL_VF_OFFLOAD_RX_POLLING | > + VIRTCHNL_VF_CAP_ADV_LINK_SPEED; > args.in_args =3D (uint8_t *)∩︀ > args.in_args_size =3D sizeof(caps); > } else { > @@ -1386,8 +1387,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