X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fsession%2Fsession_cli.c;h=563ee83c758394b82e70437e43513ef402322db0;hb=7357043d2abc8d3811362f256e7c9086e7b0d378;hp=aba1c610e183e9416702eeec293171c08b36d3ca;hpb=16d974ec59776f0103ad62d0d04dc57989eef7ed;p=vpp.git diff --git a/src/vnet/session/session_cli.c b/src/vnet/session/session_cli.c index aba1c610e18..563ee83c758 100644 --- a/src/vnet/session/session_cli.c +++ b/src/vnet/session/session_cli.c @@ -14,6 +14,7 @@ */ #include #include +#include u8 * format_session_fifos (u8 * s, va_list * args) @@ -113,13 +114,10 @@ format_session (u8 * s, va_list * args) if (verbose == 1) { - u8 post_accept = ss->session_state >= SESSION_STATE_ACCEPTING; - u8 hasf = post_accept - || session_transport_service_type (ss) == TRANSPORT_SERVICE_CL; u32 rxf, txf; - rxf = hasf ? svm_fifo_max_dequeue (ss->rx_fifo) : 0; - txf = hasf ? svm_fifo_max_dequeue (ss->tx_fifo) : 0; + rxf = ss->rx_fifo ? svm_fifo_max_dequeue (ss->rx_fifo) : 0; + txf = ss->tx_fifo ? svm_fifo_max_dequeue (ss->tx_fifo) : 0; str = format (0, "%-10u%-10u", rxf, txf); } @@ -372,7 +370,7 @@ session_cli_filter_check (session_t * s, session_state_t * states, check_transport: - if (tp != TRANSPORT_N_PROTO && session_get_transport_proto (s) != tp) + if (tp != TRANSPORT_PROTO_INVALID && session_get_transport_proto (s) != tp) return 0; return 1; @@ -398,7 +396,7 @@ session_cli_show_session_filter (vlib_main_t * vm, u32 thread_index, pool = wrk->sessions; - if (tp == TRANSPORT_N_PROTO && states == 0 && !verbose + if (tp == TRANSPORT_PROTO_INVALID && states == 0 && !verbose && (start == 0 && end == ~0)) { vlib_cli_output (vm, "Thread %d: %u sessions", thread_index, @@ -472,14 +470,6 @@ session_cli_show_events (vlib_main_t * vm, u32 thread_index) session_cli_show_events_thread (vm, thread_index); } -static void -session_cli_print_transport_protos (vlib_main_t * vm) -{ -#define _(sym, str, sstr) vlib_cli_output (vm, str); - foreach_transport_proto -#undef _ -} - static void session_cli_print_session_states (vlib_main_t * vm) { @@ -495,7 +485,7 @@ show_session_command_fn (vlib_main_t * vm, unformat_input_t * input, u8 one_session = 0, do_listeners = 0, sst, do_elog = 0, do_filter = 0; u32 track_index, thread_index = 0, start = 0, end = ~0, session_index; unformat_input_t _line_input, *line_input = &_line_input; - transport_proto_t transport_proto = TRANSPORT_N_PROTO; + transport_proto_t transport_proto = TRANSPORT_PROTO_INVALID; session_state_t state = SESSION_N_STATES, *states = 0; session_main_t *smm = &session_main; clib_error_t *error = 0; @@ -585,7 +575,7 @@ show_session_command_fn (vlib_main_t * vm, unformat_input_t * input, do_elog = 1; else if (unformat (line_input, "protos")) { - session_cli_print_transport_protos (vm); + vlib_cli_output (vm, "%U", format_transport_protos); goto done; } else if (unformat (line_input, "states")) @@ -890,6 +880,84 @@ VLIB_CLI_COMMAND (session_enable_disable_command, static) = }; /* *INDENT-ON* */ +#if SESSION_DEBUG + +static clib_error_t * +show_session_dbg_clock_cycles_fn (vlib_main_t * vm, unformat_input_t * input, + vlib_cli_command_t * cmd) +{ + u32 thread; + + if (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) + return clib_error_return (0, "unknown input `%U'", format_unformat_error, + input); + + for (thread = 0; thread < vec_len (session_dbg_main.wrk); thread++) + { + vlib_cli_output (vm, "Threads %u:\n", thread); + session_dbg_evts_t *sdm = &session_dbg_main.wrk[thread]; + +#define _(sym, disp, type, str) \ + if(disp) \ + { \ + if (!type) \ + vlib_cli_output (vm, "\t %25s : %12lu ", \ + str, sdm->sess_dbg_evt_type[SESS_Q_##sym].u64);\ + else \ + vlib_cli_output (vm, "\t %25s : %12.3f ", \ + str, sdm->sess_dbg_evt_type[SESS_Q_##sym].f64);\ + } + + foreach_session_events +#undef _ + } + return 0; +} + + +/* *INDENT-OFF* */ +VLIB_CLI_COMMAND (show_session_dbg_clock_cycles_command, static) = +{ + .path = "show session dbg clock_cycles", + .short_help = "show session dbg clock_cycles", + .function = show_session_dbg_clock_cycles_fn, +}; +/* *INDENT-ON* */ + + +static clib_error_t * +clear_session_dbg_clock_cycles_fn (vlib_main_t * vm, unformat_input_t * input, + vlib_cli_command_t * cmd) +{ + session_dbg_evts_t *sdb; + u32 thread; + + if (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) + return clib_error_return (0, "unknown input `%U'", format_unformat_error, + input); + + for (thread = 0; thread < vec_len (session_dbg_main.wrk); thread++) + { + sdb = &session_dbg_main.wrk[thread]; + clib_memset (sdb, 0, sizeof (session_dbg_evts_t)); + sdb->last_time = vlib_time_now (vlib_mains[thread]); + } + + return 0; +} + + +/* *INDENT-OFF* */ +VLIB_CLI_COMMAND (clear_session_clock_cycles_command, static) = +{ + .path = "clear session dbg clock_cycles", + .short_help = "clear session dbg clock_cycles", + .function = clear_session_dbg_clock_cycles_fn, +}; +#endif /* #if SESSION_DEBUG */ + +/* *INDENT-ON* */ + /* * fd.io coding-style-patch-verification: ON *