Lines Matching refs:rd
14 static int dev_help(struct rd *rd) in dev_help() argument
16 pr_out("Usage: %s dev show [DEV]\n", rd->filename); in dev_help()
69 static void dev_print_caps(struct rd *rd, struct nlattr **tb) in dev_print_caps() argument
79 if (rd->json_output) { in dev_print_caps()
80 jsonw_name(rd->jw, "caps"); in dev_print_caps()
81 jsonw_start_array(rd->jw); in dev_print_caps()
87 if (rd->json_output) { in dev_print_caps()
88 jsonw_string(rd->jw, dev_caps_to_str(idx)); in dev_print_caps()
98 if (rd->json_output) in dev_print_caps()
99 jsonw_end_array(rd->jw); in dev_print_caps()
104 static void dev_print_fw(struct rd *rd, struct nlattr **tb) in dev_print_fw() argument
111 if (rd->json_output) in dev_print_fw()
112 jsonw_string_field(rd->jw, "fw", str); in dev_print_fw()
117 static void dev_print_node_guid(struct rd *rd, struct nlattr **tb) in dev_print_node_guid() argument
129 if (rd->json_output) in dev_print_node_guid()
130 jsonw_string_field(rd->jw, "node_guid", str); in dev_print_node_guid()
135 static void dev_print_sys_image_guid(struct rd *rd, struct nlattr **tb) in dev_print_sys_image_guid() argument
147 if (rd->json_output) in dev_print_sys_image_guid()
148 jsonw_string_field(rd->jw, "sys_image_guid", str); in dev_print_sys_image_guid()
164 static void dev_print_node_type(struct rd *rd, struct nlattr **tb) in dev_print_node_type() argument
174 if (rd->json_output) in dev_print_node_type()
175 jsonw_string_field(rd->jw, "node_type", node_str); in dev_print_node_type()
183 struct rd *rd = data; in dev_parse_cb() local
193 if (rd->json_output) { in dev_parse_cb()
194 jsonw_uint_field(rd->jw, "ifindex", idx); in dev_parse_cb()
195 jsonw_string_field(rd->jw, "ifname", name); in dev_parse_cb()
200 dev_print_node_type(rd, tb); in dev_parse_cb()
201 dev_print_fw(rd, tb); in dev_parse_cb()
202 dev_print_node_guid(rd, tb); in dev_parse_cb()
203 dev_print_sys_image_guid(rd, tb); in dev_parse_cb()
204 if (rd->show_details) in dev_parse_cb()
205 dev_print_caps(rd, tb); in dev_parse_cb()
207 if (!rd->json_output) in dev_parse_cb()
212 static int dev_no_args(struct rd *rd) in dev_no_args() argument
217 rd_prepare_msg(rd, RDMA_NLDEV_CMD_GET, in dev_no_args()
219 mnl_attr_put_u32(rd->nlh, RDMA_NLDEV_ATTR_DEV_INDEX, rd->dev_idx); in dev_no_args()
220 ret = rd_send_msg(rd); in dev_no_args()
224 if (rd->json_output) in dev_no_args()
225 jsonw_start_object(rd->jw); in dev_no_args()
226 ret = rd_recv_msg(rd, dev_parse_cb, rd, seq); in dev_no_args()
227 if (rd->json_output) in dev_no_args()
228 jsonw_end_object(rd->jw); in dev_no_args()
232 static int dev_one_show(struct rd *rd) in dev_one_show() argument
239 return rd_exec_cmd(rd, cmds, "parameter"); in dev_one_show()
242 static int dev_show(struct rd *rd) in dev_show() argument
247 if (rd->json_output) in dev_show()
248 jsonw_start_array(rd->jw); in dev_show()
249 if (rd_no_arg(rd)) { in dev_show()
250 list_for_each_entry(dev_map, &rd->dev_map_list, list) { in dev_show()
251 rd->dev_idx = dev_map->idx; in dev_show()
252 ret = dev_one_show(rd); in dev_show()
257 dev_map = dev_map_lookup(rd, false); in dev_show()
263 rd_arg_inc(rd); in dev_show()
264 rd->dev_idx = dev_map->idx; in dev_show()
265 ret = dev_one_show(rd); in dev_show()
268 if (rd->json_output) in dev_show()
269 jsonw_end_array(rd->jw); in dev_show()
273 int cmd_dev(struct rd *rd) in cmd_dev() argument
283 return rd_exec_cmd(rd, cmds, "dev command"); in cmd_dev()