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 87F5DA0352; Wed, 6 May 2020 07:22:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EDC421D662; Wed, 6 May 2020 07:22:22 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 211371D642; Wed, 6 May 2020 07:22:20 +0200 (CEST) IronPort-SDR: z8Ke3I/olkge69eQtkV/09Ns2WOS9Hp/ORIwZIs45mf1XAYzBJictdNEiDIEZ+pojJcrlv9p9X r8D7hJs91utw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2020 22:22:19 -0700 IronPort-SDR: lFLfZxmRCXZpha/o4H47Gm6zFiqoby9KWxIbru+j51w53txTwrFKNhnCOFr4ZMIq5uTwdp3HQA W/5l4NXpJExg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,357,1583222400"; d="scan'208";a="461304321" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.116.183]) by fmsmga005.fm.intel.com with ESMTP; 05 May 2020 22:22:17 -0700 Date: Wed, 6 May 2020 13:14:15 +0800 From: Ye Xiaolong To: alvinx.zhang@intel.com Cc: dev@dpdk.org, qi.z.zhang@intel.com, beilei.xing@intel.com, jingjing.wu@intel.com, stable@dpdk.org Message-ID: <20200506051415.GA71070@intel.com> References: <20200428090616.15260-1-alvinx.zhang@intel.com> <20200430032111.21380-1-alvinx.zhang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200430032111.21380-1-alvinx.zhang@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH v3] 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" On 04/30, alvinx.zhang@intel.com wrote: >From: Alvin Zhang > >If the PF driver does not support the new speed reporting capabilities then >use link_event instead of link_event_adv to get the speed. > >Fixes: 48de41ca11f0 (net/iavf: enable link status update) >Cc: jingjing.wu@intel.com >Cc: stable@dpdk.org > >Signed-off-by: Alvin Zhang > >V2: Modify codes according to comments. >V3: Update git log. >--- Please put the changelog after '---' mark. > 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..5b8d32e 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(enum virtchnl_link_speed virt_link_speed) >+{ >+ uint32_t speed; >+ >+ switch (virt_link_speed) { >+ case VIRTCHNL_LINK_SPEED_100MB: >+ speed = 100; >+ break; >+ case VIRTCHNL_LINK_SPEED_1GB: >+ speed = 1000; >+ break; >+ case VIRTCHNL_LINK_SPEED_10GB: >+ speed = 10000; >+ break; >+ case VIRTCHNL_LINK_SPEED_40GB: >+ speed = 40000; >+ break; >+ case VIRTCHNL_LINK_SPEED_20GB: >+ speed = 20000; >+ break; >+ case VIRTCHNL_LINK_SPEED_25GB: >+ speed = 25000; >+ break; >+ case VIRTCHNL_LINK_SPEED_2_5GB: >+ speed = 2500; >+ break; >+ case VIRTCHNL_LINK_SPEED_5GB: >+ speed = 5000; >+ break; >+ default: >+ speed = 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 = pf_msg->event_data.link_event.link_status; >- vf->link_speed = 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 = >+ pf_msg->event_data.link_event_adv.link_speed; >+ } else { >+ enum virtchnl_link_speed speed; >+ speed = pf_msg->event_data.link_event.link_speed; >+ vf->link_speed = 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 > Applied to dpdk-next-net-intel with beilei's ack, Thanks.