summaryrefslogtreecommitdiffstats
path: root/src/vnet/interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/interface.c')
-rw-r--r--src/vnet/interface.c66
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
*