Commit 0149bca1 authored by Jiri Pirko's avatar Jiri Pirko Committed by Jakub Kicinski

netlink: specs: devlink: extend health reporter dump attributes by port index

Allow user to pass port index for health reporter dump request.

Re-generate the related code.
Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
Acked-by: default avatarJakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/20230811155714.1736405-14-jiri@resnulli.usSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent b03f13cb
...@@ -516,7 +516,7 @@ operations: ...@@ -516,7 +516,7 @@ operations:
attributes: *health-reporter-id-attrs attributes: *health-reporter-id-attrs
dump: dump:
request: request:
attributes: *dev-id-attrs attributes: *port-id-attrs
reply: *health-reporter-get-reply reply: *health-reporter-get-reply
# TODO: fill in the operations in between # TODO: fill in the operations in between
......
...@@ -129,9 +129,10 @@ static const struct nla_policy devlink_health_reporter_get_do_nl_policy[DEVLINK_ ...@@ -129,9 +129,10 @@ static const struct nla_policy devlink_health_reporter_get_do_nl_policy[DEVLINK_
}; };
/* DEVLINK_CMD_HEALTH_REPORTER_GET - dump */ /* DEVLINK_CMD_HEALTH_REPORTER_GET - dump */
static const struct nla_policy devlink_health_reporter_get_dump_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = { static const struct nla_policy devlink_health_reporter_get_dump_nl_policy[DEVLINK_ATTR_PORT_INDEX + 1] = {
[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, }, [DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, }, [DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
}; };
/* DEVLINK_CMD_TRAP_GET - do */ /* DEVLINK_CMD_TRAP_GET - do */
...@@ -373,7 +374,7 @@ const struct genl_split_ops devlink_nl_ops[32] = { ...@@ -373,7 +374,7 @@ const struct genl_split_ops devlink_nl_ops[32] = {
.cmd = DEVLINK_CMD_HEALTH_REPORTER_GET, .cmd = DEVLINK_CMD_HEALTH_REPORTER_GET,
.dumpit = devlink_nl_health_reporter_get_dumpit, .dumpit = devlink_nl_health_reporter_get_dumpit,
.policy = devlink_health_reporter_get_dump_nl_policy, .policy = devlink_health_reporter_get_dump_nl_policy,
.maxattr = DEVLINK_ATTR_DEV_NAME, .maxattr = DEVLINK_ATTR_PORT_INDEX,
.flags = GENL_CMD_CAP_DUMP, .flags = GENL_CMD_CAP_DUMP,
}, },
{ {
......
...@@ -2079,6 +2079,8 @@ devlink_health_reporter_get_dump(struct ynl_sock *ys, ...@@ -2079,6 +2079,8 @@ devlink_health_reporter_get_dump(struct ynl_sock *ys,
mnl_attr_put_strz(nlh, DEVLINK_ATTR_BUS_NAME, req->bus_name); mnl_attr_put_strz(nlh, DEVLINK_ATTR_BUS_NAME, req->bus_name);
if (req->_present.dev_name_len) if (req->_present.dev_name_len)
mnl_attr_put_strz(nlh, DEVLINK_ATTR_DEV_NAME, req->dev_name); mnl_attr_put_strz(nlh, DEVLINK_ATTR_DEV_NAME, req->dev_name);
if (req->_present.port_index)
mnl_attr_put_u32(nlh, DEVLINK_ATTR_PORT_INDEX, req->port_index);
err = ynl_exec_dump(ys, nlh, &yds); err = ynl_exec_dump(ys, nlh, &yds);
if (err < 0) if (err < 0)
......
...@@ -1242,10 +1242,12 @@ struct devlink_health_reporter_get_req_dump { ...@@ -1242,10 +1242,12 @@ struct devlink_health_reporter_get_req_dump {
struct { struct {
__u32 bus_name_len; __u32 bus_name_len;
__u32 dev_name_len; __u32 dev_name_len;
__u32 port_index:1;
} _present; } _present;
char *bus_name; char *bus_name;
char *dev_name; char *dev_name;
__u32 port_index;
}; };
static inline struct devlink_health_reporter_get_req_dump * static inline struct devlink_health_reporter_get_req_dump *
...@@ -1276,6 +1278,13 @@ devlink_health_reporter_get_req_dump_set_dev_name(struct devlink_health_reporter ...@@ -1276,6 +1278,13 @@ devlink_health_reporter_get_req_dump_set_dev_name(struct devlink_health_reporter
memcpy(req->dev_name, dev_name, req->_present.dev_name_len); memcpy(req->dev_name, dev_name, req->_present.dev_name_len);
req->dev_name[req->_present.dev_name_len] = 0; req->dev_name[req->_present.dev_name_len] = 0;
} }
static inline void
devlink_health_reporter_get_req_dump_set_port_index(struct devlink_health_reporter_get_req_dump *req,
__u32 port_index)
{
req->_present.port_index = 1;
req->port_index = port_index;
}
struct devlink_health_reporter_get_list { struct devlink_health_reporter_get_list {
struct devlink_health_reporter_get_list *next; struct devlink_health_reporter_get_list *next;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment