summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Mikhailov (imichail) <imichail@cisco.com>2019-03-29 19:25:15 -0700
committerJohn Lo <loj@cisco.com>2019-03-30 04:57:24 +0000
commit2f4c7ec46fe1f88aa58c2cde3dd4c97f65b4264b (patch)
tree37acc2a54d1b705051d45d2eb21a1f725d2cb6fa
parent8d6723968945d686b94f780b5a755fd3a73d4be6 (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> (cherry picked from commit 2d6fc6b082c9b4bf9481b58f68def13792822805)
-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 67f1d6e42bb..f4be2e92895 100644
--- a/src/vnet/span/node.c
+++ b/src/vnet/span/node.c
@@ -35,7 +35,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);
@@ -67,7 +67,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;
@@ -92,8 +92,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);
}
@@ -134,7 +133,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 n_span_packets = 0;
u32 next_index;
@@ -262,7 +261,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;