diff options
author | Nick Nunley <nicholasx.d.nunley@intel.com> | 2010-02-16 20:01:21 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-17 16:21:32 -0500 |
commit | 3145535ac6e4769e587a38a67d888a10f24a7af9 (patch) | |
tree | 5d0d93d0b97bf3aadf7f5b568bf2f1c7e053f84b /drivers | |
parent | 22939f0606e515799d83e1a29250917f94c8d07b (diff) |
igb: Report link status in ethtool when interface is down
With this change ethtool will correctly report link status when
the interface is down. Currently ethtool reports the link as not
detected when the interface is down.
Signed-off-by: Nicholas Nunley <nicholasx.d.nunley@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')
-rw-r--r-- | drivers/net/igb/igb.h | 1 | ||||
-rw-r--r-- | drivers/net/igb/igb_ethtool.c | 20 | ||||
-rw-r--r-- | drivers/net/igb/igb_main.c | 2 |
3 files changed, 21 insertions, 2 deletions
diff --git a/drivers/net/igb/igb.h b/drivers/net/igb/igb.h index 0efd28515e6e..452a4dee87f8 100644 --- a/drivers/net/igb/igb.h +++ b/drivers/net/igb/igb.h | |||
@@ -356,6 +356,7 @@ extern void igb_unmap_and_free_tx_resource(struct igb_ring *, | |||
356 | struct igb_buffer *); | 356 | struct igb_buffer *); |
357 | extern void igb_alloc_rx_buffers_adv(struct igb_ring *, int); | 357 | extern void igb_alloc_rx_buffers_adv(struct igb_ring *, int); |
358 | extern void igb_update_stats(struct igb_adapter *); | 358 | extern void igb_update_stats(struct igb_adapter *); |
359 | extern bool igb_has_link(struct igb_adapter *adapter); | ||
359 | extern void igb_set_ethtool_ops(struct net_device *); | 360 | extern void igb_set_ethtool_ops(struct net_device *); |
360 | 361 | ||
361 | static inline s32 igb_reset_phy(struct e1000_hw *hw) | 362 | static inline s32 igb_reset_phy(struct e1000_hw *hw) |
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c index 145a8eb55fab..4eea03b428c4 100644 --- a/drivers/net/igb/igb_ethtool.c +++ b/drivers/net/igb/igb_ethtool.c | |||
@@ -234,6 +234,24 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
234 | return 0; | 234 | return 0; |
235 | } | 235 | } |
236 | 236 | ||
237 | static u32 igb_get_link(struct net_device *netdev) | ||
238 | { | ||
239 | struct igb_adapter *adapter = netdev_priv(netdev); | ||
240 | struct e1000_mac_info *mac = &adapter->hw.mac; | ||
241 | |||
242 | /* | ||
243 | * If the link is not reported up to netdev, interrupts are disabled, | ||
244 | * and so the physical link state may have changed since we last | ||
245 | * looked. Set get_link_status to make sure that the true link | ||
246 | * state is interrogated, rather than pulling a cached and possibly | ||
247 | * stale link state from the driver. | ||
248 | */ | ||
249 | if (!netif_carrier_ok(netdev)) | ||
250 | mac->get_link_status = 1; | ||
251 | |||
252 | return igb_has_link(adapter); | ||
253 | } | ||
254 | |||
237 | static void igb_get_pauseparam(struct net_device *netdev, | 255 | static void igb_get_pauseparam(struct net_device *netdev, |
238 | struct ethtool_pauseparam *pause) | 256 | struct ethtool_pauseparam *pause) |
239 | { | 257 | { |
@@ -2077,7 +2095,7 @@ static const struct ethtool_ops igb_ethtool_ops = { | |||
2077 | .get_msglevel = igb_get_msglevel, | 2095 | .get_msglevel = igb_get_msglevel, |
2078 | .set_msglevel = igb_set_msglevel, | 2096 | .set_msglevel = igb_set_msglevel, |
2079 | .nway_reset = igb_nway_reset, | 2097 | .nway_reset = igb_nway_reset, |
2080 | .get_link = ethtool_op_get_link, | 2098 | .get_link = igb_get_link, |
2081 | .get_eeprom_len = igb_get_eeprom_len, | 2099 | .get_eeprom_len = igb_get_eeprom_len, |
2082 | .get_eeprom = igb_get_eeprom, | 2100 | .get_eeprom = igb_get_eeprom, |
2083 | .set_eeprom = igb_set_eeprom, | 2101 | .set_eeprom = igb_set_eeprom, |
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 677b5f5ab49c..e40319e2ec25 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -3020,7 +3020,7 @@ static void igb_update_phy_info(unsigned long data) | |||
3020 | * igb_has_link - check shared code for link and determine up/down | 3020 | * igb_has_link - check shared code for link and determine up/down |
3021 | * @adapter: pointer to driver private info | 3021 | * @adapter: pointer to driver private info |
3022 | **/ | 3022 | **/ |
3023 | static bool igb_has_link(struct igb_adapter *adapter) | 3023 | bool igb_has_link(struct igb_adapter *adapter) |
3024 | { | 3024 | { |
3025 | struct e1000_hw *hw = &adapter->hw; | 3025 | struct e1000_hw *hw = &adapter->hw; |
3026 | bool link_active = false; | 3026 | bool link_active = false; |