Esempio n. 1
0
static int
ixgb_phys_id(struct net_device *netdev, uint32_t data)
{
	struct ixgb_adapter *adapter = netdev_priv(netdev);

	if(!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ))
		data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ);

	if(!adapter->blink_timer.function) {
		init_timer(&adapter->blink_timer);
		adapter->blink_timer.function = ixgb_led_blink_callback;
		adapter->blink_timer.data = (unsigned long)adapter;
	}

	mod_timer(&adapter->blink_timer, jiffies);

	set_current_state(TASK_INTERRUPTIBLE);
	if(data)
		schedule_timeout(data * HZ);
	else
		schedule_timeout(MAX_SCHEDULE_TIMEOUT);

	del_timer_sync(&adapter->blink_timer);
	ixgb_led_off(&adapter->hw);
	clear_bit(IXGB_LED_ON, &adapter->led_status);

	return 0;
}
Esempio n. 2
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);
}
Esempio n. 3
0
static int
ixgb_set_phys_id(struct net_device *netdev, enum ethtool_phys_id_state state)
{
	struct ixgb_adapter *adapter = netdev_priv(netdev);

	switch (state) {
	case ETHTOOL_ID_ACTIVE:
		return 2;

	case ETHTOOL_ID_ON:
		ixgb_led_on(&adapter->hw);
		break;

	case ETHTOOL_ID_OFF:
	case ETHTOOL_ID_INACTIVE:
		ixgb_led_off(&adapter->hw);
	}

	return 0;
}
Esempio n. 4
0
static int
ixgb_phys_id(struct net_device *netdev, u32 data)
{
    struct ixgb_adapter *adapter = netdev_priv(netdev);

    if (!data)
        data = INT_MAX;

    if(!adapter->blink_timer.function) {
        init_timer(&adapter->blink_timer);
        adapter->blink_timer.function = ixgb_led_blink_callback;
        adapter->blink_timer.data = (unsigned long)adapter;
    }

    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;
}