aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgb
diff options
context:
space:
mode:
authorJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-05-03 01:17:34 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-05-04 15:07:41 -0400
commitec7e97e9a0265255485e217f4f2d3513949e7083 (patch)
treeb95af243f66f04057595dff30e062f4699d8658a /drivers/net/ixgb
parentdca97ad2ec37aa98c45dfe1d531d9ba7048e814e (diff)
ixgb: convert to set_phys_id
Based on the original patch sent by Stephen Hemminger. This version incorporates the ethtool changes that Bruce Allan submitted. CC: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Tested-by: Evan Swanson <evan.swanson@intel.com>
Diffstat (limited to 'drivers/net/ixgb')
-rw-r--r--drivers/net/ixgb/ixgb.h3
-rw-r--r--drivers/net/ixgb/ixgb_ethtool.c46
2 files changed, 12 insertions, 37 deletions
diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
index 8f3df044e81e..49e8408f05fc 100644
--- a/drivers/net/ixgb/ixgb.h
+++ b/drivers/net/ixgb/ixgb.h
@@ -157,9 +157,6 @@ struct ixgb_adapter {
157 u16 link_duplex; 157 u16 link_duplex;
158 struct work_struct tx_timeout_task; 158 struct work_struct tx_timeout_task;
159 159
160 struct timer_list blink_timer;
161 unsigned long led_status;
162
163 /* TX */ 160 /* TX */
164 struct ixgb_desc_ring tx_ring ____cacheline_aligned_in_smp; 161 struct ixgb_desc_ring tx_ring ____cacheline_aligned_in_smp;
165 unsigned int restart_queue; 162 unsigned int restart_queue;
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index 5f224c387e0c..6da890b9534c 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -611,45 +611,23 @@ err_setup_rx:
611 return err; 611 return err;
612} 612}
613 613
614/* toggle LED 4 times per second = 2 "blinks" per second */
615#define IXGB_ID_INTERVAL (HZ/4)
616
617/* bit defines for adapter->led_status */
618#define IXGB_LED_ON 0
619
620static void
621ixgb_led_blink_callback(unsigned long data)
622{
623 struct ixgb_adapter *adapter = (struct ixgb_adapter *)data;
624
625 if (test_and_change_bit(IXGB_LED_ON, &adapter->led_status))
626 ixgb_led_off(&adapter->hw);
627 else
628 ixgb_led_on(&adapter->hw);
629
630 mod_timer(&adapter->blink_timer, jiffies + IXGB_ID_INTERVAL);
631}
632
633static int 614static int
634ixgb_phys_id(struct net_device *netdev, u32 data) 615ixgb_set_phys_id(struct net_device *netdev, enum ethtool_phys_id_state state)
635{ 616{
636 struct ixgb_adapter *adapter = netdev_priv(netdev); 617 struct ixgb_adapter *adapter = netdev_priv(netdev);
637 618
638 if (!data) 619 switch (state) {
639 data = INT_MAX; 620 case ETHTOOL_ID_ACTIVE:
640 621 return 2;
641 if (!adapter->blink_timer.function) {
642 init_timer(&adapter->blink_timer);
643 adapter->blink_timer.function = ixgb_led_blink_callback;
644 adapter->blink_timer.data = (unsigned long)adapter;
645 }
646 622
647 mod_timer(&adapter->blink_timer, jiffies); 623 case ETHTOOL_ID_ON:
624 ixgb_led_on(&adapter->hw);
625 break;
648 626
649 msleep_interruptible(data * 1000); 627 case ETHTOOL_ID_OFF:
650 del_timer_sync(&adapter->blink_timer); 628 case ETHTOOL_ID_INACTIVE:
651 ixgb_led_off(&adapter->hw); 629 ixgb_led_off(&adapter->hw);
652 clear_bit(IXGB_LED_ON, &adapter->led_status); 630 }
653 631
654 return 0; 632 return 0;
655} 633}
@@ -767,7 +745,7 @@ static const struct ethtool_ops ixgb_ethtool_ops = {
767 .set_msglevel = ixgb_set_msglevel, 745 .set_msglevel = ixgb_set_msglevel,
768 .set_tso = ixgb_set_tso, 746 .set_tso = ixgb_set_tso,
769 .get_strings = ixgb_get_strings, 747 .get_strings = ixgb_get_strings,
770 .phys_id = ixgb_phys_id, 748 .set_phys_id = ixgb_set_phys_id,
771 .get_sset_count = ixgb_get_sset_count, 749 .get_sset_count = ixgb_get_sset_count,
772 .get_ethtool_stats = ixgb_get_ethtool_stats, 750 .get_ethtool_stats = ixgb_get_ethtool_stats,
773 .get_flags = ethtool_op_get_flags, 751 .get_flags = ethtool_op_get_flags,