From patchwork Tue Sep 20 10:31:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sucheta Chakraborty X-Patchwork-Id: 115487 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B1DE51007D1 for ; Tue, 20 Sep 2011 20:43:38 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755366Ab1ITKn2 (ORCPT ); Tue, 20 Sep 2011 06:43:28 -0400 Received: from tx2ehsobe001.messaging.microsoft.com ([65.55.88.11]:52072 "EHLO TX2EHSOBE001.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755194Ab1ITKn1 (ORCPT ); Tue, 20 Sep 2011 06:43:27 -0400 Received: from mail101-tx2-R.bigfish.com (10.9.14.241) by TX2EHSOBE001.bigfish.com (10.9.40.21) with Microsoft SMTP Server id 14.1.225.22; Tue, 20 Sep 2011 10:43:27 +0000 Received: from mail101-tx2 (localhost.localdomain [127.0.0.1]) by mail101-tx2-R.bigfish.com (Postfix) with ESMTP id DD61C15F8358; Tue, 20 Sep 2011 10:43:26 +0000 (UTC) X-SpamScore: 0 X-BigFish: VPS0(zzzz1202hzz8275bhz2fh2a8h668h839h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: CIP:198.70.193.61; KIP:(null); UIP:(null); IPVD:NLI; H:avexcashub1.qlogic.com; RD:avexcashub1.qlogic.com; EFVD:NLI Received-SPF: pass (mail101-tx2: domain of qlogic.com designates 198.70.193.61 as permitted sender) client-ip=198.70.193.61; envelope-from=sucheta.chakraborty@qlogic.com; helo=avexcashub1.qlogic.com ; 1.qlogic.com ; Received: from mail101-tx2 (localhost.localdomain [127.0.0.1]) by mail101-tx2 (MessageSwitch) id 1316515348460375_31977; Tue, 20 Sep 2011 10:42:28 +0000 (UTC) Received: from TX2EHSMHS028.bigfish.com (unknown [10.9.14.249]) by mail101-tx2.bigfish.com (Postfix) with ESMTP id 5B4C3171005F; Tue, 20 Sep 2011 10:42:28 +0000 (UTC) Received: from avexcashub1.qlogic.com (198.70.193.61) by TX2EHSMHS028.bigfish.com (10.9.99.128) with Microsoft SMTP Server (TLS) id 14.1.225.22; Tue, 20 Sep 2011 10:42:28 +0000 Received: from mx.mv.qlogic.com (10.29.3.18) by avexcashub1.qlc.com (10.1.4.161) with Microsoft SMTP Server id 8.3.192.1; Tue, 20 Sep 2011 03:42:26 -0700 Received: from lnxdev-sm-001.mv.qlogic.com (dut6217.mv.qlogic.com [172.29.56.217]) by mx.mv.qlogic.com (Postfix) with ESMTP id A7D04C3175; Tue, 20 Sep 2011 03:42:26 -0700 (PDT) Received: by lnxdev-sm-001.mv.qlogic.com (Postfix, from userid 0) id 3CDDD14A98C; Tue, 20 Sep 2011 03:31:35 -0700 (PDT) From: Sucheta Chakraborty To: Ben Hutchings CC: , Dept_NX_Linux_NIC_Driver Subject: [PATCH ethtool 2/3] ethtool: add support for external loopback. Date: Tue, 20 Sep 2011 03:31:34 -0700 Message-ID: <1316514695-17157-3-git-send-email-sucheta.chakraborty@qlogic.com> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1316514695-17157-1-git-send-email-sucheta.chakraborty@qlogic.com> References: <1316514695-17157-1-git-send-email-sucheta.chakraborty@qlogic.com> MIME-Version: 1.0 X-OriginatorOrg: qlogic.com Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- ethtool.8.in | 15 +++++++++++---- ethtool.c | 12 ++++++++++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/ethtool.8.in b/ethtool.8.in index 7a0bd43..efc6098 100644 --- a/ethtool.8.in +++ b/ethtool.8.in @@ -68,6 +68,10 @@ .\" .ds HO \fBm\fP|\fBv\fP|\fBt\fP|\fBs\fP|\fBd\fP|\fBf\fP|\fBn\fP|\fBr\fP... .\" +.\" \(*SD - Self-diag test values +.\" +.ds SD \fBoffline\fP|\fBonline\fP|\fBexternal_lb\fP +.\" .\" \(*NC - Network Classifier type values .\" .ds NC \fBether\fP|\fBip4\fP|\fBtcp4\fP|\fBudp4\fP|\fBsctp4\fP|\fBah4\fP|\fBesp4\fP @@ -227,7 +231,7 @@ ethtool \- query or control network driver and hardware settings .HP .B ethtool \-t|\-\-test .I ethX -.B1 offline online +.RI [\*(SD] .HP .B ethtool \-s .I ethX @@ -457,12 +461,14 @@ statistics. .B \-t \-\-test Executes adapter selftest on the specified network device. Possible test modes are: .TP -.A1 offline online +.RI \*(SD defines test type: .B offline (default) means to perform full set of tests possibly causing normal operation interruption during the tests, .B online -means to perform limited set of tests do not interrupting normal adapter operation. +means to perform limited set of tests do not interrupting normal adapter operation, +.B external_lb +means to perform external-loopback test in addition to other offline tests. .TP .B \-s \-\-change Allows changing some or all settings of the specified network device. @@ -762,7 +768,8 @@ Andre Majorel, Eli Kupermann, Scott Feldman, Andi Kleen, -Alexander Duyck. +Alexander Duyck, +Sucheta Chakraborty. .SH AVAILABILITY .B ethtool is available from diff --git a/ethtool.c b/ethtool.c index 943dfb7..d7d2d58 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(); } @@ -1689,6 +1692,9 @@ 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"); + fprintf(stdout, "External loopback test is %s\n", + test->flags & ETH_TEST_FL_EXTERNAL_LB_DONE ? "executed" : + "not executed"); if (info->testinfo_len) fprintf(stdout, "The test extra info:\n"); @@ -2749,7 +2755,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;