summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Mikhailov (imichail) <imichail@cisco.com>2019-03-29 19:25:15 -0700
committerIgor Mikhailov (imichail) <imichail@cisco.com>2019-03-29 19:25:15 -0700
commit2d6fc6b082c9b4bf9481b58f68def13792822805 (patch)
tree311546c57cb3cb531fb0c4da72e7a484960635f1
parent19e540f73e60ccd47b0fbc0fbf543ba1703a2e5c (diff)
SPAN: Add pending frame on current thread, not on main
Previously, all frames were put for next node on the main thread, even if the execution was happening on a worker thread. Also, refactor to use API function vnet_get_main() Change-Id: Ibefb1b3871563a78aa30352a37b9216537e15bf7 Signed-off-by: Igor Mikhailov (imichail) <imichail@cisco.com>
-rw-r--r--src/vnet/span/node.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/vnet/span/node.c b/src/vnet/span/node.c
index a70dac769c8..1a9d1bae724 100644
--- a/src/vnet/span/node.c
+++ b/src/vnet/span/node.c
@@ -33,7 +33,7 @@ format_span_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
span_trace_t *t = va_arg (*args, span_trace_t *);
- vnet_main_t *vnm = &vnet_main;
+ vnet_main_t *vnm = vnet_get_main ();
s = format (s, "SPAN: mirrored %U -> %U",
format_vnet_sw_if_index_name, vnm, t->src_sw_if_index,
format_vnet_sw_if_index_name, vnm, t->mirror_sw_if_index);
@@ -65,7 +65,7 @@ span_mirror (vlib_main_t * vm, vlib_node_runtime_t * node, u32 sw_if_index0,
{
vlib_buffer_t *c0;
span_main_t *sm = &span_main;
- vnet_main_t *vnm = &vnet_main;
+ vnet_main_t *vnm = vnet_get_main ();
u32 *to_mirror_next = 0;
u32 i;
span_interface_t *si0;
@@ -90,8 +90,7 @@ span_mirror (vlib_main_t * vm, vlib_node_runtime_t * node, u32 sw_if_index0,
if (mirror_frames[i] == 0)
{
if (sf == SPAN_FEAT_L2)
- mirror_frames[i] = vlib_get_frame_to_node (vnm->vlib_main,
- l2output_node.index);
+ mirror_frames[i] = vlib_get_frame_to_node (vm, l2output_node.index);
else
mirror_frames[i] = vnet_get_frame_to_sw_interface (vnm, i);
}
@@ -132,7 +131,7 @@ span_node_inline_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
span_feat_t sf)
{
span_main_t *sm = &span_main;
- vnet_main_t *vnm = &vnet_main;
+ vnet_main_t *vnm = vnet_get_main ();
u32 n_left_from, *from, *to_next;
u32 next_index;
u32 sw_if_index;
@@ -259,7 +258,7 @@ span_node_inline_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
continue;
if (sf == SPAN_FEAT_L2)
- vlib_put_frame_to_node (vnm->vlib_main, l2output_node.index, f);
+ vlib_put_frame_to_node (vm, l2output_node.index, f);
else
vnet_put_frame_to_sw_interface (vnm, sw_if_index, f);
mirror_frames[sw_if_index] = 0;