diff options
author | Neale Ranns <nranns@cisco.com> | 2018-03-16 16:26:21 -0700 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-03-19 15:56:23 +0000 |
commit | 6f4a6be8f222dd8caa94d19a7e4d87cb864ba7f4 (patch) | |
tree | cadc511a5926926133b3bbb4ca9c7b4239d3b2eb /src/vnet/interface.c | |
parent | 7b867a8e491357058d37838091ed67a2e77bce2c (diff) |
Interface Unicast, Multicast and Broadcast stats on the API
Change-Id: I7c75da358aff1bd0216a602a49f2909cef5d920d
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/interface.c')
-rw-r--r-- | src/vnet/interface.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/vnet/interface.c b/src/vnet/interface.c index 122ae065ad0..ba342d49c9e 100644 --- a/src/vnet/interface.c +++ b/src/vnet/interface.c @@ -1237,7 +1237,19 @@ vnet_interface_init (vlib_main_t * vm) vec_validate (im->combined_sw_if_counters, VNET_N_COMBINED_INTERFACE_COUNTER - 1); im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_RX].name = "rx"; + im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_RX_UNICAST].name = + "rx-unicast"; + im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_RX_MULTICAST].name = + "rx-multicast"; + im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_RX_BROADCAST].name = + "rx-broadcast"; im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_TX].name = "tx"; + im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_TX_UNICAST].name = + "tx-unicast"; + im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_TX_MULTICAST].name = + "tx-multicast"; + im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_TX_BROADCAST].name = + "tx-broadcast"; im->sw_if_counter_lock[0] = 0; @@ -1537,6 +1549,60 @@ default_update_adjacency (vnet_main_t * vnm, u32 sw_if_index, u32 ai) } } +int collect_detailed_interface_stats_flag = 0; + +void +collect_detailed_interface_stats_flag_set () +{ + collect_detailed_interface_stats_flag = 1; +} + +void +collect_detailed_interface_stats_flag_clear () +{ + collect_detailed_interface_stats_flag = 0; +} + +static clib_error_t * +collect_detailed_interface_stats_cli (vlib_main_t * vm, + unformat_input_t * input, + vlib_cli_command_t * cmd) +{ + unformat_input_t _line_input, *line_input = &_line_input; + clib_error_t *error = NULL; + + /* Get a line of input. */ + if (!unformat_user (input, unformat_line_input, line_input)) + return clib_error_return (0, "expected enable | disable"); + + while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (line_input, "enable") || unformat (line_input, "on")) + collect_detailed_interface_stats_flag_set (); + else if (unformat (line_input, "disable") + || unformat (line_input, "off")) + collect_detailed_interface_stats_flag_clear (); + else + { + error = clib_error_return (0, "unknown input `%U'", + format_unformat_error, line_input); + goto done; + } + } + +done: + unformat_free (line_input); + return error; +} + +/* *INDENT-OFF* */ +VLIB_CLI_COMMAND (collect_detailed_interface_stats_command, static) = { + .path = "interface collect detailed-stats", + .short_help = "interface collect detailed-stats <enable|disable>", + .function = collect_detailed_interface_stats_cli, +}; +/* *INDENT-ON* */ + /* * fd.io coding-style-patch-verification: ON * |