diff options
author | Klement Sekera <ksekera@cisco.com> | 2019-10-10 17:03:57 +0000 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2019-10-11 11:38:40 +0000 |
commit | 8563cb389a7e8d6d4e042e146c0d94b8af98ca7a (patch) | |
tree | 0cd1e4da6816a452c7eaed44e7f913a3ecefc255 /src/vnet/ip/reass/ip4_full_reass.c | |
parent | 68bae5b293d6066afc1e74677d716d79fb7e6995 (diff) |
ip: reassembly: trace ip headers over worker handoffs
This change adds tracing of IP headers when doing a handoff between
worker threads. This eases debugging.
Type: feature
Change-Id: I2195b070a364cba13a658ec1cee5154fc4c3a8b0
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'src/vnet/ip/reass/ip4_full_reass.c')
-rw-r--r-- | src/vnet/ip/reass/ip4_full_reass.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/vnet/ip/reass/ip4_full_reass.c b/src/vnet/ip/reass/ip4_full_reass.c index 87a677208fb..303f23337ee 100644 --- a/src/vnet/ip/reass/ip4_full_reass.c +++ b/src/vnet/ip/reass/ip4_full_reass.c @@ -235,6 +235,8 @@ typedef struct u32 fragment_first; u32 fragment_last; u32 total_data_len; + bool is_after_handoff; + ip4_header_t ip4_header; } ip4_full_reass_trace_t; extern vlib_node_registration_t ip4_full_reass_node; @@ -274,7 +276,16 @@ format_ip4_full_reass_trace (u8 * s, va_list * args) u32 indent = 0; if (~0 != t->reass_id) { - s = format (s, "reass id: %u, op id: %u, ", t->reass_id, t->op_id); + if (t->is_after_handoff) + { + s = + format (s, "%U\n", format_ip4_header, &t->ip4_header, + sizeof (t->ip4_header)); + indent = 2; + } + s = + format (s, "%Ureass id: %u, op id: %u, ", format_white_space, indent, + t->reass_id, t->op_id); indent = format_get_indent (s); s = format (s, @@ -322,7 +333,18 @@ ip4_full_reass_add_trace (vlib_main_t * vm, vlib_node_runtime_t * node, { vlib_buffer_t *b = vlib_get_buffer (vm, bi); vnet_buffer_opaque_t *vnb = vnet_buffer (b); + bool is_after_handoff = false; + if (vlib_buffer_get_trace_thread (b) != vm->thread_index) + { + is_after_handoff = true; + } ip4_full_reass_trace_t *t = vlib_add_trace (vm, node, b, sizeof (t[0])); + t->is_after_handoff = is_after_handoff; + if (t->is_after_handoff) + { + clib_memcpy (&t->ip4_header, vlib_buffer_get_current (b), + clib_min (sizeof (t->ip4_header), b->current_length)); + } if (reass) { t->reass_id = reass->id; |