From: Amit Kumar Salecha <amit.salecha@qlogic.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, dhananjay.phadke@qlogic.com,
ameen.rahman@qlogic.com,
Sucheta Chakraborty <sucheta@dut6195.unminc.com>,
Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Subject: [PATCH NEXT 5/7] qlcnic: add LED diagnostic test.
Date: Mon, 1 Feb 2010 06:30:42 -0800 [thread overview]
Message-ID: <1265034644-19461-6-git-send-email-amit.salecha@qlogic.com> (raw)
In-Reply-To: <1265034644-19461-1-git-send-email-amit.salecha@qlogic.com>
From: Sucheta Chakraborty <sucheta@dut6195.unminc.com>
LED test support in ethtool self test. Blink LED for 10 secs.
Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
drivers/net/qlcnic/qlcnic.h | 3 ++
drivers/net/qlcnic/qlcnic_ctx.c | 2 -
drivers/net/qlcnic/qlcnic_ethtool.c | 10 ++++++-
drivers/net/qlcnic/qlcnic_hw.c | 48 +++++++++++++++++++++++++++++++++++
4 files changed, 60 insertions(+), 3 deletions(-)
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 9662a37..2fc710f 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -560,6 +560,8 @@ struct qlcnic_recv_context {
/*
* Context state
*/
+#define QLCHAL_VERSION 1
+
#define QLCNIC_HOST_CTX_STATE_ACTIVE 2
/*
@@ -1015,6 +1017,7 @@ void qlcnic_pcie_sem_unlock(struct qlcnic_adapter *, int);
int qlcnic_get_board_info(struct qlcnic_adapter *adapter);
int qlcnic_wol_supported(struct qlcnic_adapter *adapter);
+int qlcnic_led_test(struct qlcnic_adapter *adapter);
/* Functions from qlcnic_init.c */
int qlcnic_phantom_init(struct qlcnic_adapter *adapter);
diff --git a/drivers/net/qlcnic/qlcnic_ctx.c b/drivers/net/qlcnic/qlcnic_ctx.c
index 71c16a1..510edc5 100644
--- a/drivers/net/qlcnic/qlcnic_ctx.c
+++ b/drivers/net/qlcnic/qlcnic_ctx.c
@@ -24,8 +24,6 @@
#include "qlcnic.h"
-#define QLCHAL_VERSION 1
-
static u32
qlcnic_poll_rsp(struct qlcnic_adapter *adapter)
{
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index 37df5f6..5be4c8b 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -65,7 +65,8 @@ static const struct qlcnic_stats qlcnic_gstrings_stats[] = {
static const char qlcnic_gstrings_test[][ETH_GSTRING_LEN] = {
"Register_Test_on_offline",
- "Link_Test_on_offline"
+ "Link_Test_on_offline",
+ "LED_Test_on_offline"
};
#define QLCNIC_TEST_LEN ARRAY_SIZE(qlcnic_gstrings_test)
@@ -617,7 +618,10 @@ static void
qlcnic_diag_test(struct net_device *dev, struct ethtool_test *eth_test,
u64 *data)
{
+ struct qlcnic_adapter *adapter = netdev_priv(dev);
+
memset(data, 0, sizeof(u64) * QLCNIC_TEST_LEN);
+
data[0] = qlcnic_reg_test(dev);
if (data[0])
eth_test->flags |= ETH_TEST_FL_FAILED;
@@ -626,6 +630,10 @@ qlcnic_diag_test(struct net_device *dev, struct ethtool_test *eth_test,
data[1] = (u64) qlcnic_test_link(dev);
if (data[1])
eth_test->flags |= ETH_TEST_FL_FAILED;
+
+ data[2] = (u64) qlcnic_led_test(adapter);
+ if (data[2])
+ eth_test->flags |= ETH_TEST_FL_FAILED;
}
static void
diff --git a/drivers/net/qlcnic/qlcnic_hw.c b/drivers/net/qlcnic/qlcnic_hw.c
index 91234e7..4e60c21 100644
--- a/drivers/net/qlcnic/qlcnic_hw.c
+++ b/drivers/net/qlcnic/qlcnic_hw.c
@@ -1199,3 +1199,51 @@ qlcnic_wol_supported(struct qlcnic_adapter *adapter)
return 0;
}
+
+static int qlcnic_config_led(struct qlcnic_adapter *adapter,
+ u32 state, u32 rate)
+{
+ struct qlcnic_nic_req req;
+ int rv;
+ u64 word;
+
+ memset(&req, 0, sizeof(struct qlcnic_nic_req));
+ req.qhdr = cpu_to_le64(QLCNIC_HOST_REQUEST << 23);
+
+ word = QLCNIC_H2C_OPCODE_CONFIG_LED | ((u64)adapter->portnum << 16);
+ req.req_hdr = cpu_to_le64(word);
+
+ req.words[0] = cpu_to_le64((u64)rate << 32);
+ req.words[1] = cpu_to_le64(state);
+
+ rv = qlcnic_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1);
+ if (rv)
+ dev_err(&adapter->pdev->dev, "LED configuration failed.\n");
+
+ return rv;
+}
+
+int qlcnic_led_test(struct qlcnic_adapter *adapter)
+{
+ int ret;
+
+ ret = qlcnic_config_led(adapter, 1, 0xf);
+ if (ret) {
+ dev_err(&adapter->pdev->dev,
+ "Failed to set LED blink state.\n");
+ return ret;
+ }
+
+ msleep_interruptible(10 * 1000);
+
+ ret = qlcnic_config_led(adapter, 0, 0xf);
+ if (ret) {
+ dev_err(&adapter->pdev->dev,
+ "Failed to reset LED blink state.\n");
+ return ret;
+ }
+
+ return 0;
+}
+
+
--
1.6.0.2
next prev parent reply other threads:[~2010-02-01 14:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-01 14:30 [PATCH NEXT 0/7]qlcnic: add diagnostic tests Amit Kumar Salecha
2010-02-01 14:30 ` [PATCH NEXT 1/7] qlcnic: use DEFINE_PCI_DEVICE_TABLE Amit Kumar Salecha
2010-02-01 14:30 ` [PATCH NEXT 2/7] qlcnic: add ethernet identifier in board info Amit Kumar Salecha
2010-02-01 14:30 ` [PATCH NEXT 3/7] qlcnic: clear device reset state after fw recovery Amit Kumar Salecha
2010-02-01 14:30 ` [PATCH NEXT 4/7] qlcnic: protect resoruce cleanup by rtnl lock Amit Kumar Salecha
2010-02-01 14:30 ` Amit Kumar Salecha [this message]
2010-02-01 14:30 ` [PATCH NEXT 6/7] qlcnic: add interrupt diagnostic test Amit Kumar Salecha
2010-02-01 14:30 ` [PATCH NEXT 7/7] qlcnic: add loppback " Amit Kumar Salecha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1265034644-19461-6-git-send-email-amit.salecha@qlogic.com \
--to=amit.salecha@qlogic.com \
--cc=ameen.rahman@qlogic.com \
--cc=davem@davemloft.net \
--cc=dhananjay.phadke@qlogic.com \
--cc=netdev@vger.kernel.org \
--cc=sucheta.chakraborty@qlogic.com \
--cc=sucheta@dut6195.unminc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox