aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEran Ben Elisha <eranbe@mellanox.com>2020-04-14 09:57:52 +0300
committerDavid Ahern <dsahern@gmail.com>2020-04-19 22:27:13 +0000
commit4aa0c9c9f8dbd40317ef34db11726d50e5fa8440 (patch)
tree37df94974ee5266e4ccfeaebf628949caf1f7e03
parent59ba1dd01175f8beff964d4e634e7612dc83bb59 (diff)
downloadiproute2-4aa0c9c9f8dbd40317ef34db11726d50e5fa8440.tar.gz
devlink: Add devlink health auto_dump command support
Add support for configuring auto_dump attribute per reporter. With this attribute, one can indicate whether the devlink kernel core should execute automatic dump on error. The change will be reflected in show, set and man commands. Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com> Reviewed-by: Aya Levin <ayal@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
-rw-r--r--devlink/devlink.c19
-rw-r--r--man/man8/devlink-health.811
2 files changed, 27 insertions, 3 deletions
diff --git a/devlink/devlink.c b/devlink/devlink.c
index f67fe6dd8..816b5de94 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -292,6 +292,7 @@ static void ifname_map_free(struct ifname_map *ifname_map)
#define DL_OPT_TRAP_POLICER_ID BIT(34)
#define DL_OPT_TRAP_POLICER_RATE BIT(35)
#define DL_OPT_TRAP_POLICER_BURST BIT(36)
+#define DL_OPT_HEALTH_REPORTER_AUTO_DUMP BIT(37)
struct dl_opts {
uint64_t present; /* flags of present items */
@@ -328,6 +329,7 @@ struct dl_opts {
const char *reporter_name;
uint64_t reporter_graceful_period;
bool reporter_auto_recover;
+ bool reporter_auto_dump;
const char *trap_name;
const char *trap_group_name;
enum devlink_trap_action trap_action;
@@ -1474,6 +1476,13 @@ static int dl_argv_parse(struct dl *dl, uint64_t o_required,
if (err)
return err;
o_found |= DL_OPT_HEALTH_REPORTER_AUTO_RECOVER;
+ } else if (dl_argv_match(dl, "auto_dump") &&
+ (o_all & DL_OPT_HEALTH_REPORTER_AUTO_DUMP)) {
+ dl_arg_inc(dl);
+ err = dl_argv_bool(dl, &opts->reporter_auto_dump);
+ if (err)
+ return err;
+ o_found |= DL_OPT_HEALTH_REPORTER_AUTO_DUMP;
} else if (dl_argv_match(dl, "trap") &&
(o_all & DL_OPT_TRAP_NAME)) {
dl_arg_inc(dl);
@@ -1656,6 +1665,9 @@ static void dl_opts_put(struct nlmsghdr *nlh, struct dl *dl)
if (opts->present & DL_OPT_HEALTH_REPORTER_AUTO_RECOVER)
mnl_attr_put_u8(nlh, DEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER,
opts->reporter_auto_recover);
+ if (opts->present & DL_OPT_HEALTH_REPORTER_AUTO_DUMP)
+ mnl_attr_put_u8(nlh, DEVLINK_ATTR_HEALTH_REPORTER_AUTO_DUMP,
+ opts->reporter_auto_dump);
if (opts->present & DL_OPT_TRAP_NAME)
mnl_attr_put_strz(nlh, DEVLINK_ATTR_TRAP_NAME,
opts->trap_name);
@@ -6505,7 +6517,8 @@ static int cmd_health_set_params(struct dl *dl)
NLM_F_REQUEST | NLM_F_ACK);
err = dl_argv_parse(dl, DL_OPT_HANDLE | DL_OPT_HEALTH_REPORTER_NAME,
DL_OPT_HEALTH_REPORTER_GRACEFUL_PERIOD |
- DL_OPT_HEALTH_REPORTER_AUTO_RECOVER);
+ DL_OPT_HEALTH_REPORTER_AUTO_RECOVER |
+ DL_OPT_HEALTH_REPORTER_AUTO_DUMP);
if (err)
return err;
@@ -6919,6 +6932,9 @@ static void pr_out_health(struct dl *dl, struct nlattr **tb_health)
if (tb[DEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER])
print_bool(PRINT_ANY, "auto_recover", " auto_recover %s",
mnl_attr_get_u8(tb[DEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER]));
+ if (tb[DEVLINK_ATTR_HEALTH_REPORTER_AUTO_DUMP])
+ print_bool(PRINT_ANY, "auto_dump", " auto_dump %s",
+ mnl_attr_get_u8(tb[DEVLINK_ATTR_HEALTH_REPORTER_AUTO_DUMP]));
__pr_out_indent_dec();
pr_out_handle_end(dl);
@@ -6975,6 +6991,7 @@ static void cmd_health_help(void)
pr_err(" devlink health set DEV reporter REPORTER_NAME\n");
pr_err(" [ grace_period MSEC ]\n");
pr_err(" [ auto_recover { true | false } ]\n");
+ pr_err(" [ auto_dump { true | false } ]\n");
}
static int cmd_health(struct dl *dl)
diff --git a/man/man8/devlink-health.8 b/man/man8/devlink-health.8
index 70a86cf0a..8a3c77be7 100644
--- a/man/man8/devlink-health.8
+++ b/man/man8/devlink-health.8
@@ -58,6 +58,9 @@ devlink-health \- devlink health reporting and recovery
.RI "[ "
.BR auto_recover " { " true " | " false " } "
.RI "]"
+.RI "[ "
+.BR auto_dump " { " true " | " false " } "
+.RI "]"
.ti -8
.B devlink health help
@@ -131,8 +134,8 @@ the next "devlink health dump show" command.
- specifies the reporter's name registered on the devlink device.
.SS devlink health set - Configure health reporter.
-Please note that this command is not supported on a reporter which
-doesn't support a recovery method.
+Please note that some params are not supported on a reporter which
+doesn't support a recovery or dump method.
.PP
.I "DEV"
@@ -150,6 +153,10 @@ Time interval between consecutive auto recoveries.
.BR auto_recover " { " true " | " false " } "
Indicates whether the devlink should execute automatic recover on error.
+.TP
+.BR auto_dump " { " true " | " false " } "
+Indicates whether the devlink should execute automatic dump on error.
+
.SH "EXAMPLES"
.PP
devlink health show