netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: stephen@networkplumber.org, dsahern@gmail.com, mlxsw@nvidia.com
Subject: [patch iproute2-next] devlink: Add health reporter test command support
Date: Thu,  1 Oct 2020 09:21:13 +0200	[thread overview]
Message-ID: <20201001072113.493092-1-jiri@resnulli.us> (raw)

From: Jiri Pirko <jiri@nvidia.com>

Add health reporter test command and allow user to trigger a test event.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
---
 bash-completion/devlink   |  2 +-
 devlink/devlink.c         | 11 +++++++++++
 man/man8/devlink-health.8 | 16 ++++++++++++++++
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/bash-completion/devlink b/bash-completion/devlink
index f710c888652e..7395b5040232 100644
--- a/bash-completion/devlink
+++ b/bash-completion/devlink
@@ -635,7 +635,7 @@ _devlink_health_reporter()
 _devlink_health()
 {
     case $command in
-        show|recover|diagnose|set)
+        show|recover|diagnose|set|test)
             _devlink_health_reporter 0
             if [[ $command == "set" ]]; then
                 case $cword in
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 0374175eda3d..126156a200c9 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -7055,6 +7055,13 @@ static int cmd_health_diagnose(struct dl *dl)
 					0);
 }
 
+static int cmd_health_test(struct dl *dl)
+{
+	return cmd_health_object_common(dl,
+					DEVLINK_CMD_HEALTH_REPORTER_TEST,
+					0);
+}
+
 static int cmd_health_recover(struct dl *dl)
 {
 	struct nlmsghdr *nlh;
@@ -7259,6 +7266,7 @@ static void cmd_health_help(void)
 	pr_err("Usage: devlink health show [ { DEV | DEV/PORT_INDEX } reporter REPORTER_NAME ]\n");
 	pr_err("       devlink health recover { DEV | DEV/PORT_INDEX } reporter REPORTER_NAME\n");
 	pr_err("       devlink health diagnose { DEV | DEV/PORT_INDEX } reporter REPORTER_NAME\n");
+	pr_err("       devlink health test { DEV | DEV/PORT_INDEX } reporter REPORTER_NAME\n");
 	pr_err("       devlink health dump show { DEV | DEV/PORT_INDEX } reporter REPORTER_NAME\n");
 	pr_err("       devlink health dump clear { DEV | DEV/PORT_INDEX } reporter REPORTER_NAME\n");
 	pr_err("       devlink health set { DEV | DEV/PORT_INDEX } reporter REPORTER_NAME\n");
@@ -7282,6 +7290,9 @@ static int cmd_health(struct dl *dl)
 	} else if (dl_argv_match(dl, "diagnose")) {
 		dl_arg_inc(dl);
 		return cmd_health_diagnose(dl);
+	} else if (dl_argv_match(dl, "test")) {
+		dl_arg_inc(dl);
+		return cmd_health_test(dl);
 	} else if (dl_argv_match(dl, "dump")) {
 		dl_arg_inc(dl);
 		if (dl_argv_match(dl, "show")) {
diff --git a/man/man8/devlink-health.8 b/man/man8/devlink-health.8
index 47b96135ef01..975b8c75d798 100644
--- a/man/man8/devlink-health.8
+++ b/man/man8/devlink-health.8
@@ -41,6 +41,12 @@ devlink-health \- devlink health reporting and recovery
 .B  reporter
 .RI "" REPORTER ""
 
+.ti -8
+.BR "devlink health test"
+.RI "{ " DEV " | " DEV/PORT_INDEX " }"
+.B reporter
+.RI "" REPORTER ""
+
 .ti -8
 .B devlink health dump clear
 .RI "{ " DEV " | " DEV/PORT_INDEX " }"
@@ -105,6 +111,16 @@ This action performs a recovery and increases the recoveries counter on success.
 .I "REPORTER"
 - specifies the reporter's name registered on specified devlink device or port.
 
+.SS devlink health test - Trigger a test event on a reporter.
+
+.PP
+.I "DEV"
+- specifies the devlink device.
+
+.PP
+.I "REPORTER"
+- specifies the reporter's name registered on the devlink device.
+
 .SS devlink health dump show - Display the last saved dump.
 
 .PD 0
-- 
2.26.2


             reply	other threads:[~2020-10-01  7:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01  7:21 Jiri Pirko [this message]
2020-10-07  6:10 ` [patch iproute2-next] devlink: Add health reporter test command support David Ahern

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=20201001072113.493092-1-jiri@resnulli.us \
    --to=jiri@resnulli.us \
    --cc=dsahern@gmail.com \
    --cc=mlxsw@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /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;
as well as URLs for NNTP newsgroup(s).