mirror of
https://github.com/torvalds/linux.git
synced 2024-11-05 19:41:54 +00:00
qlcnic: fix LED test when interface is down.
When interface is down, create temporary context to config LED. Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7edc3453e5
commit
c75822a309
@ -925,6 +925,7 @@ struct qlcnic_ipaddr {
|
|||||||
|
|
||||||
#define QLCNIC_INTERRUPT_TEST 1
|
#define QLCNIC_INTERRUPT_TEST 1
|
||||||
#define QLCNIC_LOOPBACK_TEST 2
|
#define QLCNIC_LOOPBACK_TEST 2
|
||||||
|
#define QLCNIC_LED_TEST 3
|
||||||
|
|
||||||
#define QLCNIC_FILTER_AGE 80
|
#define QLCNIC_FILTER_AGE 80
|
||||||
#define QLCNIC_READD_AGE 20
|
#define QLCNIC_READD_AGE 20
|
||||||
|
@ -834,16 +834,27 @@ static int qlcnic_set_tso(struct net_device *dev, u32 data)
|
|||||||
static int qlcnic_blink_led(struct net_device *dev, u32 val)
|
static int qlcnic_blink_led(struct net_device *dev, u32 val)
|
||||||
{
|
{
|
||||||
struct qlcnic_adapter *adapter = netdev_priv(dev);
|
struct qlcnic_adapter *adapter = netdev_priv(dev);
|
||||||
|
int max_sds_rings = adapter->max_sds_rings;
|
||||||
|
int dev_down = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!test_bit(__QLCNIC_DEV_UP, &adapter->state))
|
if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) {
|
||||||
|
dev_down = 1;
|
||||||
|
if (test_and_set_bit(__QLCNIC_RESETTING, &adapter->state))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
|
ret = qlcnic_diag_alloc_res(dev, QLCNIC_LED_TEST);
|
||||||
|
if (ret) {
|
||||||
|
clear_bit(__QLCNIC_RESETTING, &adapter->state);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ret = adapter->nic_ops->config_led(adapter, 1, 0xf);
|
ret = adapter->nic_ops->config_led(adapter, 1, 0xf);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&adapter->pdev->dev,
|
dev_err(&adapter->pdev->dev,
|
||||||
"Failed to set LED blink state.\n");
|
"Failed to set LED blink state.\n");
|
||||||
return ret;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
msleep_interruptible(val * 1000);
|
msleep_interruptible(val * 1000);
|
||||||
@ -852,10 +863,16 @@ static int qlcnic_blink_led(struct net_device *dev, u32 val)
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&adapter->pdev->dev,
|
dev_err(&adapter->pdev->dev,
|
||||||
"Failed to reset LED blink state.\n");
|
"Failed to reset LED blink state.\n");
|
||||||
return ret;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
done:
|
||||||
|
if (dev_down) {
|
||||||
|
qlcnic_diag_free_res(dev, max_sds_rings);
|
||||||
|
clear_bit(__QLCNIC_RESETTING, &adapter->state);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user