Blame SOURCES/0031-devlink-Add-health-error-recovery-status-monitoring.patch

d2d45d
From 81a035c029c2ef108da0f854c5a670aa3f06bb94 Mon Sep 17 00:00:00 2001
d2d45d
From: Andrea Claudi <aclaudi@redhat.com>
d2d45d
Date: Wed, 17 Jun 2020 12:10:11 +0200
d2d45d
Subject: [PATCH] devlink: Add health error recovery status monitoring
d2d45d
d2d45d
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1821039
d2d45d
Upstream Status: iproute2.git commit 5023df6a21c73
d2d45d
Conflicts: context change due to missing commit
d2d45d
  - ef12d6dafaeb9 ("devlink: Add devlink trap set and show commands")
d2d45d
  - 4ede9e9d56206 ("devlink: Add devlink trap group set and show commands")
d2d45d
  - a66af5569337b ("devlink: Add devlink trap policer set and show commands")
d2d45d
d2d45d
commit 5023df6a21c73560b514d7fde5381d140373afe9
d2d45d
Author: Moshe Shemesh <moshe@mellanox.com>
d2d45d
Date:   Tue Feb 4 23:37:02 2020 +0200
d2d45d
d2d45d
    devlink: Add health error recovery status monitoring
d2d45d
d2d45d
    Add support for devlink health error recovery status monitoring.
d2d45d
    Update devlink-monitor man page accordingly.
d2d45d
d2d45d
    Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
d2d45d
    Acked-by: Jiri Pirko <jiri@mellanox.com>
d2d45d
    Signed-off-by: David Ahern <dsahern@gmail.com>
d2d45d
---
d2d45d
 devlink/devlink.c          | 17 +++++++++++++++--
d2d45d
 man/man8/devlink-monitor.8 |  3 ++-
d2d45d
 2 files changed, 17 insertions(+), 3 deletions(-)
d2d45d
d2d45d
diff --git a/devlink/devlink.c b/devlink/devlink.c
d2d45d
index 0293373928f50..f7e859c266394 100644
d2d45d
--- a/devlink/devlink.c
d2d45d
+++ b/devlink/devlink.c
d2d45d
@@ -3764,6 +3764,7 @@ static const char *cmd_name(uint8_t cmd)
d2d45d
 	case DEVLINK_CMD_REGION_SET: return "set";
d2d45d
 	case DEVLINK_CMD_REGION_NEW: return "new";
d2d45d
 	case DEVLINK_CMD_REGION_DEL: return "del";
d2d45d
+	case DEVLINK_CMD_HEALTH_REPORTER_RECOVER: return "status";
d2d45d
 	default: return "<unknown cmd>";
d2d45d
 	}
d2d45d
 }
d2d45d
@@ -3792,6 +3793,8 @@ static const char *cmd_obj(uint8_t cmd)
d2d45d
 	case DEVLINK_CMD_REGION_NEW:
d2d45d
 	case DEVLINK_CMD_REGION_DEL:
d2d45d
 		return "region";
d2d45d
+	case DEVLINK_CMD_HEALTH_REPORTER_RECOVER:
d2d45d
+		return "health";
d2d45d
 	default: return "<unknown obj>";
d2d45d
 	}
d2d45d
 }
d2d45d
@@ -3817,6 +3820,7 @@ static bool cmd_filter_check(struct dl *dl, uint8_t cmd)
d2d45d
 }
d2d45d
 
d2d45d
 static void pr_out_region(struct dl *dl, struct nlattr **tb);
d2d45d
+static void pr_out_health(struct dl *dl, struct nlattr **tb_health);
d2d45d
 
d2d45d
 static int cmd_mon_show_cb(const struct nlmsghdr *nlh, void *data)
d2d45d
 {
d2d45d
@@ -3872,6 +3876,14 @@ static int cmd_mon_show_cb(const struct nlmsghdr *nlh, void *data)
d2d45d
 		pr_out_mon_header(genl->cmd);
d2d45d
 		pr_out_region(dl, tb);
d2d45d
 		break;
d2d45d
+	case DEVLINK_CMD_HEALTH_REPORTER_RECOVER:
d2d45d
+		mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb);
d2d45d
+		if (!tb[DEVLINK_ATTR_BUS_NAME] || !tb[DEVLINK_ATTR_DEV_NAME] ||
d2d45d
+		    !tb[DEVLINK_ATTR_HEALTH_REPORTER])
d2d45d
+			return MNL_CB_ERROR;
d2d45d
+		pr_out_mon_header(genl->cmd);
d2d45d
+		pr_out_health(dl, tb);
d2d45d
+		break;
d2d45d
 	}
d2d45d
 	return MNL_CB_OK;
d2d45d
 }
d2d45d
@@ -3885,7 +3897,8 @@ static int cmd_mon_show(struct dl *dl)
d2d45d
 	while ((cur_obj = dl_argv_index(dl, index++))) {
d2d45d
 		if (strcmp(cur_obj, "all") != 0 &&
d2d45d
 		    strcmp(cur_obj, "dev") != 0 &&
d2d45d
-		    strcmp(cur_obj, "port") != 0) {
d2d45d
+		    strcmp(cur_obj, "port") != 0 &&
d2d45d
+		    strcmp(cur_obj, "health") != 0) {
d2d45d
 			pr_err("Unknown object \"%s\"\n", cur_obj);
d2d45d
 			return -EINVAL;
d2d45d
 		}
d2d45d
@@ -3902,7 +3915,7 @@ static int cmd_mon_show(struct dl *dl)
d2d45d
 static void cmd_mon_help(void)
d2d45d
 {
d2d45d
 	pr_err("Usage: devlink monitor [ all | OBJECT-LIST ]\n"
d2d45d
-	       "where  OBJECT-LIST := { dev | port }\n");
d2d45d
+	       "where  OBJECT-LIST := { dev | port | health }\n");
d2d45d
 }
d2d45d
 
d2d45d
 static int cmd_mon(struct dl *dl)
d2d45d
diff --git a/man/man8/devlink-monitor.8 b/man/man8/devlink-monitor.8
d2d45d
index 13fe641dc8f54..9bc579673ebf4 100644
d2d45d
--- a/man/man8/devlink-monitor.8
d2d45d
+++ b/man/man8/devlink-monitor.8
d2d45d
@@ -21,7 +21,7 @@ command is the first in the command line and then the object list.
d2d45d
 .I OBJECT-LIST
d2d45d
 is the list of object types that we want to monitor.
d2d45d
 It may contain
d2d45d
-.BR dev ", " port ".
d2d45d
+.BR dev ", " port ", " health ".
d2d45d
 
d2d45d
 .B devlink
d2d45d
 opens Devlink Netlink socket, listens on it and dumps state changes.
d2d45d
@@ -31,6 +31,7 @@ opens Devlink Netlink socket, listens on it and dumps state changes.
d2d45d
 .BR devlink-dev (8),
d2d45d
 .BR devlink-sb (8),
d2d45d
 .BR devlink-port (8),
d2d45d
+.BR devlink-health (8),
d2d45d
 .br
d2d45d
 
d2d45d
 .SH AUTHOR
d2d45d
-- 
d2d45d
2.26.2
d2d45d