diff options
author | Benoît Ganne <bganne@cisco.com> | 2020-10-02 19:36:57 +0200 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2020-11-09 11:51:34 +0000 |
commit | 9a3973e3a36bfd4dd8dbffe130a92649fc1b73d3 (patch) | |
tree | 1ed9e9c7a3b13edd68f7e78d66dbb995cbe79a2a /src/vnet/session/session_node.c | |
parent | f6b02e0d0bfd7e0f1d79e8ee426f48ca37ae5ff3 (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/vnet/session/session_node.c')
-rw-r--r-- | src/vnet/session/session_node.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index ec2f936ba60..8a350d4549f 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -569,19 +569,23 @@ session_tx_trace_frame (vlib_main_t * vm, vlib_node_runtime_t * node, u32 next_index, u32 * to_next, u16 n_segs, session_t * s, u32 n_trace) { - session_queue_trace_t *t; - vlib_buffer_t *b; - int i; - - for (i = 0; i < clib_min (n_trace, n_segs); i++) + while (n_trace && n_segs) { - b = vlib_get_buffer (vm, to_next[i]); - vlib_trace_buffer (vm, node, next_index, b, 1 /* follow_chain */ ); - t = vlib_add_trace (vm, node, b, sizeof (*t)); - t->session_index = s->session_index; - t->server_thread_index = s->thread_index; + vlib_buffer_t *b = vlib_get_buffer (vm, to_next[0]); + if (PREDICT_TRUE + (vlib_trace_buffer + (vm, node, next_index, b, 1 /* follow_chain */ ))) + { + session_queue_trace_t *t = + vlib_add_trace (vm, node, b, sizeof (*t)); + t->session_index = s->session_index; + t->server_thread_index = s->thread_index; + n_trace--; + } + to_next++; + n_segs--; } - vlib_set_trace_count (vm, node, n_trace - i); + vlib_set_trace_count (vm, node, n_trace); } always_inline void |