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/devices/virtio/node.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/vnet/devices/virtio/node.c') diff --git a/src/vnet/devices/virtio/node.c b/src/vnet/devices/virtio/node.c index 94bf097df55..91e788e4d28 100644 --- a/src/vnet/devices/virtio/node.c +++ b/src/vnet/devices/virtio/node.c @@ -388,11 +388,10 @@ virtio_device_input_gso_inline (vlib_main_t * vm, vlib_node_runtime_t * node, /* trace */ VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b0); - if (PREDICT_FALSE (n_trace > 0)) + if (PREDICT_FALSE (n_trace > 0 && vlib_trace_buffer (vm, node, next0, b0, /* follow_chain */ + 1))) { virtio_input_trace_t *tr; - vlib_trace_buffer (vm, node, next0, b0, - /* follow_chain */ 1); vlib_set_trace_count (vm, node, --n_trace); tr = vlib_add_trace (vm, node, b0, sizeof (*tr)); tr->next_index = next0; -- cgit 1.2.3-korg