Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 368166
b: refs/heads/master
c: d16951d
h: refs/heads/master
v: v3
  • Loading branch information
Himanshu Madhani authored and David S. Miller committed Mar 9, 2013
1 parent 9c7aa7a commit 599bf9a
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a96227e66f0a0361d96885042629bf60eb6a4b39
refs/heads/master: d16951d94aabb72245319679036125b8d7efead9
45 changes: 45 additions & 0 deletions trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1432,6 +1432,51 @@ int qlcnic_83xx_config_led(struct qlcnic_adapter *adapter, u32 state,
}
}

int qlcnic_83xx_set_led(struct net_device *netdev,
enum ethtool_phys_id_state state)
{
struct qlcnic_adapter *adapter = netdev_priv(netdev);
int err = -EIO, active = 1;

if (adapter->ahw->op_mode == QLCNIC_NON_PRIV_FUNC) {
netdev_warn(netdev,
"LED test is not supported in non-privileged mode\n");
return -EOPNOTSUPP;
}

switch (state) {
case ETHTOOL_ID_ACTIVE:
if (test_and_set_bit(__QLCNIC_LED_ENABLE, &adapter->state))
return -EBUSY;

if (test_bit(__QLCNIC_RESETTING, &adapter->state))
break;

err = qlcnic_83xx_config_led(adapter, active, 0);
if (err)
netdev_err(netdev, "Failed to set LED blink state\n");
break;
case ETHTOOL_ID_INACTIVE:
active = 0;

if (test_bit(__QLCNIC_RESETTING, &adapter->state))
break;

err = qlcnic_83xx_config_led(adapter, active, 0);
if (err)
netdev_err(netdev, "Failed to reset LED blink state\n");
break;

default:
return -EINVAL;
}

if (!active || err)
clear_bit(__QLCNIC_LED_ENABLE, &adapter->state);

return err;
}

void qlcnic_83xx_register_nic_idc_func(struct qlcnic_adapter *adapter,
int enable)
{
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -449,5 +449,6 @@ int qlcnic_83xx_get_regs_len(struct qlcnic_adapter *);
int qlcnic_83xx_get_registers(struct qlcnic_adapter *, u32 *);
int qlcnic_83xx_loopback_test(struct net_device *, u8);
int qlcnic_83xx_interrupt_test(struct net_device *);
int qlcnic_83xx_set_led(struct net_device *, enum ethtool_phys_id_state);
int qlcnic_83xx_flash_test(struct qlcnic_adapter *);
#endif
3 changes: 2 additions & 1 deletion trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,8 @@ static int qlcnic_set_led(struct net_device *dev,
int err = -EIO, active = 1;

if (qlcnic_83xx_check(adapter))
return -EOPNOTSUPP;
return qlcnic_83xx_set_led(dev, state);

if (adapter->ahw->op_mode == QLCNIC_NON_PRIV_FUNC) {
netdev_warn(dev, "LED test not supported for non "
"privilege function\n");
Expand Down

0 comments on commit 599bf9a

Please sign in to comment.