From 9a3973e3a36bfd4dd8dbffe130a92649fc1b73d3 Mon Sep 17 00:00:00 2001 From: Benoît Ganne Date: Fri, 2 Oct 2020 19:36:57 +0200 Subject: vlib: fix trace number accounting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/vnet/unix/tuntap.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/vnet/unix') diff --git a/src/vnet/unix/tuntap.c b/src/vnet/unix/tuntap.c index 72c4f73e6df..6834ee88c99 100644 --- a/src/vnet/unix/tuntap.c +++ b/src/vnet/unix/tuntap.c @@ -378,11 +378,9 @@ tuntap_rx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) vlib_set_next_frame_buffer (vm, node, next_index, bi); - if (n_trace > 0) - { - vlib_trace_buffer (vm, node, next_index, b, /* follow_chain */ 1); - vlib_set_trace_count (vm, node, n_trace - 1); - } + if (PREDICT_FALSE (n_trace > 0 && vlib_trace_buffer (vm, node, next_index, b, /* follow_chain */ + 1))) + vlib_set_trace_count (vm, node, n_trace - 1); } return 1; -- cgit 1.2.3-korg