+ if (session_index != ~0)
+ {
+ session = session_get_if_valid (session_index, thread_index);
+ if (!session)
+ return clib_error_return (0, "no session %d on thread %d",
+ session_index, thread_index);
+ clear_session (session);
+ }
+
+ if (clear_all)
+ {
+ /* *INDENT-OFF* */
+ vec_foreach (wrk, smm->wrk)
+ {
+ pool_foreach(session, wrk->sessions, ({
+ clear_session (session);
+ }));
+ };
+ /* *INDENT-ON* */
+ }
+
+ return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (clear_session_command, static) =
+{
+ .path = "clear session",
+ .short_help = "clear session thread <thread> session <index>",
+ .function = clear_session_command_fn,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+show_session_fifo_trace_command_fn (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ stream_session_t *s = 0;
+ u8 is_rx = 0, *str = 0;
+
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "%U", unformat_stream_session, &s))
+ ;
+ else if (unformat (input, "rx"))
+ is_rx = 1;
+ else if (unformat (input, "tx"))
+ is_rx = 0;
+ else
+ return clib_error_return (0, "unknown input `%U'",
+ format_unformat_error, input);
+ }
+
+ if (!SVM_FIFO_TRACE)
+ {
+ vlib_cli_output (vm, "fifo tracing not enabled");
+ return 0;
+ }
+
+ if (!s)
+ {
+ vlib_cli_output (vm, "could not find session");
+ return 0;
+ }
+
+ str = is_rx ?
+ svm_fifo_dump_trace (str, s->server_rx_fifo) :
+ svm_fifo_dump_trace (str, s->server_tx_fifo);