diff options
author | Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> | 2010-12-16 17:59:00 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-12-17 14:39:01 -0500 |
commit | c75822a3091a899d982d59cd2b4454fe7c3e0318 (patch) | |
tree | 89a7cc75c92567cbe28b33c93baade8495aafa3a /drivers/net/qlcnic | |
parent | 7edc3453e54432a9f1c636b6481f1107c9db19bd (diff) |
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>
Diffstat (limited to 'drivers/net/qlcnic')
-rw-r--r-- | drivers/net/qlcnic/qlcnic.h | 1 | ||||
-rw-r--r-- | drivers/net/qlcnic/qlcnic_ethtool.c | 27 |
2 files changed, 23 insertions, 5 deletions
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h index f267da42f24..4028d0c08f2 100644 --- a/drivers/net/qlcnic/qlcnic.h +++ b/drivers/net/qlcnic/qlcnic.h | |||
@@ -925,6 +925,7 @@ struct qlcnic_ipaddr { | |||
925 | 925 | ||
926 | #define QLCNIC_INTERRUPT_TEST 1 | 926 | #define QLCNIC_INTERRUPT_TEST 1 |
927 | #define QLCNIC_LOOPBACK_TEST 2 | 927 | #define QLCNIC_LOOPBACK_TEST 2 |
928 | #define QLCNIC_LED_TEST 3 | ||
928 | 929 | ||
929 | #define QLCNIC_FILTER_AGE 80 | 930 | #define QLCNIC_FILTER_AGE 80 |
930 | #define QLCNIC_READD_AGE 20 | 931 | #define QLCNIC_READD_AGE 20 |
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c index 0eaf31bf8a0..1e7af709d39 100644 --- a/drivers/net/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/qlcnic/qlcnic_ethtool.c | |||
@@ -834,16 +834,27 @@ static int qlcnic_set_tso(struct net_device *dev, u32 data) | |||
834 | static int qlcnic_blink_led(struct net_device *dev, u32 val) | 834 | static int qlcnic_blink_led(struct net_device *dev, u32 val) |
835 | { | 835 | { |
836 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 836 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
837 | int max_sds_rings = adapter->max_sds_rings; | ||
838 | int dev_down = 0; | ||
837 | int ret; | 839 | int ret; |
838 | 840 | ||
839 | if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) | 841 | if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) { |
840 | return -EIO; | 842 | dev_down = 1; |
843 | if (test_and_set_bit(__QLCNIC_RESETTING, &adapter->state)) | ||
844 | return -EIO; | ||
845 | |||
846 | ret = qlcnic_diag_alloc_res(dev, QLCNIC_LED_TEST); | ||
847 | if (ret) { | ||
848 | clear_bit(__QLCNIC_RESETTING, &adapter->state); | ||
849 | return ret; | ||
850 | } | ||
851 | } | ||
841 | 852 | ||
842 | ret = adapter->nic_ops->config_led(adapter, 1, 0xf); | 853 | ret = adapter->nic_ops->config_led(adapter, 1, 0xf); |
843 | if (ret) { | 854 | if (ret) { |
844 | dev_err(&adapter->pdev->dev, | 855 | dev_err(&adapter->pdev->dev, |
845 | "Failed to set LED blink state.\n"); | 856 | "Failed to set LED blink state.\n"); |
846 | return ret; | 857 | goto done; |
847 | } | 858 | } |
848 | 859 | ||
849 | msleep_interruptible(val * 1000); | 860 | msleep_interruptible(val * 1000); |
@@ -852,10 +863,16 @@ static int qlcnic_blink_led(struct net_device *dev, u32 val) | |||
852 | if (ret) { | 863 | if (ret) { |
853 | dev_err(&adapter->pdev->dev, | 864 | dev_err(&adapter->pdev->dev, |
854 | "Failed to reset LED blink state.\n"); | 865 | "Failed to reset LED blink state.\n"); |
855 | return ret; | 866 | goto done; |
856 | } | 867 | } |
857 | 868 | ||
858 | return 0; | 869 | done: |
870 | if (dev_down) { | ||
871 | qlcnic_diag_free_res(dev, max_sds_rings); | ||
872 | clear_bit(__QLCNIC_RESETTING, &adapter->state); | ||
873 | } | ||
874 | return ret; | ||
875 | |||
859 | } | 876 | } |
860 | 877 | ||
861 | static void | 878 | static void |