Add verbose flag for packet trace, show hexdump in verbose dpdk input trace
Verbose trace can be enabled with: trace add dpdk-input 1 verbose Change-Id: If58cfc561143d5a44f7d11e61d54b6835692a0e3 Signed-off-by: Damjan Marion <damarion@cisco.com>
This commit is contained in:
Damjan Marion
committed by
Chris Luke
parent
a7e83ceeac
commit
db7b269736
@ -359,12 +359,18 @@ cli_add_trace_buffer (vlib_main_t * vm,
|
||||
vlib_trace_main_t * tm;
|
||||
vlib_trace_node_t * tn;
|
||||
u32 node_index, add;
|
||||
u8 verbose = 0;
|
||||
|
||||
if (unformat (input, "%U %d", unformat_vlib_node, vm, &node_index, &add))
|
||||
;
|
||||
else
|
||||
return clib_error_create ("expected NODE COUNT, got `%U'",
|
||||
format_unformat_error, input);
|
||||
while (unformat_check_input(input) != (uword)UNFORMAT_END_OF_INPUT)
|
||||
{
|
||||
if (unformat (input, "%U %d", unformat_vlib_node, vm, &node_index, &add))
|
||||
;
|
||||
else if (unformat (input, "verbose"))
|
||||
verbose = 1;
|
||||
else
|
||||
return clib_error_create ("expected NODE COUNT, got `%U'",
|
||||
format_unformat_error, input);
|
||||
}
|
||||
|
||||
foreach_vlib_main (
|
||||
({
|
||||
@ -372,6 +378,7 @@ cli_add_trace_buffer (vlib_main_t * vm,
|
||||
tm = &this_vlib_main->trace_main;
|
||||
|
||||
tm->trace_active_hint = 1;
|
||||
tm->verbose = verbose;
|
||||
|
||||
oldheap = clib_mem_set_heap (this_vlib_main->heap_base);
|
||||
|
||||
|
@ -81,6 +81,9 @@ typedef struct {
|
||||
|
||||
/* Per node trace counts. */
|
||||
vlib_trace_node_t * nodes;
|
||||
|
||||
/* verbosity */
|
||||
int verbose;
|
||||
} vlib_trace_main_t;
|
||||
|
||||
#endif /* included_vlib_trace_h */
|
||||
|
@ -467,6 +467,7 @@ typedef struct {
|
||||
u16 queue_index;
|
||||
struct rte_mbuf mb;
|
||||
vlib_buffer_t buffer; /* Copy of VLIB buffer; pkt data stored in pre_data. */
|
||||
u8 data[256]; /* First 256 data bytes, used for hexdump */
|
||||
} dpdk_rx_dma_trace_t;
|
||||
|
||||
void vnet_buffer_needs_dpdk_mb (vlib_buffer_t * b);
|
||||
|
@ -662,6 +662,14 @@ u8 * format_dpdk_rx_dma_trace (u8 * s, va_list * va)
|
||||
format_white_space, indent,
|
||||
format_dpdk_rte_mbuf, &t->mb);
|
||||
#endif /* RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS */
|
||||
if (vm->trace_main.verbose)
|
||||
{
|
||||
s = format (s, "\n%UPacket Dump%s", format_white_space, indent + 2,
|
||||
t->mb.data_len > sizeof(t->data) ? " (truncated)": "");
|
||||
s = format (s, "\n%U%U", format_white_space, indent + 4,
|
||||
format_hexdump, &t->data,
|
||||
t->mb.data_len > sizeof(t->data) ? sizeof(t->data) : t->mb.data_len);
|
||||
}
|
||||
f = node->format_buffer;
|
||||
if (!f)
|
||||
f = format_hex_bytes;
|
||||
@ -726,11 +734,11 @@ u8 * format_dpdk_rte_mbuf (u8 * s, va_list * va)
|
||||
uword indent = format_get_indent (s) + 2;
|
||||
|
||||
s = format (s, "PKT MBUF: port %d, nb_segs %d, pkt_len %d"
|
||||
"\n%Ubuf_len %d, data_len %d, ol_flags 0x%x,"
|
||||
"\n%Ubuf_len %d, data_len %d, ol_flags 0x%x, data_off %d"
|
||||
"\n%Upacket_type 0x%x",
|
||||
mb->port, mb->nb_segs, mb->pkt_len,
|
||||
format_white_space, indent,
|
||||
mb->buf_len, mb->data_len, mb->ol_flags,
|
||||
mb->buf_len, mb->data_len, mb->ol_flags, mb->data_off,
|
||||
format_white_space, indent,
|
||||
mb->packet_type);
|
||||
|
||||
|
@ -380,6 +380,7 @@ void dpdk_rx_trace (dpdk_main_t * dm,
|
||||
clib_memcpy (&t0->mb, mb, sizeof (t0->mb));
|
||||
clib_memcpy (&t0->buffer, b0, sizeof (b0[0]) - sizeof (b0->pre_data));
|
||||
clib_memcpy (t0->buffer.pre_data, b0->data, sizeof (t0->buffer.pre_data));
|
||||
clib_memcpy (&t0->data, mb->buf_addr + mb->data_off, sizeof (t0->data));
|
||||
|
||||
#ifdef RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS
|
||||
/*
|
||||
|
Reference in New Issue
Block a user