DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2] net/iavf: fix link speed
@ 2020-04-28  8:52 alvinx.zhang
  2020-04-28  9:06 ` alvinx.zhang
  0 siblings, 1 reply; 5+ messages in thread
From: alvinx.zhang @ 2020-04-28  8:52 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, beilei.xing, Alvin Zhang, jingjing.wu, stable

From: Alvin Zhang <alvinx.zhang@intel.com>

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.

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>
---
 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH v2] net/iavf: fix link speed
  2020-04-28  8:52 [dpdk-dev] [PATCH v2] net/iavf: fix link speed alvinx.zhang
@ 2020-04-28  9:06 ` alvinx.zhang
  2020-04-30  3:21   ` [dpdk-dev] [PATCH v3] " alvinx.zhang
  0 siblings, 1 reply; 5+ messages in thread
From: alvinx.zhang @ 2020-04-28  9:06 UTC (permalink / raw)
  To: dev; +Cc: Alvin Zhang, jingjing.wu, stable

From: Alvin Zhang <alvinx.zhang@intel.com>

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.

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.
---
 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH v3] net/iavf: fix link speed
  2020-04-28  9:06 ` alvinx.zhang
@ 2020-04-30  3:21   ` alvinx.zhang
  2020-04-30  6:18     ` Xing, Beilei
  2020-05-06  5:14     ` [dpdk-dev] [dpdk-stable] " Ye Xiaolong
  0 siblings, 2 replies; 5+ messages in thread
From: alvinx.zhang @ 2020-04-30  3:21 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, beilei.xing, Alvin Zhang, jingjing.wu, stable

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v3] net/iavf: fix link speed
  2020-04-30  3:21   ` [dpdk-dev] [PATCH v3] " alvinx.zhang
@ 2020-04-30  6:18     ` Xing, Beilei
  2020-05-06  5:14     ` [dpdk-dev] [dpdk-stable] " Ye Xiaolong
  1 sibling, 0 replies; 5+ messages in thread
From: Xing, Beilei @ 2020-04-30  6:18 UTC (permalink / raw)
  To: Zhang, AlvinX, dev; +Cc: Zhang, Qi Z, Wu, Jingjing, stable



> -----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>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v3] net/iavf: fix link speed
  2020-04-30  3:21   ` [dpdk-dev] [PATCH v3] " alvinx.zhang
  2020-04-30  6:18     ` Xing, Beilei
@ 2020-05-06  5:14     ` Ye Xiaolong
  1 sibling, 0 replies; 5+ messages in thread
From: Ye Xiaolong @ 2020-05-06  5:14 UTC (permalink / raw)
  To: alvinx.zhang; +Cc: dev, qi.z.zhang, beilei.xing, jingjing.wu, stable

On 04/30, alvinx.zhang@intel.com wrote:
>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.
>---

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-05-06  5:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28  8:52 [dpdk-dev] [PATCH v2] net/iavf: fix link speed 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
2020-05-06  5:14     ` [dpdk-dev] [dpdk-stable] " Ye Xiaolong

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git