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/ethernet | |
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/ethernet')
-rw-r--r-- | src/vnet/ethernet/p2p_ethernet_input.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/vnet/ethernet/p2p_ethernet_input.c b/src/vnet/ethernet/p2p_ethernet_input.c index 7e5f7cadc0d..3e9589e0e19 100644 --- a/src/vnet/ethernet/p2p_ethernet_input.c +++ b/src/vnet/ethernet/p2p_ethernet_input.c @@ -119,11 +119,12 @@ VLIB_NODE_FN (p2p_ethernet_input_node) (vlib_main_t * vm, vnet_buffer (b0)->sw_if_index[VLIB_RX] = rx0; n_p2p_ethernet_packets += 1; - if (PREDICT_FALSE (n_trace > 0)) + if (PREDICT_FALSE + (n_trace > 0 + && vlib_trace_buffer (vm, node, next_index, b0, + 1 /* follow_chain */ ))) { p2p_ethernet_trace_t *t0; - vlib_trace_buffer (vm, node, next_index, b0, - 1 /* follow_chain */ ); vlib_set_trace_count (vm, node, --n_trace); t0 = vlib_add_trace (vm, node, b0, sizeof (*t0)); t0->sw_if_index = sw_if_index0; @@ -140,11 +141,12 @@ VLIB_NODE_FN (p2p_ethernet_input_node) (vlib_main_t * vm, vnet_buffer (b1)->sw_if_index[VLIB_RX] = rx1; n_p2p_ethernet_packets += 1; - if (PREDICT_FALSE (n_trace > 0)) + if (PREDICT_FALSE + (n_trace > 0 + && vlib_trace_buffer (vm, node, next_index, b1, + 1 /* follow_chain */ ))) { p2p_ethernet_trace_t *t1; - vlib_trace_buffer (vm, node, next_index, b1, - 1 /* follow_chain */ ); vlib_set_trace_count (vm, node, --n_trace); t1 = vlib_add_trace (vm, node, b1, sizeof (*t1)); t1->sw_if_index = sw_if_index1; @@ -195,11 +197,12 @@ VLIB_NODE_FN (p2p_ethernet_input_node) (vlib_main_t * vm, vnet_buffer (b0)->sw_if_index[VLIB_RX] = rx0; n_p2p_ethernet_packets += 1; - if (PREDICT_FALSE (n_trace > 0)) + if (PREDICT_FALSE + (n_trace > 0 + && vlib_trace_buffer (vm, node, next_index, b0, + 1 /* follow_chain */ ))) { p2p_ethernet_trace_t *t0; - vlib_trace_buffer (vm, node, next_index, b0, - 1 /* follow_chain */ ); vlib_set_trace_count (vm, node, --n_trace); t0 = vlib_add_trace (vm, node, b0, sizeof (*t0)); t0->sw_if_index = sw_if_index0; @@ -228,6 +231,7 @@ VLIB_NODE_FN (p2p_ethernet_input_node) (vlib_main_t * vm, vlib_node_increment_counter (vm, p2p_ethernet_input_node.index, P2PE_ERROR_HITS, n_p2p_ethernet_packets); + return frame->n_vectors; } |