summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2019-10-21 15:13:54 +0200
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-11-05 10:46:54 +0000
commitc9ddd2eec1194b6517106d31a6e40238d4aec4e8 (patch)
treecbaadecf771a69ee14af9e55de989ec90d36f576 /src
parente7ac6d0250664f278e7aa5a483f413bda0432def (diff)
vlib: only dump 1st buffer in chain by default
Several nodes include buffers in their traces, but only the 1st. When formatting the trace we must not try to iterate through all chained buffers. Default to display only the 1st buffer. Type: fix Change-Id: Ib3c668bbf4ab70ae68eba2ac402c7b7329825b70 Signed-off-by: Benoît Ganne <bganne@cisco.com> (cherry picked from commit 4354317bf3592d81fcafd94e33b320c3e49f45d3)
Diffstat (limited to 'src')
-rw-r--r--src/plugins/vmxnet3/format.c2
-rw-r--r--src/vlib/buffer.c15
-rw-r--r--src/vlib/buffer.h2
-rw-r--r--src/vlib/buffer_funcs.h2
-rw-r--r--src/vnet/buffer.c2
5 files changed, 17 insertions, 6 deletions
diff --git a/src/plugins/vmxnet3/format.c b/src/plugins/vmxnet3/format.c
index 8e39b5faf36..d463feb3bec 100644
--- a/src/plugins/vmxnet3/format.c
+++ b/src/plugins/vmxnet3/format.c
@@ -164,7 +164,7 @@ format_vmxnet3_input_trace (u8 * s, va_list * args)
s = format (s, "vmxnet3: %v (%d) next-node %U",
hi->name, t->hw_if_index, format_vlib_next_node_name, vm,
node->index, t->next_index);
- s = format (s, "\n buffer %U", format_vlib_buffer, &t->buffer);
+ s = format (s, "\n buffer %U", format_vnet_buffer, &t->buffer);
return s;
}
diff --git a/src/vlib/buffer.c b/src/vlib/buffer.c
index c4c05bbbcaa..53d60364df8 100644
--- a/src/vlib/buffer.c
+++ b/src/vlib/buffer.c
@@ -92,7 +92,7 @@ vlib_buffer_length_in_chain_slow_path (vlib_main_t * vm,
}
u8 *
-format_vlib_buffer (u8 * s, va_list * args)
+format_vlib_buffer_no_chain (u8 * s, va_list * args)
{
vlib_buffer_t *b = va_arg (*args, vlib_buffer_t *);
u32 indent = format_get_indent (s);
@@ -118,9 +118,20 @@ format_vlib_buffer (u8 * s, va_list * args)
s = format (s, "\n%U%v", format_white_space, indent, a);
vec_free (a);
+ return s;
+}
+
+u8 *
+format_vlib_buffer (u8 * s, va_list * args)
+{
+ vlib_main_t *vm = vlib_get_main ();
+ vlib_buffer_t *b = va_arg (*args, vlib_buffer_t *);
+ u32 indent = format_get_indent (s);
+
+ s = format (s, "%U", format_vlib_buffer_no_chain, b);
+
while (b->flags & VLIB_BUFFER_NEXT_PRESENT)
{
- vlib_main_t *vm = vlib_get_main ();
u32 next_buffer = b->next_buffer;
b = vlib_get_buffer (vm, next_buffer);
diff --git a/src/vlib/buffer.h b/src/vlib/buffer.h
index c8761af4d20..02b65264724 100644
--- a/src/vlib/buffer.h
+++ b/src/vlib/buffer.h
@@ -72,7 +72,7 @@
*/
#define foreach_vlib_buffer_flag \
_( 0, IS_TRACED, 0) \
- _( 1, NEXT_PRESENT, 0) \
+ _( 1, NEXT_PRESENT, "next-present") \
_( 2, TOTAL_LENGTH_VALID, 0) \
_( 3, EXT_HDR_VALID, "ext-hdr-valid")
diff --git a/src/vlib/buffer_funcs.h b/src/vlib/buffer_funcs.h
index 7480326ee3d..288a36a0c9f 100644
--- a/src/vlib/buffer_funcs.h
+++ b/src/vlib/buffer_funcs.h
@@ -1314,7 +1314,7 @@ vlib_buffer_chain_append_data_with_alloc (vlib_main_t * vm,
void vlib_buffer_chain_validate (vlib_main_t * vm, vlib_buffer_t * first);
format_function_t format_vlib_buffer, format_vlib_buffer_and_data,
- format_vlib_buffer_contents;
+ format_vlib_buffer_contents, format_vlib_buffer_no_chain;
typedef struct
{
diff --git a/src/vnet/buffer.c b/src/vnet/buffer.c
index cf61780cb74..3cb6b948d2b 100644
--- a/src/vnet/buffer.c
+++ b/src/vnet/buffer.c
@@ -45,7 +45,7 @@ format_vnet_buffer (u8 * s, va_list * args)
if (b->flags & VNET_BUFFER_F_LOOP_COUNTER_VALID)
a = format (a, "loop-counter %d ", vnet_buffer2 (b)->loop_counter);
- s = format (s, "%U", format_vlib_buffer, b);
+ s = format (s, "%U", format_vlib_buffer_no_chain, b);
if (a)
s = format (s, "\n%U%v", format_white_space, indent, a);
vec_free (a);