aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2019-03-05 04:32:11 -0800
committerNeale Ranns <nranns@cisco.com>2019-03-05 14:08:26 +0000
commit17fcd989f417555b1c2edfe626add5cc6f620812 (patch)
tree7d6afd7ac844f22a15aa9a9d6f87bae989040cac /src/vnet
parent32f6d8e0ca39483f706dc3a1c28223e9fe028f06 (diff)
mpls: migrate old MULTIARCH macros to VLIB_NODE_FN
Change-Id: I8c5f7cda655e3343d50a96d714796ea4255588b6 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/CMakeLists.txt7
-rw-r--r--src/vnet/mpls/mpls.h2
-rw-r--r--src/vnet/mpls/mpls_features.c18
-rw-r--r--src/vnet/mpls/mpls_input.c10
-rw-r--r--src/vnet/mpls/mpls_lookup.c31
-rw-r--r--src/vnet/mpls/mpls_output.c18
6 files changed, 31 insertions, 55 deletions
diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt
index 01918cad887..e412b451aa7 100644
--- a/src/vnet/CMakeLists.txt
+++ b/src/vnet/CMakeLists.txt
@@ -676,6 +676,13 @@ list(APPEND VNET_SOURCES
mpls/mpls_api.c
)
+list(APPEND VNET_MULTIARCH_SOURCES
+ mpls/mpls_output.c
+ mpls/mpls_input.c
+ mpls/mpls_lookup.c
+ mpls/mpls_features.c
+)
+
list(APPEND VNET_HEADERS
mpls/mpls.h
mpls/mpls_types.h
diff --git a/src/vnet/mpls/mpls.h b/src/vnet/mpls/mpls.h
index cc3eeed035e..918a3d83271 100644
--- a/src/vnet/mpls/mpls.h
+++ b/src/vnet/mpls/mpls.h
@@ -58,6 +58,8 @@ typedef struct
/* IP4 enabled count by software interface */
u8 *mpls_enabled_by_sw_if_index;
+
+ u32 mpls_lookup_node_index;
} mpls_main_t;
extern mpls_main_t mpls_main;
diff --git a/src/vnet/mpls/mpls_features.c b/src/vnet/mpls/mpls_features.c
index 9ed56dff554..5f07833b6a3 100644
--- a/src/vnet/mpls/mpls_features.c
+++ b/src/vnet/mpls/mpls_features.c
@@ -37,8 +37,7 @@ mpls_terminate (vlib_main_t * vm,
return n_packets;
}
-static uword
-mpls_punt (vlib_main_t * vm,
+VLIB_NODE_FN (mpls_punt_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
@@ -46,7 +45,6 @@ mpls_punt (vlib_main_t * vm,
}
VLIB_REGISTER_NODE (mpls_punt_node) = {
- .function = mpls_punt,
.name = "mpls-punt",
.vector_size = sizeof (u32),
@@ -56,10 +54,7 @@ VLIB_REGISTER_NODE (mpls_punt_node) = {
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (mpls_punt_node, mpls_punt)
-
-static uword
-mpls_drop (vlib_main_t * vm,
+VLIB_NODE_FN (mpls_drop_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
@@ -67,7 +62,6 @@ mpls_drop (vlib_main_t * vm,
}
VLIB_REGISTER_NODE (mpls_drop_node) = {
- .function = mpls_drop,
.name = "mpls-drop",
.vector_size = sizeof (u32),
@@ -77,10 +71,7 @@ VLIB_REGISTER_NODE (mpls_drop_node) = {
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (mpls_drop_node, mpls_drop)
-
-static uword
-mpls_not_enabled (vlib_main_t * vm,
+VLIB_NODE_FN (mpls_not_enabled_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
@@ -88,7 +79,6 @@ mpls_not_enabled (vlib_main_t * vm,
}
VLIB_REGISTER_NODE (mpls_not_enabled_node) = {
- .function = mpls_not_enabled,
.name = "mpls-not-enabled",
.vector_size = sizeof (u32),
@@ -98,8 +88,6 @@ VLIB_REGISTER_NODE (mpls_not_enabled_node) = {
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (mpls_not_enabled_node, mpls_not_enabled)
-
VNET_FEATURE_ARC_INIT (mpls_input, static) =
{
.arc_name = "mpls-input",
diff --git a/src/vnet/mpls/mpls_input.c b/src/vnet/mpls/mpls_input.c
index d77fd4cd7e3..1dd5e326a3c 100644
--- a/src/vnet/mpls/mpls_input.c
+++ b/src/vnet/mpls/mpls_input.c
@@ -60,8 +60,6 @@ format_mpls_input_trace (u8 * s, va_list * args)
return s;
}
-vlib_node_registration_t mpls_input_node;
-
typedef struct {
u32 last_label;
u32 last_inner_fib_index;
@@ -231,8 +229,7 @@ mpls_input_inline (vlib_main_t * vm,
return from_frame->n_vectors;
}
-static uword
-mpls_input (vlib_main_t * vm,
+VLIB_NODE_FN (mpls_input_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
{
@@ -246,7 +243,6 @@ static char * mpls_error_strings[] = {
};
VLIB_REGISTER_NODE (mpls_input_node) = {
- .function = mpls_input,
.name = "mpls-input",
/* Takes a vector of packets. */
.vector_size = sizeof (u32),
@@ -267,8 +263,7 @@ VLIB_REGISTER_NODE (mpls_input_node) = {
.format_trace = format_mpls_input_trace,
};
-VLIB_NODE_FUNCTION_MULTIARCH (mpls_input_node, mpls_input)
-
+#ifndef CLIB_MARCH_VARIANT
static void
mpls_setup_nodes (vlib_main_t * vm)
{
@@ -295,3 +290,4 @@ static clib_error_t * mpls_input_init (vlib_main_t * vm)
}
VLIB_INIT_FUNCTION (mpls_input_init);
+#endif /* CLIB_MARCH_VARIANT */
diff --git a/src/vnet/mpls/mpls_lookup.c b/src/vnet/mpls/mpls_lookup.c
index 56492f1368a..b2309fb62c0 100644
--- a/src/vnet/mpls/mpls_lookup.c
+++ b/src/vnet/mpls/mpls_lookup.c
@@ -23,14 +23,11 @@
#include <vnet/dpo/replicate_dpo.h>
/**
- * Static MPLS VLIB forwarding node
- */
-static vlib_node_registration_t mpls_lookup_node;
-
-/**
* The arc/edge from the MPLS lookup node to the MPLS replicate node
*/
+#ifndef CLIB_MARCH_VARIANT
u32 mpls_lookup_to_replicate_edge;
+#endif /* CLIB_MARCH_VARIANT */
typedef struct {
u32 next_index;
@@ -57,8 +54,7 @@ format_mpls_lookup_trace (u8 * s, va_list * args)
return s;
}
-static inline uword
-mpls_lookup (vlib_main_t * vm,
+VLIB_NODE_FN (mpls_lookup_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
{
@@ -454,7 +450,7 @@ mpls_lookup (vlib_main_t * vm,
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
}
- vlib_node_increment_counter (vm, mpls_lookup_node.index,
+ vlib_node_increment_counter (vm, mm->mpls_lookup_node_index,
MPLS_ERROR_PKTS_DECAP, from_frame->n_vectors);
return from_frame->n_vectors;
}
@@ -465,8 +461,7 @@ static char * mpls_error_strings[] = {
#undef mpls_error
};
-VLIB_REGISTER_NODE (mpls_lookup_node, static) = {
- .function = mpls_lookup,
+VLIB_REGISTER_NODE (mpls_lookup_node) = {
.name = "mpls-lookup",
/* Takes a vector of packets. */
.vector_size = sizeof (u32),
@@ -480,8 +475,6 @@ VLIB_REGISTER_NODE (mpls_lookup_node, static) = {
.unformat_buffer = unformat_mpls_header,
};
-VLIB_NODE_FUNCTION_MULTIARCH (mpls_lookup_node, mpls_lookup)
-
typedef struct {
u32 next_index;
u32 lb_index;
@@ -500,8 +493,7 @@ format_mpls_load_balance_trace (u8 * s, va_list * args)
return s;
}
-static uword
-mpls_load_balance (vlib_main_t * vm,
+VLIB_NODE_FN (mpls_load_balance_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
@@ -689,7 +681,6 @@ mpls_load_balance (vlib_main_t * vm,
}
VLIB_REGISTER_NODE (mpls_load_balance_node) = {
- .function = mpls_load_balance,
.name = "mpls-load-balance",
.vector_size = sizeof (u32),
.format_trace = format_mpls_load_balance_trace,
@@ -701,23 +692,27 @@ VLIB_REGISTER_NODE (mpls_load_balance_node) = {
};
-VLIB_NODE_FUNCTION_MULTIARCH (mpls_load_balance_node, mpls_load_balance)
-
+#ifndef CLIB_MARCH_VARIANT
static clib_error_t *
mpls_lookup_init (vlib_main_t * vm)
{
+ mpls_main_t *mm = &mpls_main;
clib_error_t * error;
+ vlib_node_t *node = vlib_get_node_by_name (vm, (u8*)"mpls-lookup" );
+
+ mm->mpls_lookup_node_index = node->index;
if ((error = vlib_call_init_function (vm, mpls_init)))
return error;
mpls_lookup_to_replicate_edge =
vlib_node_add_named_next(vm,
- mpls_lookup_node.index,
+ mm->mpls_lookup_node_index,
"mpls-replicate");
return (NULL);
}
VLIB_INIT_FUNCTION (mpls_lookup_init);
+#endif /* CLIB_MARCH_VARIANT */
diff --git a/src/vnet/mpls/mpls_output.c b/src/vnet/mpls/mpls_output.c
index b7bb7694c71..1d6546a6b3d 100644
--- a/src/vnet/mpls/mpls_output.c
+++ b/src/vnet/mpls/mpls_output.c
@@ -313,8 +313,7 @@ static char * mpls_error_strings[] = {
#undef mpls_error
};
-static inline uword
-mpls_output (vlib_main_t * vm,
+VLIB_NODE_FN (mpls_output_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
{
@@ -322,7 +321,6 @@ mpls_output (vlib_main_t * vm,
}
VLIB_REGISTER_NODE (mpls_output_node) = {
- .function = mpls_output,
.name = "mpls-output",
/* Takes a vector of packets. */
.vector_size = sizeof (u32),
@@ -339,10 +337,7 @@ VLIB_REGISTER_NODE (mpls_output_node) = {
.format_trace = format_mpls_output_trace,
};
-VLIB_NODE_FUNCTION_MULTIARCH (mpls_output_node, mpls_output)
-
-static inline uword
-mpls_midchain (vlib_main_t * vm,
+VLIB_NODE_FN (mpls_midchain_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
{
@@ -350,7 +345,6 @@ mpls_midchain (vlib_main_t * vm,
}
VLIB_REGISTER_NODE (mpls_midchain_node) = {
- .function = mpls_midchain,
.name = "mpls-midchain",
.vector_size = sizeof (u32),
@@ -359,8 +353,6 @@ VLIB_REGISTER_NODE (mpls_midchain_node) = {
.sibling_of = "mpls-output",
};
-VLIB_NODE_FUNCTION_MULTIARCH (mpls_midchain_node, mpls_midchain)
-
/**
* @brief Next index values from the MPLS incomplete adj node
*/
@@ -393,8 +385,7 @@ typedef struct mpls_adj_incomplete_trace_t_
* We pay a cost for this 'routing' node, but an incomplete adj is the
* exception case.
*/
-static inline uword
-mpls_adj_incomplete (vlib_main_t * vm,
+VLIB_NODE_FN (mpls_adj_incomplete_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
{
@@ -473,7 +464,6 @@ format_mpls_adj_incomplete_trace (u8 * s, va_list * args)
}
VLIB_REGISTER_NODE (mpls_adj_incomplete_node) = {
- .function = mpls_adj_incomplete,
.name = "mpls-adj-incomplete",
.format_trace = format_mpls_adj_incomplete_trace,
/* Takes a vector of packets. */
@@ -489,5 +479,3 @@ VLIB_REGISTER_NODE (mpls_adj_incomplete_node) = {
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (mpls_adj_incomplete_node,
- mpls_adj_incomplete)