Skip to content

Commit fcd852c

Browse files
Eran Ben Elishadavem330
authored andcommitted
devlink: Add health recover command
Add devlink health recover command to the uapi, in order to allow the user to execute a recover operation over a specific reporter. Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com> Reviewed-by: Moshe Shemesh <moshe@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6f9d561 commit fcd852c

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

‎include/uapi/linux/devlink.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ enum devlink_command {
9191

9292
DEVLINK_CMD_HEALTH_REPORTER_GET,
9393
DEVLINK_CMD_HEALTH_REPORTER_SET,
94+
DEVLINK_CMD_HEALTH_REPORTER_RECOVER,
9495

9596
/* add new commands above here */
9697
__DEVLINK_CMD_MAX,

‎net/core/devlink.c‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4487,6 +4487,19 @@ devlink_nl_cmd_health_reporter_set_doit(struct sk_buff *skb,
44874487
return 0;
44884488
}
44894489

4490+
static int devlink_nl_cmd_health_reporter_recover_doit(struct sk_buff *skb,
4491+
struct genl_info *info)
4492+
{
4493+
struct devlink *devlink = info->user_ptr[0];
4494+
struct devlink_health_reporter *reporter;
4495+
4496+
reporter = devlink_health_reporter_get_from_info(devlink, info);
4497+
if (!reporter)
4498+
return -EINVAL;
4499+
4500+
return devlink_health_reporter_recover(reporter, NULL);
4501+
}
4502+
44904503
static const struct nla_policy devlink_nl_policy[DEVLINK_ATTR_MAX + 1] = {
44914504
[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING },
44924505
[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING },
@@ -4750,6 +4763,13 @@ static const struct genl_ops devlink_nl_ops[] = {
47504763
.flags = GENL_ADMIN_PERM,
47514764
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
47524765
},
4766+
{
4767+
.cmd = DEVLINK_CMD_HEALTH_REPORTER_RECOVER,
4768+
.doit = devlink_nl_cmd_health_reporter_recover_doit,
4769+
.policy = devlink_nl_policy,
4770+
.flags = GENL_ADMIN_PERM,
4771+
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
4772+
},
47534773
};
47544774

47554775
static struct genl_family devlink_nl_family __ro_after_init = {

0 commit comments

Comments
 (0)