summaryrefslogtreecommitdiffstats
path: root/src/plugins/memif/node.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/plugins/memif/node.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/plugins/memif/node.c')
-rw-r--r--src/plugins/memif/node.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/plugins/memif/node.c b/src/plugins/memif/node.c
index 82a7cbc142c..506d88af76d 100644
--- a/src/plugins/memif/node.c
+++ b/src/plugins/memif/node.c
@@ -92,10 +92,10 @@ memif_trace_buffer (vlib_main_t * vm, vlib_node_runtime_t * node,
{
VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b);
- if (PREDICT_TRUE (b != 0))
+ if (PREDICT_TRUE
+ (b != 0 && vlib_trace_buffer (vm, node, next, b, /* follow_chain */ 0)))
{
memif_input_trace_t *tr;
- vlib_trace_buffer (vm, node, next, b, /* follow_chain */ 0);
vlib_set_trace_count (vm, node, --(*n_tracep));
tr = vlib_add_trace (vm, node, b, sizeof (*tr));
tr->next_index = next;
@@ -484,14 +484,17 @@ memif_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
if (mode != MEMIF_INTERFACE_MODE_ETHERNET)
ni = next[0];
b = vlib_get_buffer (vm, bi[0]);
- vlib_trace_buffer (vm, node, ni, b, /* follow_chain */ 0);
- tr = vlib_add_trace (vm, node, b, sizeof (*tr));
- tr->next_index = ni;
- tr->hw_if_index = mif->hw_if_index;
- tr->ring = qid;
+ if (PREDICT_TRUE
+ (vlib_trace_buffer (vm, node, ni, b, /* follow_chain */ 0)))
+ {
+ tr = vlib_add_trace (vm, node, b, sizeof (*tr));
+ tr->next_index = ni;
+ tr->hw_if_index = mif->hw_if_index;
+ tr->ring = qid;
+ n_trace--;
+ }
/* next */
- n_trace--;
n_left--;
bi++;
next++;