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 2140DA0518; Thu, 30 Jul 2020 12:51:54 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A11291C027; Thu, 30 Jul 2020 12:51:52 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 7E8AFA69; Thu, 30 Jul 2020 12:51:50 +0200 (CEST) IronPort-SDR: HjWSRXWNnO5AaDG+VlQtGWDaE3jXXUubF1A2QfSexftTEpNvy3Hms/KoOpxr0Ro4l35hyJQGuD xNNHtpfQUr9Q== X-IronPort-AV: E=McAfee;i="6000,8403,9697"; a="213108295" X-IronPort-AV: E=Sophos;i="5.75,414,1589266800"; d="scan'208";a="213108295" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2020 03:51:49 -0700 IronPort-SDR: gMveafmsGRCRdV5G5s/VoptuvK689LNdYx/fJ5CZLa5Nw7KyjRqLwmDvRMrVmxUbHv6nQMPnJ8 OAUuWQIPbGlA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,414,1589266800"; d="scan'208";a="365135357" Received: from orsmsx108.amr.corp.intel.com ([10.22.240.6]) by orsmga001.jf.intel.com with ESMTP; 30 Jul 2020 03:51:49 -0700 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by ORSMSX108.amr.corp.intel.com (10.22.240.6) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 30 Jul 2020 03:51:48 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.169) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 30 Jul 2020 03:51:49 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VfBb4gx+B04R2En7cKbRqfFOf/PFy7RIHFndV5QiviZS40pv0BKDj+LsK2wB8Ew2s4Y89QrZLUbXPeP/Nj69DHF+Qi7VgP7yHyrsy5nXVfzwCabuHVj53ehJ//HE4tIJ/+sxg7BbMREECBfvAae6Z5PJArhqKmV0koDS/bQkuXzBPTzN36Bl27J6IgbQ8ClLEG9xi1gXvbo2frZDgX8nXbSrKfwN6niyjB/4M8WYOn8rbSyO6E8cSMwsCykayAqFDb8b2+SwBMmzO8OfbrV2mPEXsa+rXum5Zdjv8c7UMEBeg0p10e9oJPadsKBAs79aXEPOLw/60Ic+wgt2s5bNOQ== 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=7rjgGUVxhxS5YXupth6XVfh1fojm2IflRrNOzoywEdQ=; b=LQdusbH3OWgIGFmvSg8BnOysdmtHqDZbGl3PjoWLibM2IEVzm5JJVyfsIQdvqd7CqN5KLm+PW/sFRRNGYwFj/qLo1GSQDrNDHY1kncY5goE2POyLsNoLfnAA8nT7mh1e0uM0lutMnChgzxHk5zBh4T1cV7TpLcqKFAJnkPH+bC+0TlAmO43OefooQjwodOt1g6Wej5Pl3Xk8nNlyydkmTVhpvefo/Rx06fupSNi9OKQGxjs09s/nj10RQZfsQMuhdgdGYzadwhOwlze/IYwQWNZ5XhLSB+J3Y+o4Xn6fke/L6yTs4VtMyJ8MaSVyW6gCnCVvMyzCa0Ai61s4NMuLJw== 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=7rjgGUVxhxS5YXupth6XVfh1fojm2IflRrNOzoywEdQ=; b=r4d62WEQUS9SdnPQZXATT/CIeRtWDZ7Dhs9XEIBsR8/MUPlv/7TpJE03kedEBZ2AoUmkspNVhlQjqkWjV59ukdhPqDP/D+Aem0XdiCTpvcdUF/rmW0YPVPZHSfI4fTRAh6bLzjvXLbgJe1qWS8kIPB4aWBKDDJA5gqoHiFjyzy0= Received: from BYAPR11MB3477.namprd11.prod.outlook.com (2603:10b6:a03:7c::28) by BYAPR11MB2903.namprd11.prod.outlook.com (2603:10b6:a03:89::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.17; Thu, 30 Jul 2020 10:51:47 +0000 Received: from BYAPR11MB3477.namprd11.prod.outlook.com ([fe80::885a:3870:e38b:572f]) by BYAPR11MB3477.namprd11.prod.outlook.com ([fe80::885a:3870:e38b:572f%6]) with mapi id 15.20.3216.034; Thu, 30 Jul 2020 10:51:47 +0000 From: "Wang, ShougangX" To: "Sun, GuinanX" , "Xing, Beilei" , "Guo, Jia" , "dev@dpdk.org" CC: "Sun, GuinanX" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2] net/i40e: fix link status Thread-Index: AQHWZl0lS2MqPozo2UuN9HhkewQQ+qkf8emA Date: Thu, 30 Jul 2020 10:51:46 +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.36] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1d264389-7346-4e94-649f-08d834768e3d x-ms-traffictypediagnostic: BYAPR11MB2903: 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:1060; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: J9DLEjk+c3sY3BEwbVuTqq4/XNuHZcHtL8n6Aj6Py1PzzA4LQUBD41iA4vReR9kGWxoYdXOsSHZEksr30XoBdRfo2cRkyXajr57JwqW5oQRa54bhYNsPfRsl2UYob+r2iLuHhE77z/56Lf3zMbFnrjnkvlSZ/IDt2oe+xbfGGlsNPR7mjgxofY5QCaBnJiPAooqiW3baYkHyyQH6hsWgF7xOGDZ4z6HjBFEkJhjO4oFOu2OlLQx3G9G7Qknda+J7grmJU9Acv209FhSOFRumh8wMyf6dRwHFzwenzNmW8MY4jOSNj0qpeAM3Dg1JWZcUcS5ZchprVUzRpKGnmHYt2Q== 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)(376002)(346002)(39860400002)(136003)(396003)(7696005)(66946007)(5660300002)(6506007)(66556008)(66476007)(8676002)(33656002)(76116006)(4326008)(64756008)(66446008)(53546011)(26005)(2906002)(9686003)(316002)(8936002)(478600001)(450100002)(52536014)(83380400001)(55016002)(71200400001)(186003)(54906003)(86362001)(110136005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: t1NA7J+LAJruVyz5dijsScU89UG/pi9KbtrcomYLnRfpchBm6OBs4jV6k5s6Ou1nhiQU/xTD0+HNtEL5mUGNbE8kLCpGB5Y0tskSEzliCM9OHF7RyEMq+xjsRqEYn7cVo60VDeGiCsNcxOe2libqB4t13/C6ZjatzNFwjseHSsLobhXJUJOnlpeNhFoGZ3aOYmEYhs77WmYrXYJfSrXyaAu70QermpaUpK+jcbbLapV4dxtlBWKA7iFDr+JapNlmxlfFZtpz/2G8EhnKyH8ZM/Eb83gr1Iwsobuuc0rFuYOvCQOLoRoe5gn24h+bK6HClTqWfXvGWzvYKlw9umJFnYakraXuuQwsib24HR6sAzrf44wy0KdCCWo+QgmyMJFaxv1hl0pnh/kPukJqGUWRHLLXqdnMEM4bSQwWjg2PK7ZgkHQgx/cPB0MJ3ii++UeNXcHR1gcUSFL+WnqdqZ9o+xi7XnthvAxhVfBpiMMthNRQ+HyU46IFTmMefJRvYk/fpWnSSSQyseH/PMsEL7HcJpadfB7eHCABZ9lXL7j5qsELNXKgdWOrQqVA7uqv5Sy+eb4zTlewKaVdWAx8KUN7TPF3cSgvRYD28s5uNJqD34UJ55Pny1mjf8EASqtk1bgQKdDd5msXvhNQeS8vAcJC6w== 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: 1d264389-7346-4e94-649f-08d834768e3d X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jul 2020 10:51:46.8609 (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: HrFcTNfREfllQKM+UJbntQK6myUtOVp8PrMHXf9vEzC3IsLmEQYAIikbPgG9R42NmYyApst9sxGcGTc4biQ2vTNHocfwWntmSKGo9y+nTIU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2903 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" Tested-by: Shougang Wang > -----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/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..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