aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlcnic
diff options
context:
space:
mode:
authorSucheta Chakraborty <sucheta@dut6195.unminc.com>2010-02-01 00:24:58 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-02 18:55:45 -0500
commit897d3596e0dfc4c25963cff00f1159c79eaf38d3 (patch)
tree4e2e780345db8e1ef6b9a3de5d01a707ecb209fb /drivers/net/qlcnic
parentce6684433fb277406dd861fd8a17133253e7c367 (diff)
qlcnic: support LED blink for device identification
Added support of device identification by blinking LED for specified time. 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.h1
-rw-r--r--drivers/net/qlcnic/qlcnic_ethtool.c26
-rw-r--r--drivers/net/qlcnic/qlcnic_hw.c22
3 files changed, 49 insertions, 0 deletions
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 9662a37bfc57..514e805f3ab3 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -1015,6 +1015,7 @@ void qlcnic_pcie_sem_unlock(struct qlcnic_adapter *, int);
1015 1015
1016int qlcnic_get_board_info(struct qlcnic_adapter *adapter); 1016int qlcnic_get_board_info(struct qlcnic_adapter *adapter);
1017int qlcnic_wol_supported(struct qlcnic_adapter *adapter); 1017int qlcnic_wol_supported(struct qlcnic_adapter *adapter);
1018int qlcnic_config_led(struct qlcnic_adapter *adapter, u32 state, u32 rate);
1018 1019
1019/* Functions from qlcnic_init.c */ 1020/* Functions from qlcnic_init.c */
1020int qlcnic_phantom_init(struct qlcnic_adapter *adapter); 1021int qlcnic_phantom_init(struct qlcnic_adapter *adapter);
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index 37df5f6cea08..7212319760ba 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -618,6 +618,7 @@ qlcnic_diag_test(struct net_device *dev, struct ethtool_test *eth_test,
618 u64 *data) 618 u64 *data)
619{ 619{
620 memset(data, 0, sizeof(u64) * QLCNIC_TEST_LEN); 620 memset(data, 0, sizeof(u64) * QLCNIC_TEST_LEN);
621
621 data[0] = qlcnic_reg_test(dev); 622 data[0] = qlcnic_reg_test(dev);
622 if (data[0]) 623 if (data[0])
623 eth_test->flags |= ETH_TEST_FL_FAILED; 624 eth_test->flags |= ETH_TEST_FL_FAILED;
@@ -693,6 +694,30 @@ static int qlcnic_set_tso(struct net_device *dev, u32 data)
693 return 0; 694 return 0;
694} 695}
695 696
697static int qlcnic_blink_led(struct net_device *dev, u32 val)
698{
699 struct qlcnic_adapter *adapter = netdev_priv(dev);
700 int ret;
701
702 ret = qlcnic_config_led(adapter, 1, 0xf);
703 if (ret) {
704 dev_err(&adapter->pdev->dev,
705 "Failed to set LED blink state.\n");
706 return ret;
707 }
708
709 msleep_interruptible(val * 1000);
710
711 ret = qlcnic_config_led(adapter, 0, 0xf);
712 if (ret) {
713 dev_err(&adapter->pdev->dev,
714 "Failed to reset LED blink state.\n");
715 return ret;
716 }
717
718 return 0;
719}
720
696static void 721static void
697qlcnic_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) 722qlcnic_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
698{ 723{
@@ -867,4 +892,5 @@ const struct ethtool_ops qlcnic_ethtool_ops = {
867 .set_coalesce = qlcnic_set_intr_coalesce, 892 .set_coalesce = qlcnic_set_intr_coalesce,
868 .get_flags = ethtool_op_get_flags, 893 .get_flags = ethtool_op_get_flags,
869 .set_flags = qlcnic_set_flags, 894 .set_flags = qlcnic_set_flags,
895 .phys_id = qlcnic_blink_led,
870}; 896};
diff --git a/drivers/net/qlcnic/qlcnic_hw.c b/drivers/net/qlcnic/qlcnic_hw.c
index 91234e7b39e4..8724e561ed72 100644
--- a/drivers/net/qlcnic/qlcnic_hw.c
+++ b/drivers/net/qlcnic/qlcnic_hw.c
@@ -1199,3 +1199,25 @@ qlcnic_wol_supported(struct qlcnic_adapter *adapter)
1199 1199
1200 return 0; 1200 return 0;
1201} 1201}
1202
1203int qlcnic_config_led(struct qlcnic_adapter *adapter, u32 state, u32 rate)
1204{
1205 struct qlcnic_nic_req req;
1206 int rv;
1207 u64 word;
1208
1209 memset(&req, 0, sizeof(struct qlcnic_nic_req));
1210 req.qhdr = cpu_to_le64(QLCNIC_HOST_REQUEST << 23);
1211
1212 word = QLCNIC_H2C_OPCODE_CONFIG_LED | ((u64)adapter->portnum << 16);
1213 req.req_hdr = cpu_to_le64(word);
1214
1215 req.words[0] = cpu_to_le64((u64)rate << 32);
1216 req.words[1] = cpu_to_le64(state);
1217
1218 rv = qlcnic_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1);
1219 if (rv)
1220 dev_err(&adapter->pdev->dev, "LED configuration failed.\n");
1221
1222 return rv;
1223}