22 int verbose = va_arg (*args,
int);
23 session_event_t _e, *e = &_e;
30 if (verbose > 2 && ss->
rx_fifo->has_event)
33 s =
format (s,
" session node event: %s\n",
34 found ?
"found" :
"not found");
37 if (verbose > 2 && ss->
tx_fifo->has_event)
40 s =
format (s,
" session node event: %s\n",
41 found ?
"found" :
"not found");
47 #define _(sym, str) str, 66 #define _(sym, str) str, 78 if (ss->
flags & (1 << i))
81 for (i = 0; i <
last; i++)
83 if (ss->
flags & (1 << i))
104 int verbose = va_arg (*args,
int);
120 str =
format (0,
"%-10u%-10u", rxf, txf);
129 s =
format (s,
"%v", str);
133 s =
format (s,
" session: state: %U opaque: 0x%x flags: %U\n",
163 u32 *fib_index = va_arg (*args,
u32 *);
164 ip46_address_t *lcl = va_arg (*args, ip46_address_t *);
165 ip46_address_t *rmt = va_arg (*args, ip46_address_t *);
166 u16 *lcl_port = va_arg (*args,
u16 *);
167 u16 *rmt_port = va_arg (*args,
u16 *);
168 u8 *is_ip4 = va_arg (*args,
u8 *);
177 *proto = TRANSPORT_PROTO_TCP;
181 *proto = TRANSPORT_PROTO_UDP;
186 if (
unformat (input,
"vrf %u", &vrf))
219 #define _(sym, str) \ 220 if (unformat (input, str)) \ 222 *state = SESSION_STATE_ ## sym; \ 237 u32 lcl_port = 0, rmt_port = 0, fib_index = 0;
238 ip46_address_t lcl, rmt;
244 &lcl, &rmt, &lcl_port, &rmt_port, &is_ip4))
249 clib_host_to_net_u16 (lcl_port),
250 clib_host_to_net_u16 (rmt_port), proto);
253 clib_host_to_net_u16 (lcl_port),
254 clib_host_to_net_u16 (rmt_port), proto);
268 u32 suggested_proto = va_arg (*args,
u32);
271 ip46_address_t lcl, rmt;
272 u32 lcl_port = 0, rmt_port = 0, fib_index = 0;
276 &lcl, &rmt, &lcl_port, &rmt_port, &is_ip4))
279 proto = (proto == (
u8) ~ 0) ? suggested_proto :
proto;
280 if (proto == (
u8) ~ 0)
284 clib_host_to_net_u16 (lcl_port),
285 clib_host_to_net_u16 (rmt_port), proto);
288 clib_host_to_net_u16 (lcl_port),
289 clib_host_to_net_u16 (rmt_port), proto);
303 u32 n_closed, thread_index;
306 for (thread_index = 0; thread_index <
vec_len (smm->
wrk); thread_index++)
326 "suppressed. For more details use filters.",
334 thread_index ?
"\n" :
"",
335 "Connection",
"State",
"Rx-f",
"Tx-f");
355 thread_index,
pool_elts (pool) - n_closed, n_closed);
367 goto check_transport;
384 u8 output_suppressed = 0;
400 && (start == 0 && end == ~0))
408 for (i = start; i <=
clib_min (end, max_index); i++)
420 if (count > 50 || (verbose > 1 && count > 10))
422 output_suppressed = 1;
431 if (!output_suppressed)
433 thread_index, count);
436 " shown. Use finer grained filter.", thread_index,
469 for (thread_index = 0; thread_index <
vec_len (smm->
wrk); thread_index++)
476 #define _(sym, str) vlib_cli_output (vm, str); 485 u8 one_session = 0, do_listeners = 0, sst, do_elog = 0, do_filter = 0;
486 u32 track_index, thread_index = 0, start = 0,
end = ~0, session_index;
509 if (
unformat (line_input,
"verbose %d", &verbose))
511 else if (
unformat (line_input,
"verbose"))
520 else if (
unformat (line_input,
"thread %u index %u", &thread_index,
531 else if (
unformat (line_input,
"thread %u", &thread_index))
541 else if (
unformat (line_input,
"proto %U index %u",
551 " allocated", transport_index, thread_index);
558 "thread %u does not exist", transport_index,
567 else if (
unformat (line_input,
"range %u %u", &start, &
end))
569 else if (
unformat (line_input,
"range %u", &start))
574 else if (
unformat (line_input,
"elog"))
576 else if (
unformat (line_input,
"protos"))
581 else if (
unformat (line_input,
"states"))
586 else if (
unformat (line_input,
"events"))
609 if (track_index != ~0)
653 transport_proto, verbose);
668 .path =
"show session",
669 .short_help =
"show session [verbose [n]] [listeners <proto>] " 670 "[<session-id> [elog]] [thread <n> [index <n>] " 671 "[proto <proto>] [state <state>] [range <min> [<max>]] " 672 "[protos] [states] ",
690 u32 thread_index = 0, clear_all = 0;
692 u32 session_index = ~0;
702 if (
unformat (input,
"thread %d", &thread_index))
704 else if (
unformat (input,
"session %d", &session_index))
713 if (!clear_all && session_index == ~0)
716 if (session_index != ~0)
721 session_index, thread_index);
743 .path =
"clear session",
744 .short_help =
"clear session thread <thread> session <index>",
755 u8 is_rx = 0, *str = 0;
793 .path =
"show session fifo trace",
794 .short_help =
"show session fifo trace <session>",
804 u8 is_rx = 0, *str = 0;
840 .path =
"session replay fifo",
841 .short_help =
"session replay fifo <session>",
859 if (
unformat (line_input,
"enable"))
861 else if (
unformat (line_input,
"disable"))
880 .short_help =
"session [enable|disable]",
#define SESSION_CLI_STATE_LEN
u32 connection_index
Index of the transport connection associated to the session.
u8 * format_transport_connection(u8 *s, va_list *args)
u8 * format_session_fifos(u8 *s, va_list *args)
session_type_t session_type
Type built from transport and network protocol types.
session_main_t session_main
#define pool_foreach(VAR, POOL)
Iterate through pool.
format_function_t format_svm_fifo
u32 session_index
Index in thread pool where session was allocated.
#define session_cli_return_if_not_enabled()
elog_time_stamp_t init_time
Timestamps.
session_t * session_lookup_safe4(u32 fib_index, ip4_address_t *lcl, ip4_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto)
Lookup session with ip4 and transport layer information.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
transport_connection_t * session_get_transport(session_t *s)
svm_fifo_t * rx_fifo
Pointers to rx/tx buffers.
session_worker_t * wrk
Worker contexts.
static session_t * session_get_if_valid(u64 si, u32 thread_index)
__clib_export u8 * format_elog_track(u8 *s, va_list *args)
session_evt_ctrl_data_t * ctrl_evts_data
Pool of ctrl events data buffers.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static transport_proto_t session_get_transport_proto(session_t *s)
static heap_elt_t * last(heap_header_t *h)
static int clear_session(session_t *s)
u8 * format_transport_protos(u8 *s, va_list *args)
#define TRANSPORT_PROTO_INVALID
static clib_error_t * clear_session_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void session_pool_remove_peeker(u32 thread_index)
session_evt_elt_t * event_elts
Pool of session event list elements.
session_t * session_lookup_safe6(u32 fib_index, ip6_address_t *lcl, ip6_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto)
Lookup session with ip6 and transport layer information.
u8 * format_session_state(u8 *s, va_list *args)
#define pool_len(p)
Number of elements in pool vector.
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
session_t * sessions
Worker session pool.
transport_connection_t * session_lookup_connection6(u32 fib_index, ip6_address_t *lcl, ip6_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto)
Lookup connection with ip6 and transport layer information.
static u32 svm_fifo_max_dequeue(svm_fifo_t *f)
Fifo max bytes to dequeue.
description fragment has unexpected format
#define clib_error_return(e, args...)
static clib_error_t * show_session_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
void session_cli_show_events_thread(vlib_main_t *vm, u32 thread_index)
transport_connection_t * session_lookup_connection4(u32 fib_index, ip4_address_t *lcl, ip4_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto)
Lookup connection with ip4 and transport layer information.
uword unformat_session_state(unformat_input_t *input, va_list *args)
static session_type_t session_type_from_proto_and_ip(transport_proto_t proto, u8 is_ip4)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
const u8 * application_name_from_index(u32 app_index)
Returns app name for app-index.
u8 is_enabled
Session manager is enabled.
uword unformat_transport_connection(unformat_input_t *input, va_list *args)
uword unformat_session(unformat_input_t *input, va_list *args)
u8 * svm_fifo_replay(u8 *s, svm_fifo_t *f, u8 no_read, u8 verbose)
clib_error_t * vnet_session_enable_disable(vlib_main_t *vm, u8 is_en)
uword unformat_stream_session_id(unformat_input_t *input, va_list *args)
static transport_connection_t * transport_get_connection(transport_proto_t tp, u32 conn_index, u8 thread_index)
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
static void session_cli_show_events(vlib_main_t *vm, u32 thread_index)
#define SESSION_CLI_ID_LEN
static void session_cli_print_session_states(vlib_main_t *vm)
const char * session_flags_str[]
#define clib_warning(format, args...)
struct _transport_connection transport_connection_t
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
static u32 transport_elog_track_index(transport_connection_t *tc)
#define VLIB_CLI_COMMAND(x,...)
const char * session_state_str[]
static void session_cli_show_session_filter(vlib_main_t *vm, u32 thread_index, u32 start, u32 end, session_state_t *states, transport_proto_t tp, int verbose)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
uword unformat_transport_proto(unformat_input_t *input, va_list *args)
u64 cpu
CPU cycle counter.
static int session_cli_filter_check(session_t *s, session_state_t *states, transport_proto_t tp)
#define foreach_session_state
u8 * format_transport_half_open_connection(u8 *s, va_list *args)
enum _transport_proto transport_proto_t
u8 thread_index
Index of the thread that allocated the session.
u8 * format_session(u8 *s, va_list *args)
Format stream session as per the following format.
u8 * svm_fifo_dump_trace(u8 *s, svm_fifo_t *f)
app_worker_t * app_worker_get(u32 wrk_index)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
volatile u8 session_state
State in session layer state machine.
u32 opaque
Opaque, for general use.
u8 * format_transport_listen_connection(u8 *s, va_list *args)
static clib_error_t * session_replay_fifo_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * show_session_fifo_trace_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u8 * format_session_flags(u8 *s, va_list *args)
u32 app_index
Index of owning app.
vl_api_dhcp_client_state_t state
#define vec_foreach(var, vec)
Vector iterator.
u32 app_wrk_index
Index of the app worker that owns the session.
f64 end
end of the time range
u8 session_node_lookup_fifo_event(svm_fifo_t *f, session_event_t *e)
static void session_cli_show_all_sessions(vlib_main_t *vm, int verbose)
static clib_error_t * session_enable_disable_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
int app_worker_close_notify(app_worker_t *app_wrk, session_t *s)
static session_worker_t * session_main_get_worker_if_valid(u32 thread_index)
static uword pool_elts(void *v)
Number of active elements in a pool.