DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] i40evf: fix link info update
@ 2016-04-01  1:36 Jingjing Wu
  2016-04-01  8:23 ` Thomas Monjalon
  2016-04-05  2:01 ` [dpdk-dev] [PATCH v2] " Jingjing Wu
  0 siblings, 2 replies; 4+ messages in thread
From: Jingjing Wu @ 2016-04-01  1:36 UTC (permalink / raw)
  To: dev; +Cc: jingjing.wu, helin.zhang

The issue is the VF's link speed kept as 10G and status always was up.
It did not change even the physical link's status changed.
This patch fixes this issue to make VF's link info consistent with
physical link.

Fixes: 4861cde46116 (i40e: new poll mode driver)
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 doc/guides/rel_notes/release_16_04.rst |  5 +++++
 drivers/net/i40e/i40e_ethdev.h         |  1 +
 drivers/net/i40e/i40e_ethdev_vf.c      | 33 +++++++++++++++++++++++++++++----
 3 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst
index 79d76e1..b44a02f 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -366,6 +366,11 @@ Drivers
   info for l3fwd to work well. Now there is an option for l3fwd to analysis
   packet type softly, so enable vector driver by default.
 
+* **i40e: Fixed link info of VF
+  Previously, the VF's link speed kept as 10G and status always was up. It did not
+  change even the physical link's status changed. Now this issue is fixed to make
+  VF's link info consistent with physical link.
+
 * **mlx5: Fixed possible crash during initialization.**
 
   A crash could occur when failing to allocate private device context.
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index ce945fe..cfd2399 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -502,6 +502,7 @@ struct i40e_vf {
 	/* Event from pf */
 	bool dev_closed;
 	bool link_up;
+	enum i40e_aq_link_speed link_speed;
 	bool vf_reset;
 	volatile uint32_t pend_cmd; /* pending command not finished yet */
 	uint32_t cmd_retval; /* return value of the cmd response from PF */
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index a13d9cc..71af0f7 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -258,6 +258,8 @@ i40evf_read_pfmsg(struct rte_eth_dev *dev, struct i40evf_arq_msg_info *data)
 		case I40E_VIRTCHNL_EVENT_LINK_CHANGE:
 			vf->link_up =
 				vpe->event_data.link_event.link_status;
+			vf->link_speed =
+				vpe->event_data.link_event.link_speed;
 			vf->pend_msg |= PFMSG_LINK_CHANGE;
 			PMD_DRV_LOG(INFO, "Link status update:%s",
 				    vf->link_up ? "up" : "down");
@@ -1310,6 +1312,7 @@ i40evf_handle_pf_event(__rte_unused struct rte_eth_dev *dev,
 {
 	struct i40e_virtchnl_pf_event *pf_msg =
 			(struct i40e_virtchnl_pf_event *)msg;
+	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 
 	switch (pf_msg->event) {
 	case I40E_VIRTCHNL_EVENT_RESET_IMPENDING:
@@ -1318,6 +1321,8 @@ i40evf_handle_pf_event(__rte_unused struct rte_eth_dev *dev,
 		break;
 	case I40E_VIRTCHNL_EVENT_LINK_CHANGE:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_LINK_CHANGE event\n");
+		vf->link_up = pf_msg->event_data.link_event.link_status;
+		vf->link_speed = pf_msg->event_data.link_event.link_speed;
 		break;
 	case I40E_VIRTCHNL_EVENT_PF_DRIVER_CLOSE:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_PF_DRIVER_CLOSE event\n");
@@ -2124,10 +2129,30 @@ i40evf_dev_link_update(struct rte_eth_dev *dev,
 	if (vf->version_major == I40E_DPDK_VERSION_MAJOR)
 		i40evf_get_link_status(dev, &new_link);
 	else {
-		/* Always assume it's up, for Linux driver PF host */
-		new_link.link_duplex = ETH_LINK_AUTONEG_DUPLEX;
-		new_link.link_speed  = ETH_LINK_SPEED_10000;
-		new_link.link_status = 1;
+		/* Linux driver PF host */
+		switch (vf->link_speed) {
+		case I40E_LINK_SPEED_100MB:
+			new_link.link_speed = ETH_LINK_SPEED_100;
+			break;
+		case I40E_LINK_SPEED_1GB:
+			new_link.link_speed = ETH_LINK_SPEED_1000;
+			break;
+		case I40E_LINK_SPEED_10GB:
+			new_link.link_speed = ETH_LINK_SPEED_10G;
+			break;
+		case I40E_LINK_SPEED_20GB:
+			new_link.link_speed = ETH_LINK_SPEED_20G;
+			break;
+		case I40E_LINK_SPEED_40GB:
+			new_link.link_speed = ETH_LINK_SPEED_40G;
+			break;
+		default:
+			new_link.link_speed = ETH_LINK_SPEED_100;
+			break;
+		}
+		/* full duplex only */
+		new_link.link_duplex = ETH_LINK_FULL_DUPLEX;
+		new_link.link_status = vf->link_up ? 1 : 0;
 	}
 	i40evf_dev_atomic_write_link_status(dev, &new_link);
 
-- 
2.4.0

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

* Re: [dpdk-dev] [PATCH] i40evf: fix link info update
  2016-04-01  1:36 [dpdk-dev] [PATCH] i40evf: fix link info update Jingjing Wu
@ 2016-04-01  8:23 ` Thomas Monjalon
  2016-04-05  2:01 ` [dpdk-dev] [PATCH v2] " Jingjing Wu
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2016-04-01  8:23 UTC (permalink / raw)
  To: Jingjing Wu; +Cc: dev, helin.zhang

Hi Jingjing,

Please rebase on top of Marc's patches.

2016-04-01 09:36, Jingjing Wu:
> +* **i40e: Fixed link info of VF

a blank line is missing

> +  Previously, the VF's link speed kept as 10G and status always was up. It did not
> +  change even the physical link's status changed. Now this issue is fixed to make
> +  VF's link info consistent with physical link.

[...]
> +			new_link.link_speed = ETH_LINK_SPEED_100;
> +			break;
> +		case I40E_LINK_SPEED_1GB:
> +			new_link.link_speed = ETH_LINK_SPEED_1000;

These speeds have new names after Marc's rework.

> +		new_link.link_status = vf->link_up ? 1 : 0;

Please use new constants for link up and down.

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

* [dpdk-dev] [PATCH v2] i40evf: fix link info update
  2016-04-01  1:36 [dpdk-dev] [PATCH] i40evf: fix link info update Jingjing Wu
  2016-04-01  8:23 ` Thomas Monjalon
@ 2016-04-05  2:01 ` Jingjing Wu
  2016-04-06 13:39   ` Thomas Monjalon
  1 sibling, 1 reply; 4+ messages in thread
From: Jingjing Wu @ 2016-04-05  2:01 UTC (permalink / raw)
  To: dev; +Cc: jingjing.wu, helin.zhang

The issue is the VF's link speed kept as 10G and status always was up.
It did not change even the physical link's status changed.
This patch fixes this issue to make VF's link info consistent with
physical link.

Fixes: 4861cde46116 (i40e: new poll mode driver)
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
v2 change:
 rebase on latest code.

 doc/guides/rel_notes/release_16_04.rst |  6 ++++++
 drivers/net/i40e/i40e_ethdev.h         |  1 +
 drivers/net/i40e/i40e_ethdev_vf.c      | 37 ++++++++++++++++++++++++++++------
 3 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst
index d6e358f..4804109 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -382,6 +382,12 @@ Drivers
   info for l3fwd to work well. Now there is an option for l3fwd to analysis
   packet type softly, so enable vector driver by default.
 
+* **i40e: Fixed link info of VF
+
+  Previously, the VF's link speed kept as 10G and status always was up. It did not
+  change even the physical link's status changed. Now this issue is fixed to make
+  VF's link info consistent with physical link.
+
 * **mlx5: Fixed possible crash during initialization.**
 
   A crash could occur when failing to allocate private device context.
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index ce945fe..cfd2399 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -502,6 +502,7 @@ struct i40e_vf {
 	/* Event from pf */
 	bool dev_closed;
 	bool link_up;
+	enum i40e_aq_link_speed link_speed;
 	bool vf_reset;
 	volatile uint32_t pend_cmd; /* pending command not finished yet */
 	uint32_t cmd_retval; /* return value of the cmd response from PF */
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 8cf22ee..2bce69b 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -258,6 +258,8 @@ i40evf_read_pfmsg(struct rte_eth_dev *dev, struct i40evf_arq_msg_info *data)
 		case I40E_VIRTCHNL_EVENT_LINK_CHANGE:
 			vf->link_up =
 				vpe->event_data.link_event.link_status;
+			vf->link_speed =
+				vpe->event_data.link_event.link_speed;
 			vf->pend_msg |= PFMSG_LINK_CHANGE;
 			PMD_DRV_LOG(INFO, "Link status update:%s",
 				    vf->link_up ? "up" : "down");
@@ -1310,6 +1312,7 @@ i40evf_handle_pf_event(__rte_unused struct rte_eth_dev *dev,
 {
 	struct i40e_virtchnl_pf_event *pf_msg =
 			(struct i40e_virtchnl_pf_event *)msg;
+	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 
 	switch (pf_msg->event) {
 	case I40E_VIRTCHNL_EVENT_RESET_IMPENDING:
@@ -1318,6 +1321,8 @@ i40evf_handle_pf_event(__rte_unused struct rte_eth_dev *dev,
 		break;
 	case I40E_VIRTCHNL_EVENT_LINK_CHANGE:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_LINK_CHANGE event\n");
+		vf->link_up = pf_msg->event_data.link_event.link_status;
+		vf->link_speed = pf_msg->event_data.link_event.link_speed;
 		break;
 	case I40E_VIRTCHNL_EVENT_PF_DRIVER_CLOSE:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_PF_DRIVER_CLOSE event\n");
@@ -2121,14 +2126,34 @@ i40evf_dev_link_update(struct rte_eth_dev *dev,
 	 * DPDK pf host provide interfacet to acquire link status
 	 * while Linux driver does not
 	 */
-	if (vf->version_major == I40E_DPDK_VERSION_MAJOR) {
+	if (vf->version_major == I40E_DPDK_VERSION_MAJOR)
 		i40evf_get_link_status(dev, &new_link);
-	} else {
-		/* Always assume it's up, for Linux driver PF host */
-		new_link.link_speed  = ETH_SPEED_NUM_10G;
+	else {
+		/* Linux driver PF host */
+		switch (vf->link_speed) {
+		case I40E_LINK_SPEED_100MB:
+			new_link.link_speed = ETH_SPEED_NUM_100M;
+			break;
+		case I40E_LINK_SPEED_1GB:
+			new_link.link_speed = ETH_SPEED_NUM_1G;
+			break;
+		case I40E_LINK_SPEED_10GB:
+			new_link.link_speed = ETH_SPEED_NUM_10G;
+			break;
+		case I40E_LINK_SPEED_20GB:
+			new_link.link_speed = ETH_SPEED_NUM_20G;
+			break;
+		case I40E_LINK_SPEED_40GB:
+			new_link.link_speed = ETH_SPEED_NUM_40G;
+			break;
+		default:
+			new_link.link_speed = ETH_SPEED_NUM_100M;
+			break;
+		}
+		/* full duplex only */
 		new_link.link_duplex = ETH_LINK_FULL_DUPLEX;
-		new_link.link_autoneg = ETH_LINK_SPEED_AUTONEG;
-		new_link.link_status = ETH_LINK_UP;
+		new_link.link_status = vf->link_up ? ETH_LINK_UP :
+						     ETH_LINK_DOWN;
 	}
 	i40evf_dev_atomic_write_link_status(dev, &new_link);
 
-- 
2.4.0

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

* Re: [dpdk-dev] [PATCH v2] i40evf: fix link info update
  2016-04-05  2:01 ` [dpdk-dev] [PATCH v2] " Jingjing Wu
@ 2016-04-06 13:39   ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2016-04-06 13:39 UTC (permalink / raw)
  To: Jingjing Wu; +Cc: dev, helin.zhang

2016-04-05 10:01, Jingjing Wu:
> The issue is the VF's link speed kept as 10G and status always was up.
> It did not change even the physical link's status changed.
> This patch fixes this issue to make VF's link info consistent with
> physical link.
> 
> Fixes: 4861cde46116 (i40e: new poll mode driver)
> Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>

Applied, thanks

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

end of thread, other threads:[~2016-04-06 13:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-01  1:36 [dpdk-dev] [PATCH] i40evf: fix link info update Jingjing Wu
2016-04-01  8:23 ` Thomas Monjalon
2016-04-05  2:01 ` [dpdk-dev] [PATCH v2] " Jingjing Wu
2016-04-06 13:39   ` Thomas Monjalon

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