summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2019-03-05 03:46:40 -0800
committerDamjan Marion <dmarion@me.com>2019-03-06 11:39:16 +0000
commita79271fad186e806060e73131d9128bd9d7ea6a4 (patch)
treea35a4c7eb79203b0f5794088e1667aff3a1dea0a
parent55333d76c6501e78ed234a81301e844edc1863b2 (diff)
span: migrate old MULTIARCH macros to VLIB_NODE_FN
Change-Id: I5c671d8af8d528eae625001d4755db8ef61f00b2 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
-rw-r--r--src/vnet/CMakeLists.txt4
-rw-r--r--src/vnet/span/node.c43
2 files changed, 17 insertions, 30 deletions
diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt
index 949749228b9..54e8c8ddcb4 100644
--- a/src/vnet/CMakeLists.txt
+++ b/src/vnet/CMakeLists.txt
@@ -948,6 +948,10 @@ list(APPEND VNET_SOURCES
span/node.c
)
+list(APPEND VNET_MULTIARCH_SOURCES
+ span/node.c
+)
+
list(APPEND VNET_HEADERS
span/span.h
)
diff --git a/src/vnet/span/node.c b/src/vnet/span/node.c
index 67f1d6e42bb..a70dac769c8 100644
--- a/src/vnet/span/node.c
+++ b/src/vnet/span/node.c
@@ -25,10 +25,8 @@
#include <vppinfra/error.h>
#include <vppinfra/elog.h>
-vlib_node_registration_t span_node;
-
/* packet trace format function */
-u8 *
+static u8 *
format_span_trace (u8 * s, va_list * args)
{
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
@@ -136,7 +134,6 @@ span_node_inline_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
span_main_t *sm = &span_main;
vnet_main_t *vnm = &vnet_main;
u32 n_left_from, *from, *to_next;
- u32 n_span_packets = 0;
u32 next_index;
u32 sw_if_index;
static __thread vlib_frame_t **mirror_frames = 0;
@@ -267,36 +264,32 @@ span_node_inline_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
vnet_put_frame_to_sw_interface (vnm, sw_if_index, f);
mirror_frames[sw_if_index] = 0;
}
- vlib_node_increment_counter (vm, span_node.index, SPAN_ERROR_HITS,
- n_span_packets);
return frame->n_vectors;
}
-static uword
-span_device_input_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (span_input_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return span_node_inline_fn (vm, node, frame, VLIB_RX, SPAN_FEAT_DEVICE);
}
-static uword
-span_device_output_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (span_output_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return span_node_inline_fn (vm, node, frame, VLIB_TX, SPAN_FEAT_DEVICE);
}
-static uword
-span_l2_input_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (span_l2_input_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return span_node_inline_fn (vm, node, frame, VLIB_RX, SPAN_FEAT_L2);
}
-static uword
-span_l2_output_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (span_l2_output_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return span_node_inline_fn (vm, node, frame, VLIB_TX, SPAN_FEAT_L2);
}
@@ -315,36 +308,25 @@ span_l2_output_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (span_input_node) = {
span_node_defs,
- .function = span_device_input_node_fn,
.name = "span-input",
};
-VLIB_NODE_FUNCTION_MULTIARCH (span_input_node, span_device_input_node_fn)
-
VLIB_REGISTER_NODE (span_output_node) = {
span_node_defs,
- .function = span_device_output_node_fn,
.name = "span-output",
};
-VLIB_NODE_FUNCTION_MULTIARCH (span_output_node, span_device_output_node_fn)
-
VLIB_REGISTER_NODE (span_l2_input_node) = {
span_node_defs,
- .function = span_l2_input_node_fn,
.name = "span-l2-input",
};
-VLIB_NODE_FUNCTION_MULTIARCH (span_l2_input_node, span_l2_input_node_fn)
-
VLIB_REGISTER_NODE (span_l2_output_node) = {
span_node_defs,
- .function = span_l2_output_node_fn,
.name = "span-l2-output",
};
-VLIB_NODE_FUNCTION_MULTIARCH (span_l2_output_node, span_l2_output_node_fn)
-
+#ifndef CLIB_MARCH_VARIANT
clib_error_t *span_init (vlib_main_t * vm)
{
span_main_t *sm = &span_main;
@@ -369,6 +351,7 @@ clib_error_t *span_init (vlib_main_t * vm)
VLIB_INIT_FUNCTION (span_init);
/* *INDENT-ON* */
+#endif /* CLIB_MARCH_VARIANT */
#undef span_node_defs
/*