l2: Separating scan-delay and learn-limit into a separate API from want_l2_macs_events
Type: feature
Signed-off-by: Jerome Tollet <jtollet@cisco.com>
Change-Id: I6de6dae7da4ec1001e2811975a9b67acfc1a148c
diff --git a/src/vnet/l2/l2_fib.c b/src/vnet/l2/l2_fib.c
index 82be6bc..4407cb5 100644
--- a/src/vnet/l2/l2_fib.c
+++ b/src/vnet/l2/l2_fib.c
@@ -845,6 +845,36 @@
};
/* *INDENT-ON* */
+static clib_error_t *
+l2fib_set_scan_delay (vlib_main_t *vm, unformat_input_t *input,
+ vlib_cli_command_t *cmd)
+{
+ clib_error_t *error = 0;
+ u32 scan_delay;
+ l2fib_main_t *fm = &l2fib_main;
+
+ if (!unformat (input, "%d", &scan_delay))
+ {
+ error = clib_error_return (0, "expecting delay but got `%U'",
+ format_unformat_error, input);
+ goto done;
+ }
+ fm->event_scan_delay = (f64) (scan_delay) *10e-3;
+ l2fib_flush_all_mac (vlib_get_main ());
+done:
+ return error;
+}
+
+/*?
+ * This command set scan delay (in 1/10s unit)
+ *
+?*/
+VLIB_CLI_COMMAND (l2fib_set_scan_delay_cli, static) = {
+ .path = "set l2fib scan-delay",
+ .short_help = "set l2fib scan-delay <delay>",
+ .function = l2fib_set_scan_delay,
+};
+
/**
Kick off ager to scan MACs to age/delete MAC entries
*/