DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Xing, Beilei" <beilei.xing@intel.com>
To: "Zhang, AlvinX" <alvinx.zhang@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "Zhang, Qi Z" <qi.z.zhang@intel.com>,
	"Wu, Jingjing" <jingjing.wu@intel.com>,
	"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v3] net/iavf: fix link speed
Date: Thu, 30 Apr 2020 06:18:22 +0000	[thread overview]
Message-ID: <BYAPR11MB3541E205E647D203B43EC62DF7AA0@BYAPR11MB3541.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20200430032111.21380-1-alvinx.zhang@intel.com>



> -----Original Message-----
> From: Zhang, AlvinX <alvinx.zhang@intel.com>
> Sent: Thursday, April 30, 2020 11:21 AM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> Zhang, AlvinX <alvinx.zhang@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; stable@dpdk.org
> Subject: [PATCH v3] net/iavf: fix link speed
> 
> From: Alvin Zhang <alvinx.zhang@intel.com>
> 
> 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 <alvinx.zhang@intel.com>
> 
> V2: Modify codes according to comments.
> V3: Update git log.
> ---
>  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

Acked-by: Beilei Xing <beilei.xing@intel.com>


  reply	other threads:[~2020-04-30  6:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28  8:52 [dpdk-dev] [PATCH v2] " alvinx.zhang
2020-04-28  9:06 ` alvinx.zhang
2020-04-30  3:21   ` [dpdk-dev] [PATCH v3] " alvinx.zhang
2020-04-30  6:18     ` Xing, Beilei [this message]
2020-05-06  5:14     ` [dpdk-dev] [dpdk-stable] " Ye Xiaolong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BYAPR11MB3541E205E647D203B43EC62DF7AA0@BYAPR11MB3541.namprd11.prod.outlook.com \
    --to=beilei.xing@intel.com \
    --cc=alvinx.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).