51 uword next_buffer_stride,
52 uword n_buffer_data_bytes_in_trace)
75 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
79 n_buffer_data_bytes_in_trace);
81 if (b1->
flags & VLIB_BUFFER_IS_TRACED)
85 n_buffer_data_bytes_in_trace);
101 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
105 n_buffer_data_bytes_in_trace);
122 tm = &this_vlib_main->trace_main;
149 if (node != prev_node)
174 .short_help =
"Packet tracer commands",
184 return dt < 0 ? -1 : (dt > 0 ? +1 : 0);
248 accept = filter_accept(tm, h[0]);
250 if ((n_accepted == tm->filter_count) || !accept)
251 vec_add1 (traces_to_remove, h);
258 for (index = 0; index <
vec_len (traces_to_remove); index++)
286 if (
unformat (input,
"max %d", &max))
299 fmt =
"------------------- Start of thread %d %s -------------------\n";
302 tm = &this_vlib_main->trace_main;
309 vec_add1 (traces, h[0]);
314 s =
format (s,
"No packets in trace buffer\n");
321 for (i = 0; i <
vec_len (traces); i++)
326 " To display more specify max.", max);
330 s =
format (s,
"Packet %d\n%U\n\n", i + 1,
348 .path =
"show trace",
349 .short_help =
"Show trace buffer [max COUNT]",
385 else if (
unformat (line_input,
"verbose"))
387 else if (
unformat (line_input,
"filter"))
402 "tracing. There may be another way to " 403 "initiate trace on this node.",
420 tm = &this_vlib_main->trace_main;
423 tn = tm->
nodes + node_index;
438 .short_help =
"Trace given number of packets",
485 u32 filter_node_index;
489 if (
unformat (input,
"include %U %d",
494 else if (
unformat (input,
"exclude %U %d",
503 filter_node_index = 0;
509 (
"expected 'include NODE COUNT' or 'exclude NODE COUNT' or 'none', got `%U'",
515 tm = &this_vlib_main->trace_main;
534 .path =
"trace filter",
535 .short_help =
"filter trace output - include NODE COUNT | exclude NODE COUNT | none",
551 .path =
"clear trace",
552 .short_help =
"Clear trace buffer and free memory",
566 __attribute__ ((weak));
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
void vlib_trace_cli_reference(void)
format_function_t format_vlib_node_name
vlib_trace_node_t * nodes
static clib_error_t * cli_clear_trace_buffer(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
#define clib_memcpy_fast(a, b, c)
static vlib_trace_header_t * vlib_trace_header_next(vlib_trace_header_t *h)
#define VLIB_NODE_FLAG_TRACE_SUPPORTED
format_function_t * format_trace
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
static clib_error_t * cli_show_trace_buffer(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vlib_trace_header_t ** trace_buffer_pool
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define vlib_prefetch_buffer_with_index(vm, bi, type)
Prefetch buffer metadata by buffer index The first 64 bytes of buffer contains most header informatio...
#define vec_end(v)
End (last data address) of vector.
#define clib_error_create(args...)
u64 cpu_time_main_loop_start
u32 filter_accept(vlib_trace_main_t *tm, vlib_trace_header_t *h)
vlib_worker_thread_t * vlib_worker_threads
#define FILTER_FLAG_EXCLUDE
u8 * format_vlib_trace(u8 *s, va_list *va)
static int trace_cmp(void *a1, void *a2)
format_function_t * format_buffer
#define foreach_vlib_main(body)
#define pool_free(p)
Free a pool.
static clib_error_t * cli_filter_trace(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * cli_add_trace_buffer(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_free(V)
Free vector's memory (no header).
#define clib_warning(format, args...)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
#define VLIB_CLI_COMMAND(x,...)
#define pool_put_index(p, i)
Free pool element with given index.
static void clear_trace_buffer(void)
vlib_trace_main_t trace_main
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
void vlib_trace_frame_buffers_only(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, uword n_buffers, uword next_buffer_stride, uword n_buffer_data_bytes_in_trace)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
int vlib_enable_disable_pkt_trace_filter(int enable)
VLIB buffer representation.
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
int vnet_is_packet_traced(vlib_buffer_t *b, u32 classify_table_index, int func)
unformat_function_t unformat_vlib_node
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
#define CLIB_CACHE_LINE_BYTES
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
void trace_apply_filter(vlib_main_t *vm)
#define FILTER_FLAG_INCLUDE