aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vnet/lisp-cp/control.c23
-rw-r--r--src/vnet/lisp-cp/control.h6
-rw-r--r--src/vnet/lisp-cp/one.api55
-rw-r--r--src/vnet/lisp-cp/one_api.c35
-rw-r--r--src/vnet/lisp-cp/one_cli.c56
5 files changed, 175 insertions, 0 deletions
diff --git a/src/vnet/lisp-cp/control.c b/src/vnet/lisp-cp/control.c
index ac11d890618..c7853ca73fb 100644
--- a/src/vnet/lisp-cp/control.c
+++ b/src/vnet/lisp-cp/control.c
@@ -3801,6 +3801,29 @@ send_map_resolver_service (vlib_main_t * vm,
return 0;
}
+vnet_api_error_t
+vnet_lisp_stats_enable_disable (u8 enable)
+{
+ lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+
+ if (vnet_lisp_enable_disable_status () == 0)
+ return VNET_API_ERROR_LISP_DISABLED;
+
+ lcm->stats_enabled = enable;
+ return 0;
+}
+
+u8
+vnet_lisp_stats_enable_disable_state (void)
+{
+ lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+
+ if (vnet_lisp_enable_disable_status () == 0)
+ return VNET_API_ERROR_LISP_DISABLED;
+
+ return lcm->stats_enabled;
+}
+
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (lisp_retry_service_node,static) = {
.function = send_map_resolver_service,
diff --git a/src/vnet/lisp-cp/control.h b/src/vnet/lisp-cp/control.h
index 14f3baec150..933b34b66bc 100644
--- a/src/vnet/lisp-cp/control.h
+++ b/src/vnet/lisp-cp/control.h
@@ -210,6 +210,9 @@ typedef struct
/* timing wheel for mappping timeouts */
timing_wheel_t wheel;
+ /* statistics */
+ u8 stats_enabled;
+
/* commodity */
ip4_main_t *im4;
ip6_main_t *im6;
@@ -332,6 +335,9 @@ lisp_get_petr_mapping (lisp_cp_main_t * lcm)
return pool_elt_at_index (lcm->mapping_pool, lcm->petr_map_index);
}
+u8 vnet_lisp_stats_enable_disable_state (void);
+vnet_api_error_t vnet_lisp_stats_enable_disable (u8 enable);
+
#endif /* VNET_CONTROL_H_ */
/*
diff --git a/src/vnet/lisp-cp/one.api b/src/vnet/lisp-cp/one.api
index 14f6d47fd15..436c8089ade 100644
--- a/src/vnet/lisp-cp/one.api
+++ b/src/vnet/lisp-cp/one.api
@@ -877,3 +877,58 @@ define show_one_pitr_reply
u8 status;
u8 locator_set_name[64];
};
+
+define one_stats_dump
+{
+ u32 client_index;
+ u32 context;
+};
+
+define one_stats_details
+{
+ u32 context;
+ u32 vni;
+ u8 eid_type;
+ u8 deid[16];
+ u8 seid[16];
+ u8 deid_pref_len;
+ u8 seid_pref_len;
+ u8 is_ip4;
+ u8 rloc[16];
+ u8 lloc[16];
+
+ u32 pkt_count;
+ u32 bytes;
+};
+
+define one_stats_enable_disable
+{
+ u32 client_index;
+ u32 context;
+ u8 is_en;
+};
+
+define one_stats_enable_disable_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+define show_one_stats_enable_disable
+{
+ u32 client_index;
+ u32 context;
+};
+
+define show_one_stats_enable_disable_reply
+{
+ u32 context;
+ i32 retval;
+ u8 is_en;
+};
+
+/*
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/lisp-cp/one_api.c b/src/vnet/lisp-cp/one_api.c
index d0a9309b368..ff00bf5bfce 100644
--- a/src/vnet/lisp-cp/one_api.c
+++ b/src/vnet/lisp-cp/one_api.c
@@ -90,6 +90,10 @@ _(SHOW_ONE_PITR, show_one_pitr) \
_(SHOW_ONE_MAP_REQUEST_MODE, show_one_map_request_mode) \
_(ONE_USE_PETR, one_use_petr) \
_(SHOW_ONE_USE_PETR, show_one_use_petr) \
+_(SHOW_ONE_STATS_ENABLE_DISABLE, show_one_stats_enable_disable) \
+_(ONE_STATS_ENABLE_DISABLE, one_stats_enable_disable) \
+_(ONE_STATS_DUMP, one_stats_dump) \
+
static locator_t *
unformat_one_locs (vl_api_one_remote_locator_t * rmt_locs, u32 rloc_num)
@@ -1256,6 +1260,37 @@ vl_api_show_one_pitr_t_handler (vl_api_show_one_pitr_t * mp)
/* *INDENT-ON* */
}
+static void
+ vl_api_show_one_stats_enable_disable_t_handler
+ (vl_api_show_one_stats_enable_disable_t * mp)
+{
+ vl_api_show_one_stats_enable_disable_reply_t *rmp = NULL;
+ vnet_api_error_t rv = 0;
+
+ /* *INDENT-OFF* */
+ REPLY_MACRO2 (VL_API_SHOW_ONE_STATS_ENABLE_DISABLE_REPLY,
+ ({
+ rmp->is_en = vnet_lisp_stats_enable_disable_state ();
+ }));
+ /* *INDENT-ON* */
+}
+
+static void
+ vl_api_one_stats_enable_disable_t_handler
+ (vl_api_one_stats_enable_disable_t * mp)
+{
+ vl_api_one_enable_disable_reply_t *rmp = NULL;
+
+ vnet_api_error_t rv = vnet_lisp_stats_enable_disable (mp->is_en);
+ REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
+}
+
+static void
+vl_api_one_stats_dump_t_handler (vl_api_one_stats_dump_t * mp)
+{
+
+}
+
/*
* one_api_hookup
* Add vpe's API message handlers to the table.
diff --git a/src/vnet/lisp-cp/one_cli.c b/src/vnet/lisp-cp/one_cli.c
index 05821306a66..2ceeaf42fa7 100644
--- a/src/vnet/lisp-cp/one_cli.c
+++ b/src/vnet/lisp-cp/one_cli.c
@@ -1642,6 +1642,62 @@ VLIB_CLI_COMMAND (one_show_rloc_probe_state_command) = {
};
/* *INDENT-ON* */
+static clib_error_t *
+lisp_show_stats_command_fn (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ u8 is_enabled = vnet_lisp_stats_enable_disable_state ();
+ vlib_cli_output (vm, "%s\n", is_enabled ? "enabled" : "disabled");
+ return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_show_stats_command) = {
+ .path = "show one stats",
+ .short_help = "show ONE statistics",
+ .function = lisp_show_stats_command_fn,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+lisp_stats_enable_disable_command_fn (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ unformat_input_t _line_input, *line_input = &_line_input;
+ u8 enable = 0;
+
+ /* Get a line of input. */
+ if (!unformat_user (input, unformat_line_input, line_input))
+ return 0;
+
+ while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (line_input, "enable"))
+ enable = 1;
+ else if (unformat (line_input, "disable"))
+ enable = 0;
+ else
+ {
+ clib_warning ("Error: expected enable/disable!");
+ goto done;
+ }
+ }
+ vnet_lisp_stats_enable_disable (enable);
+done:
+ unformat_free (line_input);
+ return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_stats_enable_disable_command) = {
+ .path = "one stats",
+ .short_help = "enable/disable ONE statistics collecting",
+ .function = lisp_stats_enable_disable_command_fn,
+};
+/* *INDENT-ON* */
+
/*
* fd.io coding-style-patch-verification: ON
*