diff options
author | Emil Tantilov <emil.s.tantilov@intel.com> | 2011-04-16 02:12:51 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2011-04-27 05:22:11 -0400 |
commit | 66e6961c8e53c0c0079d5b67faf9b7fe33525892 (patch) | |
tree | e8e9fd6beaa4b065aad096a49ccd9c7aecb402c4 /drivers/net/ixgbe | |
parent | e7fd9253d83703838953160ebb2899c5f6e2eee1 (diff) |
ixgbe: convert to ethtool set_phys_id
Based on the original patch submitted by Stephen Hemminger.
This patch makes the following changes:
- Change ETHTOOL_ID_INACTIVE return value to 2 (blinks/sec)
- Fix restoring of IXGBE_LEDCTL
CC: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Evan Swanson <evan.swanson@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ixgbe')
-rw-r--r-- | drivers/net/ixgbe/ixgbe.h | 1 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_ethtool.c | 29 |
2 files changed, 18 insertions, 12 deletions
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h index 8d468028bb55..37ff531d59c0 100644 --- a/drivers/net/ixgbe/ixgbe.h +++ b/drivers/net/ixgbe/ixgbe.h | |||
@@ -461,6 +461,7 @@ struct ixgbe_adapter { | |||
461 | u16 eeprom_version; | 461 | u16 eeprom_version; |
462 | 462 | ||
463 | int node; | 463 | int node; |
464 | u32 led_reg; | ||
464 | struct work_struct check_overtemp_task; | 465 | struct work_struct check_overtemp_task; |
465 | u32 interrupt_event; | 466 | u32 interrupt_event; |
466 | char lsc_int_name[IFNAMSIZ + 9]; | 467 | char lsc_int_name[IFNAMSIZ + 9]; |
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index bd7524e4a00c..7279345b1ed7 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -2003,25 +2003,30 @@ static int ixgbe_nway_reset(struct net_device *netdev) | |||
2003 | return 0; | 2003 | return 0; |
2004 | } | 2004 | } |
2005 | 2005 | ||
2006 | static int ixgbe_phys_id(struct net_device *netdev, u32 data) | 2006 | static int ixgbe_set_phys_id(struct net_device *netdev, |
2007 | enum ethtool_phys_id_state state) | ||
2007 | { | 2008 | { |
2008 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 2009 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
2009 | struct ixgbe_hw *hw = &adapter->hw; | 2010 | struct ixgbe_hw *hw = &adapter->hw; |
2010 | u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); | ||
2011 | u32 i; | ||
2012 | 2011 | ||
2013 | if (!data || data > 300) | 2012 | switch (state) { |
2014 | data = 300; | 2013 | case ETHTOOL_ID_ACTIVE: |
2014 | adapter->led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); | ||
2015 | return 2; | ||
2015 | 2016 | ||
2016 | for (i = 0; i < (data * 1000); i += 400) { | 2017 | case ETHTOOL_ID_ON: |
2017 | hw->mac.ops.led_on(hw, IXGBE_LED_ON); | 2018 | hw->mac.ops.led_on(hw, IXGBE_LED_ON); |
2018 | msleep_interruptible(200); | 2019 | break; |
2020 | |||
2021 | case ETHTOOL_ID_OFF: | ||
2019 | hw->mac.ops.led_off(hw, IXGBE_LED_ON); | 2022 | hw->mac.ops.led_off(hw, IXGBE_LED_ON); |
2020 | msleep_interruptible(200); | 2023 | break; |
2021 | } | ||
2022 | 2024 | ||
2023 | /* Restore LED settings */ | 2025 | case ETHTOOL_ID_INACTIVE: |
2024 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_LEDCTL, led_reg); | 2026 | /* Restore LED settings */ |
2027 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_LEDCTL, adapter->led_reg); | ||
2028 | break; | ||
2029 | } | ||
2025 | 2030 | ||
2026 | return 0; | 2031 | return 0; |
2027 | } | 2032 | } |
@@ -2469,7 +2474,7 @@ static const struct ethtool_ops ixgbe_ethtool_ops = { | |||
2469 | .set_tso = ixgbe_set_tso, | 2474 | .set_tso = ixgbe_set_tso, |
2470 | .self_test = ixgbe_diag_test, | 2475 | .self_test = ixgbe_diag_test, |
2471 | .get_strings = ixgbe_get_strings, | 2476 | .get_strings = ixgbe_get_strings, |
2472 | .phys_id = ixgbe_phys_id, | 2477 | .set_phys_id = ixgbe_set_phys_id, |
2473 | .get_sset_count = ixgbe_get_sset_count, | 2478 | .get_sset_count = ixgbe_get_sset_count, |
2474 | .get_ethtool_stats = ixgbe_get_ethtool_stats, | 2479 | .get_ethtool_stats = ixgbe_get_ethtool_stats, |
2475 | .get_coalesce = ixgbe_get_coalesce, | 2480 | .get_coalesce = ixgbe_get_coalesce, |