case ETHTOOL_ID_ACTIVE:
be_cmd_get_beacon_state(adapter, adapter->hba_port_num,
&adapter->beacon_state);
- return -EINVAL;
+ return 1; /* cycle on/off once per second */
case ETHTOOL_ID_ON:
be_cmd_set_beacon_state(adapter, adapter->hba_port_num, 0, 0,
bp->leds_save = REG_RD(bp, BNX2_MISC_CFG);
REG_WR(bp, BNX2_MISC_CFG, BNX2_MISC_CFG_LEDMODE_MAC);
- return -EINVAL;
+ return 1; /* cycle on/off once per second */
case ETHTOOL_ID_ON:
REG_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE |
switch (state) {
case ETHTOOL_ID_ACTIVE:
- return -EINVAL;
+ return 1; /* cycle on/off once per second */
case ETHTOOL_ID_ON:
bnx2x_set_led(&bp->link_params, &bp->link_vars,
switch (state) {
case ETHTOOL_ID_ACTIVE:
- return -EINVAL;
+ return 1; /* cycle on/off once per second */
case ETHTOOL_ID_OFF:
t3_set_reg_field(adapter, A_T3DBG_GPIO_EN, F_GPIO0_OUT_VAL, 0);
/* Prevent ISR from twiddling the LED */
lp->led_mask = 0;
spin_unlock_irq(&lp->hw_lock);
- return -EINVAL;
+ return 2; /* cycle on/off twice per second */
case ETHTOOL_ID_ON:
cr = inb(EWRK3_CR);
switch (state) {
case ETHTOOL_ID_ACTIVE:
np->orig_led_state = niu_led_state_save(np);
- return -EINVAL;
+ return 1; /* cycle on/off once per second */
case ETHTOOL_ID_ON:
niu_force_led(np, 1);
for (i = 4; i < 8; i++)
lp->save_regs[i - 4] = a->read_bcr(ioaddr, i);
spin_unlock_irqrestore(&lp->lock, flags);
- return -EINVAL;
+ return 2; /* cycle on/off twice per second */
case ETHTOOL_ID_ON:
case ETHTOOL_ID_OFF:
switch (state) {
case ETHTOOL_ID_ACTIVE:
sp->adapt_ctrl_org = readq(&bar0->gpio_control);
- return -EINVAL;
+ return 1; /* cycle on/off once per second */
case ETHTOOL_ID_ON:
s2io_set_led(sp, true);
enum ethtool_phys_id_state state)
{
struct efx_nic *efx = netdev_priv(net_dev);
- enum efx_led_mode mode;
+ enum efx_led_mode mode = EFX_LED_DEFAULT;
switch (state) {
case ETHTOOL_ID_ON:
case ETHTOOL_ID_INACTIVE:
mode = EFX_LED_DEFAULT;
break;
- default:
- return -EINVAL;
+ case ETHTOOL_ID_ACTIVE:
+ return 1; /* cycle on/off once per second */
}
efx->type->set_id_led(efx, mode);
switch (state) {
case ETHTOOL_ID_ACTIVE:
- return -EINVAL;
+ return 2; /* cycle on/off twice per second */
case ETHTOOL_ID_ON:
skge_led(skge, LED_MODE_TST);
switch (state) {
case ETHTOOL_ID_ACTIVE:
- return -EINVAL;
+ return 1; /* cycle on/off once per second */
case ETHTOOL_ID_INACTIVE:
sky2_led(sky2, MO_LED_NORM);
break;
switch (state) {
case ETHTOOL_ID_ACTIVE:
- return -EINVAL;
+ return 1; /* cycle on/off once per second */
case ETHTOOL_ID_ON:
tw32(MAC_LED_CTRL, LED_CTRL_LNKLED_OVERRIDE |
* attached to it. The implementation may update the indicator
* asynchronously or synchronously, but in either case it must return
* quickly. It is initially called with the argument %ETHTOOL_ID_ACTIVE,
- * and must either activate asynchronous updates or return -%EINVAL.
- * If it returns -%EINVAL then it will be called again at intervals with
+ * and must either activate asynchronous updates and return zero, return
+ * a negative error or return a positive frequency for synchronous
+ * indication (e.g. 1 for one on/off cycle per second). If it returns
+ * a frequency then it will be called again at intervals with the
* argument %ETHTOOL_ID_ON or %ETHTOOL_ID_OFF and should set the state of
* the indicator accordingly. Finally, it is called with the argument
* %ETHTOOL_ID_INACTIVE and must deactivate the indicator. Returns a
return dev->ethtool_ops->phys_id(dev, id.data);
rc = dev->ethtool_ops->set_phys_id(dev, ETHTOOL_ID_ACTIVE);
- if (rc && rc != -EINVAL)
+ if (rc < 0)
return rc;
/* Drop the RTNL lock while waiting, but prevent reentry or
schedule_timeout_interruptible(
id.data ? (id.data * HZ) : MAX_SCHEDULE_TIMEOUT);
} else {
- /* Driver expects to be called periodically */
+ /* Driver expects to be called at twice the frequency in rc */
+ int n = rc * 2, i, interval = HZ / n;
+
+ /* Count down seconds */
do {
- rtnl_lock();
- rc = dev->ethtool_ops->set_phys_id(dev, ETHTOOL_ID_ON);
- rtnl_unlock();
- if (rc)
- break;
- schedule_timeout_interruptible(HZ / 2);
-
- rtnl_lock();
- rc = dev->ethtool_ops->set_phys_id(dev, ETHTOOL_ID_OFF);
- rtnl_unlock();
- if (rc)
- break;
- schedule_timeout_interruptible(HZ / 2);
+ /* Count down iterations per second */
+ i = n;
+ do {
+ rtnl_lock();
+ rc = dev->ethtool_ops->set_phys_id(dev,
+ (i & 1) ? ETHTOOL_ID_OFF : ETHTOOL_ID_ON);
+ rtnl_unlock();
+ if (rc)
+ break;
+ schedule_timeout_interruptible(interval);
+ } while (!signal_pending(current) && --i != 0);
} while (!signal_pending(current) &&
(id.data == 0 || --id.data != 0));
}