1 // SPDX-License-Identifier: GPL-2.0
7 #include "devlink-user.h"
9 int main(int argc
, char **argv
)
11 struct devlink_get_list
*devs
;
14 ys
= ynl_sock_create(&ynl_devlink_family
, NULL
);
18 devs
= devlink_get_dump(ys
);
22 ynl_dump_foreach(devs
, d
) {
23 struct devlink_info_get_req
*info_req
;
24 struct devlink_info_get_rsp
*info_rsp
;
26 printf("%s/%s:\n", d
->bus_name
, d
->dev_name
);
28 info_req
= devlink_info_get_req_alloc();
29 devlink_info_get_req_set_bus_name(info_req
, d
->bus_name
);
30 devlink_info_get_req_set_dev_name(info_req
, d
->dev_name
);
32 info_rsp
= devlink_info_get(ys
, info_req
);
33 devlink_info_get_req_free(info_req
);
37 if (info_rsp
->_present
.info_driver_name_len
)
38 printf(" driver: %s\n", info_rsp
->info_driver_name
);
39 if (info_rsp
->n_info_version_running
)
40 printf(" running fw:\n");
41 for (unsigned i
= 0; i
< info_rsp
->n_info_version_running
; i
++)
43 info_rsp
->info_version_running
[i
].info_version_name
,
44 info_rsp
->info_version_running
[i
].info_version_value
);
46 devlink_info_get_rsp_free(info_rsp
);
48 devlink_get_list_free(devs
);
55 devlink_get_list_free(devs
);
57 fprintf(stderr
, "YNL: %s\n", ys
->err
.msg
);