Commit 124ed15b authored by Catherine Sullivan's avatar Catherine Sullivan Committed by Jeff Kirsher

i40e: Add dual speed module support

Now that fw has implemented dual speed module support, we can add ours.
Also, add the phy type for 1G LR/SR and set its media type to fiber.
Lastly, instead of a WARN_ON if the phy type is not recognized just print
a warning.

Change-ID: I2e5227d4a8c2907b0ed423038e5dbce774e466b0
Signed-off-by: default avatarCatherine Sullivan <catherine.sullivan@intel.com>
Tested-by: default avatarJim Young <jamesx.m.young@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent b89df95d
...@@ -752,6 +752,8 @@ static enum i40e_media_type i40e_get_media_type(struct i40e_hw *hw) ...@@ -752,6 +752,8 @@ static enum i40e_media_type i40e_get_media_type(struct i40e_hw *hw)
switch (hw->phy.link_info.phy_type) { switch (hw->phy.link_info.phy_type) {
case I40E_PHY_TYPE_10GBASE_SR: case I40E_PHY_TYPE_10GBASE_SR:
case I40E_PHY_TYPE_10GBASE_LR: case I40E_PHY_TYPE_10GBASE_LR:
case I40E_PHY_TYPE_1000BASE_SX:
case I40E_PHY_TYPE_1000BASE_LX:
case I40E_PHY_TYPE_40GBASE_SR4: case I40E_PHY_TYPE_40GBASE_SR4:
case I40E_PHY_TYPE_40GBASE_LR4: case I40E_PHY_TYPE_40GBASE_LR4:
media = I40E_MEDIA_TYPE_FIBER; media = I40E_MEDIA_TYPE_FIBER;
......
...@@ -313,7 +313,10 @@ static int i40e_get_settings(struct net_device *netdev, ...@@ -313,7 +313,10 @@ static int i40e_get_settings(struct net_device *netdev,
break; break;
case I40E_PHY_TYPE_10GBASE_SR: case I40E_PHY_TYPE_10GBASE_SR:
case I40E_PHY_TYPE_10GBASE_LR: case I40E_PHY_TYPE_10GBASE_LR:
case I40E_PHY_TYPE_1000BASE_SX:
case I40E_PHY_TYPE_1000BASE_LX:
ecmd->supported = SUPPORTED_10000baseT_Full; ecmd->supported = SUPPORTED_10000baseT_Full;
ecmd->supported |= SUPPORTED_1000baseT_Full;
break; break;
case I40E_PHY_TYPE_10GBASE_CR1_CU: case I40E_PHY_TYPE_10GBASE_CR1_CU:
case I40E_PHY_TYPE_10GBASE_CR1: case I40E_PHY_TYPE_10GBASE_CR1:
...@@ -352,7 +355,8 @@ static int i40e_get_settings(struct net_device *netdev, ...@@ -352,7 +355,8 @@ static int i40e_get_settings(struct net_device *netdev,
break; break;
default: default:
/* if we got here and link is up something bad is afoot */ /* if we got here and link is up something bad is afoot */
WARN_ON(link_up); netdev_info(netdev, "WARNING: Link is up but PHY type 0x%x is not recognized.\n",
hw_link_info->phy_type);
} }
no_valid_phy_type: no_valid_phy_type:
...@@ -493,11 +497,10 @@ static int i40e_set_settings(struct net_device *netdev, ...@@ -493,11 +497,10 @@ static int i40e_set_settings(struct net_device *netdev,
if (status) if (status)
return -EAGAIN; return -EAGAIN;
/* Copy link_speed and abilities to config in case they are not /* Copy abilities to config in case autoneg is not
* set below * set below
*/ */
memset(&config, 0, sizeof(struct i40e_aq_set_phy_config)); memset(&config, 0, sizeof(struct i40e_aq_set_phy_config));
config.link_speed = abilities.link_speed;
config.abilities = abilities.abilities; config.abilities = abilities.abilities;
/* Check autoneg */ /* Check autoneg */
...@@ -534,33 +537,21 @@ static int i40e_set_settings(struct net_device *netdev, ...@@ -534,33 +537,21 @@ static int i40e_set_settings(struct net_device *netdev,
return -EINVAL; return -EINVAL;
if (advertise & ADVERTISED_100baseT_Full) if (advertise & ADVERTISED_100baseT_Full)
if (!(abilities.link_speed & I40E_LINK_SPEED_100MB)) { config.link_speed |= I40E_LINK_SPEED_100MB;
config.link_speed |= I40E_LINK_SPEED_100MB;
change = true;
}
if (advertise & ADVERTISED_1000baseT_Full || if (advertise & ADVERTISED_1000baseT_Full ||
advertise & ADVERTISED_1000baseKX_Full) advertise & ADVERTISED_1000baseKX_Full)
if (!(abilities.link_speed & I40E_LINK_SPEED_1GB)) { config.link_speed |= I40E_LINK_SPEED_1GB;
config.link_speed |= I40E_LINK_SPEED_1GB;
change = true;
}
if (advertise & ADVERTISED_10000baseT_Full || if (advertise & ADVERTISED_10000baseT_Full ||
advertise & ADVERTISED_10000baseKX4_Full || advertise & ADVERTISED_10000baseKX4_Full ||
advertise & ADVERTISED_10000baseKR_Full) advertise & ADVERTISED_10000baseKR_Full)
if (!(abilities.link_speed & I40E_LINK_SPEED_10GB)) { config.link_speed |= I40E_LINK_SPEED_10GB;
config.link_speed |= I40E_LINK_SPEED_10GB;
change = true;
}
if (advertise & ADVERTISED_40000baseKR4_Full || if (advertise & ADVERTISED_40000baseKR4_Full ||
advertise & ADVERTISED_40000baseCR4_Full || advertise & ADVERTISED_40000baseCR4_Full ||
advertise & ADVERTISED_40000baseSR4_Full || advertise & ADVERTISED_40000baseSR4_Full ||
advertise & ADVERTISED_40000baseLR4_Full) advertise & ADVERTISED_40000baseLR4_Full)
if (!(abilities.link_speed & I40E_LINK_SPEED_40GB)) { config.link_speed |= I40E_LINK_SPEED_40GB;
config.link_speed |= I40E_LINK_SPEED_40GB;
change = true;
}
if (change) { 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;
config.eee_capability = abilities.eee_capability; config.eee_capability = abilities.eee_capability;
......
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