Skip to content

Commit 0149bca

Browse files
Jiri Pirkokuba-moo
authored andcommitted
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: Jiri Pirko <[email protected]> Acked-by: Jakub Kicinski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent b03f13c commit 0149bca

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

Documentation/netlink/specs/devlink.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ operations:
516516
attributes: *health-reporter-id-attrs
517517
dump:
518518
request:
519-
attributes: *dev-id-attrs
519+
attributes: *port-id-attrs
520520
reply: *health-reporter-get-reply
521521

522522
# TODO: fill in the operations in between

net/devlink/netlink_gen.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,10 @@ static const struct nla_policy devlink_health_reporter_get_do_nl_policy[DEVLINK_
129129
};
130130

131131
/* DEVLINK_CMD_HEALTH_REPORTER_GET - dump */
132-
static const struct nla_policy devlink_health_reporter_get_dump_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = {
132+
static const struct nla_policy devlink_health_reporter_get_dump_nl_policy[DEVLINK_ATTR_PORT_INDEX + 1] = {
133133
[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
134134
[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
135+
[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
135136
};
136137

137138
/* DEVLINK_CMD_TRAP_GET - do */
@@ -373,7 +374,7 @@ const struct genl_split_ops devlink_nl_ops[32] = {
373374
.cmd = DEVLINK_CMD_HEALTH_REPORTER_GET,
374375
.dumpit = devlink_nl_health_reporter_get_dumpit,
375376
.policy = devlink_health_reporter_get_dump_nl_policy,
376-
.maxattr = DEVLINK_ATTR_DEV_NAME,
377+
.maxattr = DEVLINK_ATTR_PORT_INDEX,
377378
.flags = GENL_CMD_CAP_DUMP,
378379
},
379380
{

tools/net/ynl/generated/devlink-user.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2079,6 +2079,8 @@ devlink_health_reporter_get_dump(struct ynl_sock *ys,
20792079
mnl_attr_put_strz(nlh, DEVLINK_ATTR_BUS_NAME, req->bus_name);
20802080
if (req->_present.dev_name_len)
20812081
mnl_attr_put_strz(nlh, DEVLINK_ATTR_DEV_NAME, req->dev_name);
2082+
if (req->_present.port_index)
2083+
mnl_attr_put_u32(nlh, DEVLINK_ATTR_PORT_INDEX, req->port_index);
20822084

20832085
err = ynl_exec_dump(ys, nlh, &yds);
20842086
if (err < 0)

tools/net/ynl/generated/devlink-user.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,10 +1242,12 @@ struct devlink_health_reporter_get_req_dump {
12421242
struct {
12431243
__u32 bus_name_len;
12441244
__u32 dev_name_len;
1245+
__u32 port_index:1;
12451246
} _present;
12461247

12471248
char *bus_name;
12481249
char *dev_name;
1250+
__u32 port_index;
12491251
};
12501252

12511253
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
12761278
memcpy(req->dev_name, dev_name, req->_present.dev_name_len);
12771279
req->dev_name[req->_present.dev_name_len] = 0;
12781280
}
1281+
static inline void
1282+
devlink_health_reporter_get_req_dump_set_port_index(struct devlink_health_reporter_get_req_dump *req,
1283+
__u32 port_index)
1284+
{
1285+
req->_present.port_index = 1;
1286+
req->port_index = port_index;
1287+
}
12791288

12801289
struct devlink_health_reporter_get_list {
12811290
struct devlink_health_reporter_get_list *next;

0 commit comments

Comments
 (0)