summaryrefslogtreecommitdiff
path: root/ethtool.c
diff options
context:
space:
mode:
authorSucheta Chakraborty <sucheta.chakraborty@qlogic.com>2011-09-20 03:31:34 -0700
committerBen Hutchings <bhutchings@solarflare.com>2011-10-04 23:06:44 +0100
commitbeceb09e2292ab716ca08715ebe1adb2795d1099 (patch)
treefd4ef845165b3cdfeb946bb72ca17b4db601a0fb /ethtool.c
parent7a8c1d06bdad0d143207728a7a4183ed47df63b4 (diff)
downloadethtool-beceb09e2292ab716ca08715ebe1adb2795d1099.tar.gz
ethtool: add support for external loopback.
External loopback will be performed in addition to other offline tests. User need to pass new parameter "external_lb" for the same. Reqd. man page changes included. Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> [bwh: Report whether the external loopback test 'was', not 'is' executed. For compatibility, don't report this if not requested.] Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'ethtool.c')
-rw-r--r--ethtool.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/ethtool.c b/ethtool.c
index 943dfb7..c7cdd09 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -219,7 +219,7 @@ static struct option {
{ "-p", "--identify", MODE_PHYS_ID, "Show visible port identification (e.g. blinking)",
" [ TIME-IN-SECONDS ]\n" },
{ "-t", "--test", MODE_TEST, "Execute adapter self test",
- " [ online | offline ]\n" },
+ " [ online | offline | external_lb ]\n" },
{ "-S", "--statistics", MODE_GSTATS, "Show adapter statistics" },
{ "-n", "--show-nfc", MODE_GNFC, "Show Rx network flow classification "
"options",
@@ -408,6 +408,7 @@ static struct ethtool_rx_flow_spec rx_rule_fs;
static enum {
ONLINE=0,
OFFLINE,
+ EXTERNAL_LB,
} test_type = OFFLINE;
typedef enum {
@@ -811,6 +812,8 @@ static void parse_cmdline(int argc, char **argp)
test_type = ONLINE;
} else if (!strcmp(argp[i], "offline")) {
test_type = OFFLINE;
+ } else if (!strcmp(argp[i], "external_lb")) {
+ test_type = EXTERNAL_LB;
} else {
exit_bad_args();
}
@@ -1690,6 +1693,11 @@ static int dump_test(struct ethtool_drvinfo *info, struct ethtool_test *test,
rc = test->flags & ETH_TEST_FL_FAILED;
fprintf(stdout, "The test result is %s\n", rc ? "FAIL" : "PASS");
+ if (test_type == EXTERNAL_LB)
+ fprintf(stdout, "External loopback test was %sexecuted\n",
+ (test->flags & ETH_TEST_FL_EXTERNAL_LB_DONE) ?
+ "" : "not ");
+
if (info->testinfo_len)
fprintf(stdout, "The test extra info:\n");
@@ -2749,7 +2757,9 @@ static int do_test(int fd, struct ifreq *ifr)
memset (test->data, 0, drvinfo.testinfo_len * sizeof(u64));
test->cmd = ETHTOOL_TEST;
test->len = drvinfo.testinfo_len;
- if (test_type == OFFLINE)
+ if (test_type == EXTERNAL_LB)
+ test->flags = (ETH_TEST_FL_OFFLINE | ETH_TEST_FL_EXTERNAL_LB);
+ else if (test_type == OFFLINE)
test->flags = ETH_TEST_FL_OFFLINE;
else
test->flags = 0;