Commit 759f6610 authored by Jiri Pirko's avatar Jiri Pirko Committed by Jakub Kicinski

netlink: specs: devlink: add info-get dump op

Add missing dump op for info-get command and re-generate related
devlink-user.[ch] code.
Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/20230803111340.1074067-10-jiri@resnulli.usSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 8300dce5
...@@ -194,7 +194,7 @@ operations: ...@@ -194,7 +194,7 @@ operations:
request: request:
value: 51 value: 51
attributes: *dev-id-attrs attributes: *dev-id-attrs
reply: reply: &info-get-reply
value: 51 value: 51
attributes: attributes:
- bus-name - bus-name
...@@ -204,3 +204,5 @@ operations: ...@@ -204,3 +204,5 @@ operations:
- info-version-fixed - info-version-fixed
- info-version-running - info-version-running
- info-version-stored - info-version-stored
dump:
reply: *info-get-reply
...@@ -716,6 +716,59 @@ devlink_info_get(struct ynl_sock *ys, struct devlink_info_get_req *req) ...@@ -716,6 +716,59 @@ devlink_info_get(struct ynl_sock *ys, struct devlink_info_get_req *req)
return NULL; return NULL;
} }
/* DEVLINK_CMD_INFO_GET - dump */
void devlink_info_get_list_free(struct devlink_info_get_list *rsp)
{
struct devlink_info_get_list *next = rsp;
while ((void *)next != YNL_LIST_END) {
unsigned int i;
rsp = next;
next = rsp->next;
free(rsp->obj.bus_name);
free(rsp->obj.dev_name);
free(rsp->obj.info_driver_name);
free(rsp->obj.info_serial_number);
for (i = 0; i < rsp->obj.n_info_version_fixed; i++)
devlink_dl_info_version_free(&rsp->obj.info_version_fixed[i]);
free(rsp->obj.info_version_fixed);
for (i = 0; i < rsp->obj.n_info_version_running; i++)
devlink_dl_info_version_free(&rsp->obj.info_version_running[i]);
free(rsp->obj.info_version_running);
for (i = 0; i < rsp->obj.n_info_version_stored; i++)
devlink_dl_info_version_free(&rsp->obj.info_version_stored[i]);
free(rsp->obj.info_version_stored);
free(rsp);
}
}
struct devlink_info_get_list *devlink_info_get_dump(struct ynl_sock *ys)
{
struct ynl_dump_state yds = {};
struct nlmsghdr *nlh;
int err;
yds.ys = ys;
yds.alloc_sz = sizeof(struct devlink_info_get_list);
yds.cb = devlink_info_get_rsp_parse;
yds.rsp_cmd = DEVLINK_CMD_INFO_GET;
yds.rsp_policy = &devlink_nest;
nlh = ynl_gemsg_start_dump(ys, ys->family_id, DEVLINK_CMD_INFO_GET, 1);
err = ynl_exec_dump(ys, nlh, &yds);
if (err < 0)
goto free_list;
return yds.first;
free_list:
devlink_info_get_list_free(yds.first);
return NULL;
}
const struct ynl_family ynl_devlink_family = { const struct ynl_family ynl_devlink_family = {
.name = "devlink", .name = "devlink",
}; };
...@@ -207,4 +207,14 @@ void devlink_info_get_rsp_free(struct devlink_info_get_rsp *rsp); ...@@ -207,4 +207,14 @@ void devlink_info_get_rsp_free(struct devlink_info_get_rsp *rsp);
struct devlink_info_get_rsp * struct devlink_info_get_rsp *
devlink_info_get(struct ynl_sock *ys, struct devlink_info_get_req *req); devlink_info_get(struct ynl_sock *ys, struct devlink_info_get_req *req);
/* DEVLINK_CMD_INFO_GET - dump */
struct devlink_info_get_list {
struct devlink_info_get_list *next;
struct devlink_info_get_rsp obj __attribute__ ((aligned (8)));
};
void devlink_info_get_list_free(struct devlink_info_get_list *rsp);
struct devlink_info_get_list *devlink_info_get_dump(struct ynl_sock *ys);
#endif /* _LINUX_DEVLINK_GEN_H */ #endif /* _LINUX_DEVLINK_GEN_H */
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