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>
This commit is contained in:
Родитель
dca97ad2ec
Коммит
ec7e97e9a0
|
@ -157,9 +157,6 @@ struct ixgb_adapter {
|
||||||
u16 link_duplex;
|
u16 link_duplex;
|
||||||
struct work_struct tx_timeout_task;
|
struct work_struct tx_timeout_task;
|
||||||
|
|
||||||
struct timer_list blink_timer;
|
|
||||||
unsigned long led_status;
|
|
||||||
|
|
||||||
/* TX */
|
/* TX */
|
||||||
struct ixgb_desc_ring tx_ring ____cacheline_aligned_in_smp;
|
struct ixgb_desc_ring tx_ring ____cacheline_aligned_in_smp;
|
||||||
unsigned int restart_queue;
|
unsigned int restart_queue;
|
||||||
|
|
|
@ -611,46 +611,24 @@ err_setup_rx:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* toggle LED 4 times per second = 2 "blinks" per second */
|
|
||||||
#define IXGB_ID_INTERVAL (HZ/4)
|
|
||||||
|
|
||||||
/* bit defines for adapter->led_status */
|
|
||||||
#define IXGB_LED_ON 0
|
|
||||||
|
|
||||||
static void
|
|
||||||
ixgb_led_blink_callback(unsigned long data)
|
|
||||||
{
|
|
||||||
struct ixgb_adapter *adapter = (struct ixgb_adapter *)data;
|
|
||||||
|
|
||||||
if (test_and_change_bit(IXGB_LED_ON, &adapter->led_status))
|
|
||||||
ixgb_led_off(&adapter->hw);
|
|
||||||
else
|
|
||||||
ixgb_led_on(&adapter->hw);
|
|
||||||
|
|
||||||
mod_timer(&adapter->blink_timer, jiffies + IXGB_ID_INTERVAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ixgb_phys_id(struct net_device *netdev, u32 data)
|
ixgb_set_phys_id(struct net_device *netdev, enum ethtool_phys_id_state state)
|
||||||
{
|
{
|
||||||
struct ixgb_adapter *adapter = netdev_priv(netdev);
|
struct ixgb_adapter *adapter = netdev_priv(netdev);
|
||||||
|
|
||||||
if (!data)
|
switch (state) {
|
||||||
data = INT_MAX;
|
case ETHTOOL_ID_ACTIVE:
|
||||||
|
return 2;
|
||||||
|
|
||||||
if (!adapter->blink_timer.function) {
|
case ETHTOOL_ID_ON:
|
||||||
init_timer(&adapter->blink_timer);
|
ixgb_led_on(&adapter->hw);
|
||||||
adapter->blink_timer.function = ixgb_led_blink_callback;
|
break;
|
||||||
adapter->blink_timer.data = (unsigned long)adapter;
|
|
||||||
|
case ETHTOOL_ID_OFF:
|
||||||
|
case ETHTOOL_ID_INACTIVE:
|
||||||
|
ixgb_led_off(&adapter->hw);
|
||||||
}
|
}
|
||||||
|
|
||||||
mod_timer(&adapter->blink_timer, jiffies);
|
|
||||||
|
|
||||||
msleep_interruptible(data * 1000);
|
|
||||||
del_timer_sync(&adapter->blink_timer);
|
|
||||||
ixgb_led_off(&adapter->hw);
|
|
||||||
clear_bit(IXGB_LED_ON, &adapter->led_status);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -767,7 +745,7 @@ static const struct ethtool_ops ixgb_ethtool_ops = {
|
||||||
.set_msglevel = ixgb_set_msglevel,
|
.set_msglevel = ixgb_set_msglevel,
|
||||||
.set_tso = ixgb_set_tso,
|
.set_tso = ixgb_set_tso,
|
||||||
.get_strings = ixgb_get_strings,
|
.get_strings = ixgb_get_strings,
|
||||||
.phys_id = ixgb_phys_id,
|
.set_phys_id = ixgb_set_phys_id,
|
||||||
.get_sset_count = ixgb_get_sset_count,
|
.get_sset_count = ixgb_get_sset_count,
|
||||||
.get_ethtool_stats = ixgb_get_ethtool_stats,
|
.get_ethtool_stats = ixgb_get_ethtool_stats,
|
||||||
.get_flags = ethtool_op_get_flags,
|
.get_flags = ethtool_op_get_flags,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче