summaryrefslogtreecommitdiffstats
path: root/src/vlib/handoff_trace.c
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2020-10-02 19:36:57 +0200
committerDave Barach <openvpp@barachs.net>2020-11-09 11:51:34 +0000
commit9a3973e3a36bfd4dd8dbffe130a92649fc1b73d3 (patch)
tree1ed9e9c7a3b13edd68f7e78d66dbb995cbe79a2a /src/vlib/handoff_trace.c
parentf6b02e0d0bfd7e0f1d79e8ee426f48ca37ae5ff3 (diff)
vlib: fix trace number accounting
When using classifier to filter traces, not all packets will be traced. In that case, we should only count traced packets. Type: fix Change-Id: I87d1e217b580ebff8c6ade7860eb43950420ae78 Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/vlib/handoff_trace.c')
-rw-r--r--src/vlib/handoff_trace.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/vlib/handoff_trace.c b/src/vlib/handoff_trace.c
index d268b565fe4..964c095b9f6 100644
--- a/src/vlib/handoff_trace.c
+++ b/src/vlib/handoff_trace.c
@@ -96,7 +96,7 @@ VLIB_REGISTER_NODE (handoff_trace_node, static) =
};
/* *INDENT-ON* */
-void
+int
vlib_add_handoff_trace (vlib_main_t * vm, vlib_buffer_t * b)
{
u32 prev_thread = vlib_buffer_get_trace_thread (b);
@@ -105,13 +105,15 @@ vlib_add_handoff_trace (vlib_main_t * vm, vlib_buffer_t * b)
vlib_node_runtime_t *node
= vlib_node_get_runtime (vm, handoff_trace_node.index);
- vlib_trace_buffer (vm, node, 0 /* fake next frame index */ ,
- b, 1 /* folllow chain */ );
+ if (PREDICT_FALSE
+ (!vlib_trace_buffer
+ (vm, node, 0 /* fake next frame index */ , b, 1 /* follow chain */ )))
+ return 0;
t = vlib_add_trace (vm, node, b, sizeof (*t));
-
t->prev_thread = prev_thread;
t->prev_trace_index = prev_trace_index;
+ return 1;
}