i40e: i40evf link status is always down with the Intel XL710 driver
diff mbox series

Message ID 1589380709-6030-1-git-send-email-scott_wasson@affirmednetworks.com
State New
Delegated to: xiaolong ye
Headers show
Series
  • i40e: i40evf link status is always down with the Intel XL710 driver
Related show

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/travis-robot warning Travis build: failed
ci/Performance-Testing fail build patch failure
ci/checkpatch warning coding style issues

Commit Message

Scott Wasson May 13, 2020, 2:38 p.m. UTC
It is necessary to convert the link_speed, in Mbps, to the I40E_LINK_SPEED enum

Fixes: 3c8c0b68b590 ("net/i40e: set speed to undefined for default case")
Cc: laurent.hardy@6wind.com

Bugzilla ID: 461

Signed-off-by: scott_wasson <scott_wasson@affirmednetworks.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

Comments

Laurent Hardy May 14, 2020, 9:40 a.m. UTC | #1
Hello Scott,

What is the use case in which VF link status is always down?

vf->link_speed should contain a VIRTCHNL_LINK_SPEED enum (which has been
mapped on I40E_LINK_SPEED_* enum).
when we are looking for vf->link_speed into the switch case of
i40evf_dev_link_update(), we should have a value matching
VIRTCHNL_LINK_SPEED enum.
If not, your patch fixes another issue than the one described.

vf->link_speed = pf_msg->event_data.link_event.link_speed;
type of pf_msg->event_data.link_event.link_speed is enum
virtchnl_link_speed:

base/virtchnl.h
struct virtchnl_pf_event {
        enum virtchnl_event_codes event;
        union {
                struct {
                        enum virtchnl_link_speed link_speed;


                        bool link_status;
                } link_event;
        } event_data;

        int severity;
};

enum virtchnl_link_speed {


        VIRTCHNL_LINK_SPEED_UNKNOWN     = 0,
        VIRTCHNL_LINK_SPEED_100MB       =
BIT(VIRTCHNL_LINK_SPEED_100MB_SHIFT),
        VIRTCHNL_LINK_SPEED_1GB         =
BIT(VIRTCHNL_LINK_SPEED_1000MB_SHIFT),
        VIRTCHNL_LINK_SPEED_10GB        =
BIT(VIRTCHNL_LINK_SPEED_10GB_SHIFT),
        VIRTCHNL_LINK_SPEED_40GB        =
BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT),
        VIRTCHNL_LINK_SPEED_20GB        =
BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT),
        VIRTCHNL_LINK_SPEED_25GB        =
BIT(VIRTCHNL_LINK_SPEED_25GB_SHIFT),
};

enum virtchnl_link_speed which has been mapped from enum i40e_aq_link_speed

enum i40e_aq_link_speed {
        I40E_LINK_SPEED_UNKNOWN = 0,
        I40E_LINK_SPEED_100MB   = (1 << I40E_LINK_SPEED_100MB_SHIFT),


        I40E_LINK_SPEED_1GB     = (1 << I40E_LINK_SPEED_1000MB_SHIFT),
        I40E_LINK_SPEED_2_5GB   = (1 << I40E_LINK_SPEED_2_5GB_SHIFT),
        I40E_LINK_SPEED_5GB     = (1 << I40E_LINK_SPEED_5GB_SHIFT),
        I40E_LINK_SPEED_10GB    = (1 << I40E_LINK_SPEED_10GB_SHIFT),
        I40E_LINK_SPEED_40GB    = (1 << I40E_LINK_SPEED_40GB_SHIFT),
        I40E_LINK_SPEED_20GB    = (1 << I40E_LINK_SPEED_20GB_SHIFT),
        I40E_LINK_SPEED_25GB    = (1 << I40E_LINK_SPEED_25GB_SHIFT),
};

On Wed, May 13, 2020 at 4:38 PM Scott Wasson <
scott_wasson@affirmednetworks.com> wrote:

> It is necessary to convert the link_speed, in Mbps, to the I40E_LINK_SPEED
> enum
>
> Fixes: 3c8c0b68b590 ("net/i40e: set speed to undefined for default case")
> Cc: laurent.hardy@6wind.com
>
> Bugzilla ID: 461
>
> Signed-off-by: scott_wasson <scott_wasson@affirmednetworks.com>
> ---
>  drivers/net/i40e/i40e_ethdev_vf.c |   25 ++++++++++++++++++++++++-
>  1 files changed, 24 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> b/drivers/net/i40e/i40e_ethdev_vf.c
> index bb5d28a..7aa48f3 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -1363,7 +1363,30 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev
> *dev,
>         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.link_speed;
> +
> +               switch (pf_msg->event_data.link_event.link_speed) {
> +               case ETH_SPEED_NUM_100M:
> +                       vf->link_speed = I40E_LINK_SPEED_100MB;
> +                       break;
> +               case ETH_SPEED_NUM_1G:
> +                       vf->link_speed = I40E_LINK_SPEED_1GB;
> +                       break;
> +               case ETH_SPEED_NUM_10G:
> +                       vf->link_speed = I40E_LINK_SPEED_10GB;
> +                       break;
> +               case ETH_SPEED_NUM_20G:
> +                       vf->link_speed = I40E_LINK_SPEED_20GB;
> +                       break;
> +               case ETH_SPEED_NUM_25G:
> +                       vf->link_speed = I40E_LINK_SPEED_25GB;
> +                       break;
> +               case ETH_SPEED_NUM_40G:
> +                       vf->link_speed = I40E_LINK_SPEED_40GB;
> +                       break;
> +               default:
> +                       vf->link_speed = I40E_LINK_SPEED_UNKNOWN;
> +                       break;
> +               }
>                 break;
>         case VIRTCHNL_EVENT_PF_DRIVER_CLOSE:
>                 PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_PF_DRIVER_CLOSE event");
> --
> 1.7.6.3
>
>

Patch
diff mbox series

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index bb5d28a..7aa48f3 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1363,7 +1363,30 @@  static int i40evf_dev_xstats_get(struct rte_eth_dev *dev,
 	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.link_speed;
+
+		switch (pf_msg->event_data.link_event.link_speed) {
+		case ETH_SPEED_NUM_100M:
+			vf->link_speed = I40E_LINK_SPEED_100MB;
+			break;
+		case ETH_SPEED_NUM_1G:
+			vf->link_speed = I40E_LINK_SPEED_1GB;
+			break;
+		case ETH_SPEED_NUM_10G:
+			vf->link_speed = I40E_LINK_SPEED_10GB;
+			break;
+		case ETH_SPEED_NUM_20G:
+			vf->link_speed = I40E_LINK_SPEED_20GB;
+			break;
+		case ETH_SPEED_NUM_25G:
+			vf->link_speed = I40E_LINK_SPEED_25GB;
+			break;
+		case ETH_SPEED_NUM_40G:
+			vf->link_speed = I40E_LINK_SPEED_40GB;
+			break;
+		default:
+			vf->link_speed = I40E_LINK_SPEED_UNKNOWN;
+			break;
+		}
 		break;
 	case VIRTCHNL_EVENT_PF_DRIVER_CLOSE:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_PF_DRIVER_CLOSE event");