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