X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Finterface_cli.c;h=c62a9858e8cc41cc98ba7647a4943c2b3e043bf8;hb=refs%2Fchanges%2F07%2F28107%2F1;hp=9de674a10fa13445c9ac2b8b69a9cf4640ab356a;hpb=9485d99bd3941b13abf7e47fc7e1d56f7b4fee55;p=vpp.git diff --git a/src/vnet/interface_cli.c b/src/vnet/interface_cli.c index 9de674a10fa..c62a9858e8c 100644 --- a/src/vnet/interface_cli.c +++ b/src/vnet/interface_cli.c @@ -52,6 +52,7 @@ #include #include #include +#include static int compare_interface_names (void *a1, void *a2) @@ -65,16 +66,15 @@ compare_interface_names (void *a1, void *a2) static clib_error_t * show_or_clear_hw_interfaces (vlib_main_t * vm, unformat_input_t * input, - vlib_cli_command_t * cmd) + vlib_cli_command_t * cmd, int is_show) { clib_error_t *error = 0; vnet_main_t *vnm = vnet_get_main (); vnet_interface_main_t *im = &vnm->interface_main; vnet_hw_interface_t *hi; u32 hw_if_index, *hw_if_indices = 0; - int i, verbose = -1, is_show, show_bond = 0; + int i, verbose = -1, show_bond = 0; - is_show = strstr (cmd->path, "show") != 0; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { /* See if user wants to show a specific interface. */ @@ -168,6 +168,21 @@ done: return error; } +static clib_error_t * +show_hw_interfaces (vlib_main_t * vm, + unformat_input_t * input, vlib_cli_command_t * cmd) +{ + return show_or_clear_hw_interfaces (vm, input, cmd, 1 /* is_show */ ); +} + +static clib_error_t * +clear_hw_interfaces (vlib_main_t * vm, + unformat_input_t * input, vlib_cli_command_t * cmd) +{ + return show_or_clear_hw_interfaces (vm, input, cmd, 0 /* is_show */ ); +} + + /*? * Display more detailed information about all or a list of given interfaces. * The verboseness of the output can be controlled by the following optional @@ -229,7 +244,7 @@ VLIB_CLI_COMMAND (show_hw_interfaces_command, static) = { .path = "show hardware-interfaces", .short_help = "show hardware-interfaces [brief|verbose|detail] [bond] " "[ [ [..]]] [ [ [..]]]", - .function = show_or_clear_hw_interfaces, + .function = show_hw_interfaces, }; /* *INDENT-ON* */ @@ -250,7 +265,7 @@ VLIB_CLI_COMMAND (clear_hw_interface_counters_command, static) = { .path = "clear hardware-interfaces", .short_help = "clear hardware-interfaces " "[ [ [..]]] [ [ [..]]]", - .function = show_or_clear_hw_interfaces, + .function = clear_hw_interfaces, }; /* *INDENT-ON* */ @@ -781,9 +796,6 @@ create_sub_interfaces (vlib_main_t * vm, continue; } - kp = clib_mem_alloc (sizeof (*kp)); - *kp = sup_and_sub_key; - template.type = VNET_SW_INTERFACE_TYPE_SUB; template.flood_class = VNET_FLOOD_CLASS_NORMAL; template.sup_sw_if_index = hi->sw_if_index; @@ -795,6 +807,9 @@ create_sub_interfaces (vlib_main_t * vm, if (error) goto done; + kp = clib_mem_alloc (sizeof (*kp)); + *kp = sup_and_sub_key; + hash_set (hi->sub_interface_sw_if_index_by_id, id, sw_if_index); hash_set_mem (im->sw_if_index_by_sup_and_sub, kp, sw_if_index); vlib_cli_output (vm, "%U\n", format_vnet_sw_if_index_name, @@ -1953,7 +1968,7 @@ vnet_pcap_dispatch_trace_configure (vnet_pcap_dispatch_trace_args_t * a) /* Classify filter specified, but no classify filter configured */ if ((a->rx_enable + a->tx_enable + a->drop_enable) && a->filter && - (set->table_indices[0] == ~0)) + (set->table_indices == 0 || set->table_indices[0] == ~0)) return VNET_API_ERROR_NO_SUCH_LABEL; if (a->rx_enable + a->tx_enable + a->drop_enable) @@ -2045,7 +2060,7 @@ pcap_trace_command_fn (vlib_main_t * vm, int drop_enable = 0; int status = 0; int filter = 0; - u32 sw_if_index = ~0; + u32 sw_if_index = 0; /* default: any interface */ /* Get a line of input. */ if (!unformat_user (input, unformat_line_input, line_input))