diff options
author | Damjan Marion <damarion@cisco.com> | 2016-06-09 16:16:27 +0200 |
---|---|---|
committer | Chris Luke <chris_luke@cable.comcast.com> | 2016-06-09 20:03:34 +0000 |
commit | db7b2697360dbcc6198ec0518db817050876fef2 (patch) | |
tree | c71920d41b1992028b890f8d9505958fa8631f8c /vnet | |
parent | a7e83ceeacccb20516ffdd8e1beb9695c1e977b1 (diff) |
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>
Diffstat (limited to 'vnet')
-rw-r--r-- | vnet/vnet/devices/dpdk/dpdk.h | 1 | ||||
-rw-r--r-- | vnet/vnet/devices/dpdk/format.c | 12 | ||||
-rw-r--r-- | vnet/vnet/devices/dpdk/node.c | 1 |
3 files changed, 12 insertions, 2 deletions
diff --git a/vnet/vnet/devices/dpdk/dpdk.h b/vnet/vnet/devices/dpdk/dpdk.h index 23c8eb3eaf5..9032b7a9152 100644 --- a/vnet/vnet/devices/dpdk/dpdk.h +++ b/vnet/vnet/devices/dpdk/dpdk.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); diff --git a/vnet/vnet/devices/dpdk/format.c b/vnet/vnet/devices/dpdk/format.c index 3aee0d9275f..6e777460f95 100644 --- a/vnet/vnet/devices/dpdk/format.c +++ b/vnet/vnet/devices/dpdk/format.c @@ -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); diff --git a/vnet/vnet/devices/dpdk/node.c b/vnet/vnet/devices/dpdk/node.c index d22838f1f06..9a0f9c8fb49 100644 --- a/vnet/vnet/devices/dpdk/node.c +++ b/vnet/vnet/devices/dpdk/node.c @@ -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 /* |