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/unix/tuntap.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/unix/tuntap.c')
-rw-r--r-- | src/vnet/unix/tuntap.c | 8 |
1 files changed, 3 insertions, 5 deletions
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; |