aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoshe Shemesh <moshe@mellanox.com>2020-02-04 23:37:02 +0200
committerDavid Ahern <dsahern@gmail.com>2020-02-10 05:29:24 +0000
commit5023df6a21c73560b514d7fde5381d140373afe9 (patch)
tree2ad00983603910e27381060d9eeba48270cf5166
parent8e66c8c112e4a241d205780af917f36ee4bbad38 (diff)
downloadiproute2-5023df6a21c73560b514d7fde5381d140373afe9.tar.gz
devlink: Add health error recovery status monitoring
Add support for devlink health error recovery status monitoring. Update devlink-monitor man page accordingly. Signed-off-by: Moshe Shemesh <moshe@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
-rw-r--r--devlink/devlink.c15
-rw-r--r--man/man8/devlink-monitor.83
2 files changed, 16 insertions, 2 deletions
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 73ce98654..f48ff6c2d 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -4128,6 +4128,7 @@ static const char *cmd_name(uint8_t cmd)
case DEVLINK_CMD_FLASH_UPDATE: return "begin";
case DEVLINK_CMD_FLASH_UPDATE_END: return "end";
case DEVLINK_CMD_FLASH_UPDATE_STATUS: return "status";
+ case DEVLINK_CMD_HEALTH_REPORTER_RECOVER: return "status";
case DEVLINK_CMD_TRAP_GET: return "get";
case DEVLINK_CMD_TRAP_SET: return "set";
case DEVLINK_CMD_TRAP_NEW: return "new";
@@ -4168,6 +4169,8 @@ static const char *cmd_obj(uint8_t cmd)
case DEVLINK_CMD_FLASH_UPDATE_END:
case DEVLINK_CMD_FLASH_UPDATE_STATUS:
return "flash";
+ case DEVLINK_CMD_HEALTH_REPORTER_RECOVER:
+ return "health";
case DEVLINK_CMD_TRAP_GET:
case DEVLINK_CMD_TRAP_SET:
case DEVLINK_CMD_TRAP_NEW:
@@ -4229,6 +4232,7 @@ static void pr_out_flash_update(struct dl *dl, struct nlattr **tb)
}
static void pr_out_region(struct dl *dl, struct nlattr **tb);
+static void pr_out_health(struct dl *dl, struct nlattr **tb_health);
static void pr_out_trap(struct dl *dl, struct nlattr **tb, bool array);
static void pr_out_trap_group(struct dl *dl, struct nlattr **tb, bool array);
@@ -4295,6 +4299,14 @@ static int cmd_mon_show_cb(const struct nlmsghdr *nlh, void *data)
pr_out_mon_header(genl->cmd);
pr_out_flash_update(dl, tb);
break;
+ case DEVLINK_CMD_HEALTH_REPORTER_RECOVER:
+ mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb);
+ if (!tb[DEVLINK_ATTR_BUS_NAME] || !tb[DEVLINK_ATTR_DEV_NAME] ||
+ !tb[DEVLINK_ATTR_HEALTH_REPORTER])
+ return MNL_CB_ERROR;
+ pr_out_mon_header(genl->cmd);
+ pr_out_health(dl, tb);
+ break;
case DEVLINK_CMD_TRAP_GET: /* fall through */
case DEVLINK_CMD_TRAP_SET: /* fall through */
case DEVLINK_CMD_TRAP_NEW: /* fall through */
@@ -4337,6 +4349,7 @@ static int cmd_mon_show(struct dl *dl)
if (strcmp(cur_obj, "all") != 0 &&
strcmp(cur_obj, "dev") != 0 &&
strcmp(cur_obj, "port") != 0 &&
+ strcmp(cur_obj, "health") != 0 &&
strcmp(cur_obj, "trap") != 0 &&
strcmp(cur_obj, "trap-group") != 0) {
pr_err("Unknown object \"%s\"\n", cur_obj);
@@ -4355,7 +4368,7 @@ static int cmd_mon_show(struct dl *dl)
static void cmd_mon_help(void)
{
pr_err("Usage: devlink monitor [ all | OBJECT-LIST ]\n"
- "where OBJECT-LIST := { dev | port | trap | trap-group }\n");
+ "where OBJECT-LIST := { dev | port | health | trap | trap-group }\n");
}
static int cmd_mon(struct dl *dl)
diff --git a/man/man8/devlink-monitor.8 b/man/man8/devlink-monitor.8
index fffab3a4c..a96d350f4 100644
--- a/man/man8/devlink-monitor.8
+++ b/man/man8/devlink-monitor.8
@@ -21,7 +21,7 @@ command is the first in the command line and then the object list.
.I OBJECT-LIST
is the list of object types that we want to monitor.
It may contain
-.BR dev ", " port ", " trap ", " trap-group .
+.BR dev ", " port ", " health ", " trap ", " trap-group .
.B devlink
opens Devlink Netlink socket, listens on it and dumps state changes.
@@ -31,6 +31,7 @@ opens Devlink Netlink socket, listens on it and dumps state changes.
.BR devlink-dev (8),
.BR devlink-sb (8),
.BR devlink-port (8),
+.BR devlink-health (8),
.BR devlink-trap (8),
.br