aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/bonding/device.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/vnet/bonding/device.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/vnet/bonding/device.c')
-rw-r--r--src/vnet/bonding/device.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/src/vnet/bonding/device.c b/src/vnet/bonding/device.c
index bc185867c10..7ce5ad87bd7 100644
--- a/src/vnet/bonding/device.c
+++ b/src/vnet/bonding/device.c
@@ -651,25 +651,28 @@ bond_tx_trace (vlib_main_t * vm, vlib_node_runtime_t * node, bond_if_t * bif,
while (n_trace > 0 && n_left > 0)
{
- bond_packet_trace_t *t0;
- ethernet_header_t *eth;
- u32 next0 = 0;
-
- vlib_trace_buffer (vm, node, next0, b[0], 0 /* follow_chain */ );
- vlib_set_trace_count (vm, node, --n_trace);
- t0 = vlib_add_trace (vm, node, b[0], sizeof (*t0));
- eth = vlib_buffer_get_current (b[0]);
- t0->ethernet = *eth;
- t0->sw_if_index = vnet_buffer (b[0])->sw_if_index[VLIB_TX];
- if (!h)
+ if (PREDICT_TRUE
+ (vlib_trace_buffer (vm, node, 0, b[0], 0 /* follow_chain */ )))
{
- t0->bond_sw_if_index = *vec_elt_at_index (bif->active_members, 0);
- }
- else
- {
- t0->bond_sw_if_index =
- *vec_elt_at_index (bif->active_members, h[0]);
- h++;
+ bond_packet_trace_t *t0;
+ ethernet_header_t *eth;
+
+ vlib_set_trace_count (vm, node, --n_trace);
+ t0 = vlib_add_trace (vm, node, b[0], sizeof (*t0));
+ eth = vlib_buffer_get_current (b[0]);
+ t0->ethernet = *eth;
+ t0->sw_if_index = vnet_buffer (b[0])->sw_if_index[VLIB_TX];
+ if (!h)
+ {
+ t0->bond_sw_if_index =
+ *vec_elt_at_index (bif->active_members, 0);
+ }
+ else
+ {
+ t0->bond_sw_if_index =
+ *vec_elt_at_index (bif->active_members, h[0]);
+ h++;
+ }
}
b++;
n_left--;