diff options
author | Mallikarjuna R Chilakala <mallikarjuna.chilakala@intel.com> | 2009-06-04 07:11:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-06-07 08:20:19 -0400 |
commit | 74766013a131f1e1c2fe8fd138e12841eb708060 (patch) | |
tree | d5f43b46ca73fb4ddf27cb9e4def521e93286039 /drivers/net/ixgbe | |
parent | 620fa036b2459ca9acf7484c8074147f0dda68da (diff) |
ixgbe: ethtool support to change advertised link modes of 82599 adapters
Add ethtool support to change advertised link modes/autoneg settings of
82599 multispeed fiber adapters.
Signed-off-by: Mallikarjuna R Chilakala <mallikarjuna.chilakala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_82599.c | 9 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_ethtool.c | 42 |
2 files changed, 33 insertions, 18 deletions
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c index 4d83e591659..3f36d834ccf 100644 --- a/drivers/net/ixgbe/ixgbe_82599.c +++ b/drivers/net/ixgbe/ixgbe_82599.c | |||
@@ -464,6 +464,15 @@ s32 ixgbe_setup_mac_link_speed_multispeed_fiber(struct ixgbe_hw *hw, | |||
464 | hw->mac.ops.get_link_capabilities(hw, &phy_link_speed, &negotiation); | 464 | hw->mac.ops.get_link_capabilities(hw, &phy_link_speed, &negotiation); |
465 | speed &= phy_link_speed; | 465 | speed &= phy_link_speed; |
466 | 466 | ||
467 | /* Set autoneg_advertised value based on input link speed */ | ||
468 | hw->phy.autoneg_advertised = 0; | ||
469 | |||
470 | if (speed & IXGBE_LINK_SPEED_10GB_FULL) | ||
471 | hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10GB_FULL; | ||
472 | |||
473 | if (speed & IXGBE_LINK_SPEED_1GB_FULL) | ||
474 | hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL; | ||
475 | |||
467 | /* | 476 | /* |
468 | * When the driver changes the link speeds that it can support, | 477 | * When the driver changes the link speeds that it can support, |
469 | * it sets autotry_restart to true to indicate that we need to | 478 | * it sets autotry_restart to true to indicate that we need to |
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index 1c110459d33..e0feaf5725b 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -136,11 +136,12 @@ static int ixgbe_get_settings(struct net_device *netdev, | |||
136 | ecmd->supported = SUPPORTED_10000baseT_Full; | 136 | ecmd->supported = SUPPORTED_10000baseT_Full; |
137 | ecmd->autoneg = AUTONEG_ENABLE; | 137 | ecmd->autoneg = AUTONEG_ENABLE; |
138 | ecmd->transceiver = XCVR_EXTERNAL; | 138 | ecmd->transceiver = XCVR_EXTERNAL; |
139 | if (hw->phy.media_type == ixgbe_media_type_copper) { | 139 | if ((hw->phy.media_type == ixgbe_media_type_copper) || |
140 | (hw->mac.type == ixgbe_mac_82599EB)) { | ||
140 | ecmd->supported |= (SUPPORTED_1000baseT_Full | | 141 | ecmd->supported |= (SUPPORTED_1000baseT_Full | |
141 | SUPPORTED_TP | SUPPORTED_Autoneg); | 142 | SUPPORTED_Autoneg); |
142 | 143 | ||
143 | ecmd->advertising = (ADVERTISED_TP | ADVERTISED_Autoneg); | 144 | ecmd->advertising = ADVERTISED_Autoneg; |
144 | if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10GB_FULL) | 145 | if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10GB_FULL) |
145 | ecmd->advertising |= ADVERTISED_10000baseT_Full; | 146 | ecmd->advertising |= ADVERTISED_10000baseT_Full; |
146 | if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_1GB_FULL) | 147 | if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_1GB_FULL) |
@@ -155,7 +156,15 @@ static int ixgbe_get_settings(struct net_device *netdev, | |||
155 | ecmd->advertising |= (ADVERTISED_10000baseT_Full | | 156 | ecmd->advertising |= (ADVERTISED_10000baseT_Full | |
156 | ADVERTISED_1000baseT_Full); | 157 | ADVERTISED_1000baseT_Full); |
157 | 158 | ||
158 | ecmd->port = PORT_TP; | 159 | if (hw->phy.media_type == ixgbe_media_type_copper) { |
160 | ecmd->supported |= SUPPORTED_TP; | ||
161 | ecmd->advertising |= ADVERTISED_TP; | ||
162 | ecmd->port = PORT_TP; | ||
163 | } else { | ||
164 | ecmd->supported |= SUPPORTED_FIBRE; | ||
165 | ecmd->advertising |= ADVERTISED_FIBRE; | ||
166 | ecmd->port = PORT_FIBRE; | ||
167 | } | ||
159 | } else if (hw->phy.media_type == ixgbe_media_type_backplane) { | 168 | } else if (hw->phy.media_type == ixgbe_media_type_backplane) { |
160 | /* Set as FIBRE until SERDES defined in kernel */ | 169 | /* Set as FIBRE until SERDES defined in kernel */ |
161 | switch (hw->device_id) { | 170 | switch (hw->device_id) { |
@@ -203,16 +212,10 @@ static int ixgbe_set_settings(struct net_device *netdev, | |||
203 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 212 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
204 | struct ixgbe_hw *hw = &adapter->hw; | 213 | struct ixgbe_hw *hw = &adapter->hw; |
205 | u32 advertised, old; | 214 | u32 advertised, old; |
206 | s32 err; | 215 | s32 err = 0; |
207 | 216 | ||
208 | switch (hw->phy.media_type) { | 217 | if ((hw->phy.media_type == ixgbe_media_type_copper) || |
209 | case ixgbe_media_type_fiber: | 218 | (hw->mac.type == ixgbe_mac_82599EB)) { |
210 | if ((ecmd->autoneg == AUTONEG_ENABLE) || | ||
211 | (ecmd->speed + ecmd->duplex != SPEED_10000 + DUPLEX_FULL)) | ||
212 | return -EINVAL; | ||
213 | /* in this case we currently only support 10Gb/FULL */ | ||
214 | break; | ||
215 | case ixgbe_media_type_copper: | ||
216 | /* 10000/copper and 1000/copper must autoneg | 219 | /* 10000/copper and 1000/copper must autoneg |
217 | * this function does not support any duplex forcing, but can | 220 | * this function does not support any duplex forcing, but can |
218 | * limit the advertising of the adapter to only 10000 or 1000 */ | 221 | * limit the advertising of the adapter to only 10000 or 1000 */ |
@@ -228,20 +231,23 @@ static int ixgbe_set_settings(struct net_device *netdev, | |||
228 | advertised |= IXGBE_LINK_SPEED_1GB_FULL; | 231 | advertised |= IXGBE_LINK_SPEED_1GB_FULL; |
229 | 232 | ||
230 | if (old == advertised) | 233 | if (old == advertised) |
231 | break; | 234 | return err; |
232 | /* this sets the link speed and restarts auto-neg */ | 235 | /* this sets the link speed and restarts auto-neg */ |
236 | hw->mac.autotry_restart = true; | ||
233 | err = hw->mac.ops.setup_link_speed(hw, advertised, true, true); | 237 | err = hw->mac.ops.setup_link_speed(hw, advertised, true, true); |
234 | if (err) { | 238 | if (err) { |
235 | DPRINTK(PROBE, INFO, | 239 | DPRINTK(PROBE, INFO, |
236 | "setup link failed with code %d\n", err); | 240 | "setup link failed with code %d\n", err); |
237 | hw->mac.ops.setup_link_speed(hw, old, true, true); | 241 | hw->mac.ops.setup_link_speed(hw, old, true, true); |
238 | } | 242 | } |
239 | break; | 243 | } else { |
240 | default: | 244 | /* in this case we currently only support 10Gb/FULL */ |
241 | break; | 245 | if ((ecmd->autoneg == AUTONEG_ENABLE) || |
246 | (ecmd->speed + ecmd->duplex != SPEED_10000 + DUPLEX_FULL)) | ||
247 | return -EINVAL; | ||
242 | } | 248 | } |
243 | 249 | ||
244 | return 0; | 250 | return err; |
245 | } | 251 | } |
246 | 252 | ||
247 | static void ixgbe_get_pauseparam(struct net_device *netdev, | 253 | static void ixgbe_get_pauseparam(struct net_device *netdev, |