{
vnet_dev_main_t *dm = &vnet_dev_main;
vnet_dev_format_args_t fa = {}, *a = &fa;
+ vnet_dev_t **devs = 0;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, "counters"))
fa.counters = 1;
- else if (unformat (input, "all"))
- fa.show_zero_counters = 1;
+ else if (unformat (input, "zero-counters"))
+ fa.show_zero_counters = fa.counters = 1;
else if (unformat (input, "debug"))
fa.debug = 1;
+ else if (unformat (input, "%U", unformat_vnet_dev_vector, &devs))
+ ;
else
return clib_error_return (0, "unknown input `%U'",
format_unformat_error, input);
}
- pool_foreach_pointer (dev, dm->devices)
+ if (vec_len (devs) == 0)
+ pool_foreach_pointer (dev, dm->devices)
+ vec_add1 (devs, dev);
+
+ vec_foreach_pointer (dev, devs)
{
vlib_cli_output (vm, "device '%s':", dev->device_id);
vlib_cli_output (vm, " %U", format_vnet_dev_info, a, dev);
VLIB_CLI_COMMAND (show_devices_cmd, static) = {
.path = "show device",
- .short_help = "show device [counters] [zero-counters] [debug]",
+ .short_help =
+ "show device [counters] [zero-counters] [debug] [<device-id> ...]",
.function = show_devices_cmd_fn,
.is_mp_safe = 1,
};
format_function_t format_vnet_dev_rx_queue_info;
format_function_t format_vnet_dev_tx_queue_info;
format_function_t format_vnet_dev_flow;
+unformat_function_t unformat_vnet_dev_vector;
unformat_function_t unformat_vnet_dev_flags;
unformat_function_t unformat_vnet_dev_port_flags;
unformat_function_t unformat_vnet_dev_rss_key;
k->length = len;
return 1;
}
+uword
+unformat_vnet_dev_vector (unformat_input_t *in, va_list *args)
+{
+ vnet_dev_t *dev, ***devs = va_arg (*args, vnet_dev_t ***);
+ u8 *s = 0;
+ uword rv = 0;
+
+ while (unformat (in, "%s", &s))
+ {
+ dev = vnet_dev_by_id ((char *) s);
+ if (!dev)
+ break;
+
+ vec_add1 (*devs, dev);
+ vec_reset_length (s);
+ rv++;
+ }
+
+ vec_free (s);
+ return rv;
+}