Commit 0002e118 authored by Catherine Sullivan's avatar Catherine Sullivan Committed by Jeff Kirsher

i40e: Never let speed get set to 0 in get_settings

In ethtool, there is a possibility of speed getting set to 0
if advertise is set to 0 (which it is when autoneg is disabled).
We never want this to happen as the firmware will actually attempt
to set the speed to 0 sending link down, so add an extra check
to make sure this doesn't happen.

Change-ID: I62e0eeee2cbf043d8e6f5c9c9f0b92794e877f01
Signed-off-by: default avatarCatherine Sullivan <catherine.sullivan@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent fba52e21
...@@ -666,6 +666,13 @@ static int i40e_set_settings(struct net_device *netdev, ...@@ -666,6 +666,13 @@ static int i40e_set_settings(struct net_device *netdev,
advertise & ADVERTISED_40000baseLR4_Full) advertise & ADVERTISED_40000baseLR4_Full)
config.link_speed |= I40E_LINK_SPEED_40GB; config.link_speed |= I40E_LINK_SPEED_40GB;
/* If speed didn't get set, set it to what it currently is.
* This is needed because if advertise is 0 (as it is when autoneg
* is disabled) then speed won't get set.
*/
if (!config.link_speed)
config.link_speed = abilities.link_speed;
if (change || (abilities.link_speed != config.link_speed)) { if (change || (abilities.link_speed != config.link_speed)) {
/* copy over the rest of the abilities */ /* copy over the rest of the abilities */
config.phy_type = abilities.phy_type; config.phy_type = abilities.phy_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment