diff options
author | Dave Barach <dave@barachs.net> | 2017-02-15 09:01:01 -0500 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2017-02-17 13:32:42 +0100 |
commit | 681abe46c9ea30e5c386db74c997714433470c4c (patch) | |
tree | 748946309bca26c11ebaa460689ba91a66d2313a /src/vnet/l2/l2_learn.c | |
parent | 6e9cf3b9b53e69408514f9451235119a31045ed6 (diff) |
l2 input: avoid per-packet trace checks in the fast path
Change-Id: Ib0c8572773499d8dd4d81b3a565c24412ccc3510
Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet/l2/l2_learn.c')
-rw-r--r-- | src/vnet/l2/l2_learn.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/vnet/l2/l2_learn.c b/src/vnet/l2/l2_learn.c index 7f19f936d70..afe7f478f8c 100644 --- a/src/vnet/l2/l2_learn.c +++ b/src/vnet/l2/l2_learn.c @@ -231,9 +231,9 @@ done: } -static uword -l2learn_node_fn (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +static_always_inline uword +l2learn_node_inline (vlib_main_t * vm, vlib_node_runtime_t * node, + vlib_frame_t * frame, int do_trace) { u32 n_left_from, *from, *to_next; l2learn_next_t next_index; @@ -320,7 +320,7 @@ l2learn_node_fn (vlib_main_t * vm, h2 = vlib_buffer_get_current (b2); h3 = vlib_buffer_get_current (b3); - if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE))) + if (do_trace) { if (b0->flags & VLIB_BUFFER_IS_TRACED) { @@ -426,8 +426,7 @@ l2learn_node_fn (vlib_main_t * vm, h0 = vlib_buffer_get_current (b0); - if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) - && (b0->flags & VLIB_BUFFER_IS_TRACED))) + if (do_trace && PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED)) { l2learn_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t)); t->sw_if_index = sw_if_index0; @@ -461,6 +460,14 @@ l2learn_node_fn (vlib_main_t * vm, return frame->n_vectors; } +static uword +l2learn_node_fn (vlib_main_t * vm, + vlib_node_runtime_t * node, vlib_frame_t * frame) +{ + if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE))) + return l2learn_node_inline (vm, node, frame, 1 /* do_trace */ ); + return l2learn_node_inline (vm, node, frame, 0 /* do_trace */ ); +} /* *INDENT-OFF* */ VLIB_REGISTER_NODE (l2learn_node,static) = { |