net/i40e: set speed to undefined for default case
authorLaurent Hardy <laurent.hardy@6wind.com>
Wed, 11 Sep 2019 16:02:51 +0000 (18:02 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 7 Oct 2019 13:00:57 +0000 (15:00 +0200)
During PF/VF link update, a default speed value of 100M will be set
if get_link_info has failed or speed is unknown.

Consequently if PF is put in no-carrier state, VFs will switch to
"in carrier" state due to a link up + a link speed set to 100M
(default value if no speed detected).

To be consistent with linux drivers on which PF and VFs are in
same carrier state, sets default speed to undefined (instead of 100M)
and updates a link status of VF only if link is up and speed is
different from undefined.

Fixes: 4861cde46116 ("i40e: new poll mode driver")
Cc: stable@dpdk.org
Signed-off-by: Laurent Hardy <laurent.hardy@6wind.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/i40e/i40e_ethdev.c
drivers/net/i40e/i40e_ethdev_vf.c

index c145e64..32d6dc1 100644 (file)
@@ -2832,7 +2832,7 @@ update_link_aq(struct i40e_hw *hw, struct rte_eth_link *link,
                status = i40e_aq_get_link_info(hw, enable_lse,
                                                &link_status, NULL);
                if (unlikely(status != I40E_SUCCESS)) {
-                       link->link_speed = ETH_SPEED_NUM_100M;
+                       link->link_speed = ETH_SPEED_NUM_NONE;
                        link->link_duplex = ETH_LINK_FULL_DUPLEX;
                        PMD_DRV_LOG(ERR, "Failed to get link info");
                        return;
@@ -2866,7 +2866,7 @@ update_link_aq(struct i40e_hw *hw, struct rte_eth_link *link,
                link->link_speed = ETH_SPEED_NUM_40G;
                break;
        default:
-               link->link_speed = ETH_SPEED_NUM_100M;
+               link->link_speed = ETH_SPEED_NUM_NONE;
                break;
        }
 }
index 7ffb111..5dba092 100644 (file)
@@ -2141,13 +2141,15 @@ i40evf_dev_link_update(struct rte_eth_dev *dev,
                new_link.link_speed = ETH_SPEED_NUM_40G;
                break;
        default:
-               new_link.link_speed = ETH_SPEED_NUM_100M;
+               new_link.link_speed = ETH_SPEED_NUM_NONE;
                break;
        }
        /* full duplex only */
        new_link.link_duplex = ETH_LINK_FULL_DUPLEX;
-       new_link.link_status = vf->link_up ? ETH_LINK_UP :
-                                            ETH_LINK_DOWN;
+       new_link.link_status = vf->link_up &&
+                               new_link.link_speed != ETH_SPEED_NUM_NONE
+                               ? ETH_LINK_UP
+                               : ETH_LINK_DOWN;
        new_link.link_autoneg =
                !(dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED);