ip: migrate old MULTIARCH macros to VLIB_NODE_FN
Change-Id: Id55ec87724e421d5b722314f9302c6ade7545306
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt
index c5ad47e..cb730ba 100644
--- a/src/vnet/CMakeLists.txt
+++ b/src/vnet/CMakeLists.txt
@@ -441,6 +441,18 @@
ip/punt.c
)
+list(APPEND VNET_MULTIARCH_SOURCES
+ ip/ip4_source_check.c
+ ip/ip4_punt_drop.c
+ ip/ip4_reassembly.c
+ ip/ip6_hop_by_hop.c
+ ip/ip6_reassembly.c
+ ip/ip6_input.c
+ ip/ip6_punt_drop.c
+ ip/punt.c
+ ip/ip_in_out_acl.c
+)
+
list(APPEND VNET_HEADERS
ip/format.h
ip/icmp46_packet.h
diff --git a/src/vnet/ip/ip4_punt_drop.c b/src/vnet/ip/ip4_punt_drop.c
index e36980c..8540985 100644
--- a/src/vnet/ip/ip4_punt_drop.c
+++ b/src/vnet/ip/ip4_punt_drop.c
@@ -32,6 +32,11 @@
};
/* *INDENT-ON* */
+extern ip_punt_policer_t ip4_punt_policer_cfg;
+extern ip_punt_redirect_t ip4_punt_redirect_cfg;
+extern ip_punt_redirect_rx_t uninit_rx_redirect;
+
+#ifndef CLIB_MARCH_VARIANT
u8 *
format_ip_punt_policer_trace (u8 * s, va_list * args)
{
@@ -46,6 +51,7 @@
ip_punt_policer_t ip4_punt_policer_cfg = {
.policer_index = ~0,
};
+#endif /* CLIB_MARCH_VARIANT */
static char *ip4_punt_policer_error_strings[] = {
#define _(sym,string) string,
@@ -53,9 +59,9 @@
#undef _
};
-static uword
-ip4_punt_policer (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip4_punt_policer_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return (ip_punt_policer (vm, node, frame,
vnet_feat_arc_ip4_punt.feature_arc_index,
@@ -63,8 +69,7 @@
}
/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (ip4_punt_policer_node, static) = {
- .function = ip4_punt_policer,
+VLIB_REGISTER_NODE (ip4_punt_policer_node) = {
.name = "ip4-punt-policer",
.vector_size = sizeof (u32),
.n_next_nodes = IP_PUNT_POLICER_N_NEXT,
@@ -77,16 +82,14 @@
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (ip4_punt_policer_node,
- ip4_punt_policer);
-
-VNET_FEATURE_INIT (ip4_punt_policer_node, static) = {
+VNET_FEATURE_INIT (ip4_punt_policer_node) = {
.arc_name = "ip4-punt",
.node_name = "ip4-punt-policer",
.runs_before = VNET_FEATURES("ip4-punt-redirect"),
};
/* *INDENT-ON* */
+#ifndef CLIB_MARCH_VARIANT
u8 *
format_ip_punt_redirect_trace (u8 * s, va_list * args)
{
@@ -119,6 +122,7 @@
},
};
/* *INDENT-ON* */
+#endif /* CLIB_MARCH_VARIANT */
#define foreach_ip4_punt_redirect_error \
@@ -138,9 +142,9 @@
#undef _
};
-static uword
-ip4_punt_redirect (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip4_punt_redirect_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return (ip_punt_redirect (vm, node, frame,
vnet_feat_arc_ip4_punt.feature_arc_index,
@@ -148,8 +152,7 @@
}
/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (ip4_punt_redirect_node, static) = {
- .function = ip4_punt_redirect,
+VLIB_REGISTER_NODE (ip4_punt_redirect_node) = {
.name = "ip4-punt-redirect",
.vector_size = sizeof (u32),
.n_next_nodes = IP_PUNT_REDIRECT_N_NEXT,
@@ -165,9 +168,6 @@
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (ip4_punt_redirect_node,
- ip4_punt_redirect);
-
VNET_FEATURE_INIT (ip4_punt_redirect_node, static) = {
.arc_name = "ip4-punt",
.node_name = "ip4-punt-redirect",
@@ -175,8 +175,8 @@
};
/* *INDENT-ON* */
-static uword
-ip4_drop (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip4_drop_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
if (node->flags & VLIB_NODE_FLAG_TRACE)
ip4_forward_next_trace (vm, node, frame, VLIB_TX);
@@ -186,9 +186,9 @@
}
-static uword
-ip4_not_enabled (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip4_not_enabled_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
if (node->flags & VLIB_NODE_FLAG_TRACE)
ip4_forward_next_trace (vm, node, frame, VLIB_TX);
@@ -208,9 +208,8 @@
}
/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (ip4_drop_node, static) =
+VLIB_REGISTER_NODE (ip4_drop_node) =
{
- .function = ip4_drop,
.name = "ip4-drop",
.vector_size = sizeof (u32),
.format_trace = format_ip4_forward_next_trace,
@@ -220,11 +219,8 @@
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (ip4_drop_node, ip4_drop);
-
-VLIB_REGISTER_NODE (ip4_not_enabled_node, static) =
+VLIB_REGISTER_NODE (ip4_not_enabled_node) =
{
- .function = ip4_not_enabled,
.name = "ip4-not-enabled",
.vector_size = sizeof (u32),
.format_trace = format_ip4_forward_next_trace,
@@ -234,9 +230,7 @@
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (ip4_not_enabled_node, ip4_not_enabled);
-
-VLIB_REGISTER_NODE (ip4_punt_node, static) =
+VLIB_REGISTER_NODE (ip4_punt_node) =
{
.function = ip4_punt,
.name = "ip4-punt",
@@ -261,6 +255,7 @@
};
/* *INDENT-ON */
+#ifndef CLIB_MARCH_VARIANT
void
ip4_punt_policer_add_del (u8 is_add, u32 policer_index)
{
@@ -269,6 +264,7 @@
vnet_feature_enable_disable ("ip4-punt", "ip4-punt-policer",
0, is_add, 0, 0);
}
+#endif /* CLIB_MARCH_VARIANT */
static clib_error_t *
ip4_punt_police_cmd (vlib_main_t * vm,
@@ -330,6 +326,7 @@
};
/* *INDENT-ON* */
+#ifndef CLIB_MARCH_VARIANT
/*
* an uninitalised rx-redirect strcut used to pad the vector
*/
@@ -407,6 +404,7 @@
ip_punt_redirect_del (&ip4_punt_redirect_cfg, rx_sw_if_index);
}
+#endif /* CLIB_MARCH_VARIANT */
static clib_error_t *
ip4_punt_redirect_cmd (vlib_main_t * vm,
@@ -487,6 +485,7 @@
};
/* *INDENT-ON* */
+#ifndef CLIB_MARCH_VARIANT
u8 *
format_ip_punt_redirect (u8 * s, va_list * args)
{
@@ -556,6 +555,7 @@
return prs;
}
+#endif /* CLIB_MARCH_VARIANT */
static clib_error_t *
ip4_punt_redirect_show_cmd (vlib_main_t * vm,
diff --git a/src/vnet/ip/ip4_reassembly.c b/src/vnet/ip/ip4_reassembly.c
index 86e5e39..446df33 100644
--- a/src/vnet/ip/ip4_reassembly.c
+++ b/src/vnet/ip/ip4_reassembly.c
@@ -171,7 +171,11 @@
} ip4_reass_main_t;
+extern ip4_reass_main_t ip4_reass_main;
+
+#ifndef CLIB_MARCH_VARIANT
ip4_reass_main_t ip4_reass_main;
+#endif /* CLIB_MARCH_VARIANT */
typedef enum
{
@@ -212,6 +216,9 @@
u32 total_data_len;
} ip4_reass_trace_t;
+extern vlib_node_registration_t ip4_reass_node;
+extern vlib_node_registration_t ip4_reass_node_feature;
+
static void
ip4_reass_trace_details (vlib_main_t * vm, u32 bi,
ip4_reass_range_trace_t * trace)
@@ -235,7 +242,7 @@
return s;
}
-u8 *
+static u8 *
format_ip4_reass_trace (u8 * s, va_list * args)
{
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
@@ -351,7 +358,7 @@
vec_free (to_free);
}
-ip4_reass_t *
+static ip4_reass_t *
ip4_reass_find_or_create (vlib_main_t * vm, ip4_reass_main_t * rm,
ip4_reass_per_thread_t * rt, ip4_reass_kv_t * kv,
u8 * do_handoff)
@@ -1055,16 +1062,14 @@
#undef _
};
-static uword
-ip4_reassembly (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (ip4_reass_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return ip4_reassembly_inline (vm, node, frame, false /* is_feature */ );
}
/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (ip4_reass_node, static) = {
- .function = ip4_reassembly,
+VLIB_REGISTER_NODE (ip4_reass_node) = {
.name = "ip4-reassembly",
.vector_size = sizeof (u32),
.format_trace = format_ip4_reass_trace,
@@ -1081,18 +1086,15 @@
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (ip4_reass_node, ip4_reassembly);
-
-static uword
-ip4_reassembly_feature (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip4_reass_node_feature) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return ip4_reassembly_inline (vm, node, frame, true /* is_feature */ );
}
/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (ip4_reass_node_feature, static) = {
- .function = ip4_reassembly_feature,
+VLIB_REGISTER_NODE (ip4_reass_node_feature) = {
.name = "ip4-reassembly-feature",
.vector_size = sizeof (u32),
.format_trace = format_ip4_reass_trace,
@@ -1108,8 +1110,6 @@
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (ip4_reass_node_feature, ip4_reassembly_feature);
-
/* *INDENT-OFF* */
VNET_FEATURE_INIT (ip4_reassembly_feature, static) = {
.arc_name = "ip4-unicast",
@@ -1119,6 +1119,7 @@
};
/* *INDENT-ON* */
+#ifndef CLIB_MARCH_VARIANT
always_inline u32
ip4_reass_get_nbuckets ()
{
@@ -1135,6 +1136,7 @@
return nbuckets;
}
+#endif /* CLIB_MARCH_VARIANT */
typedef enum
{
@@ -1147,6 +1149,7 @@
clib_bihash_16_8_t *new_hash;
} ip4_rehash_cb_ctx;
+#ifndef CLIB_MARCH_VARIANT
static void
ip4_rehash_cb (clib_bihash_kv_16_8_t * kv, void *_ctx)
{
@@ -1257,6 +1260,7 @@
}
VLIB_INIT_FUNCTION (ip4_reass_init_function);
+#endif /* CLIB_MARCH_VARIANT */
static uword
ip4_reass_walk_expired (vlib_main_t * vm,
@@ -1440,6 +1444,7 @@
};
/* *INDENT-ON* */
+#ifndef CLIB_MARCH_VARIANT
vnet_api_error_t
ip4_reass_enable_disable (u32 sw_if_index, u8 enable_disable)
{
@@ -1447,6 +1452,7 @@
"ip4-reassembly-feature", sw_if_index,
enable_disable, 0, 0);
}
+#endif /* CLIB_MARCH_VARIANT */
#define foreach_ip4_reassembly_handoff_error \
diff --git a/src/vnet/ip/ip4_source_check.c b/src/vnet/ip/ip4_source_check.c
index 2e4226f..b3d4b00 100644
--- a/src/vnet/ip/ip4_source_check.c
+++ b/src/vnet/ip/ip4_source_check.c
@@ -274,19 +274,17 @@
return frame->n_vectors;
}
-static uword
-ip4_source_check_reachable_via_any (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (ip4_check_source_reachable_via_any) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return ip4_source_check_inline (vm, node, frame,
IP4_SOURCE_CHECK_REACHABLE_VIA_ANY);
}
-static uword
-ip4_source_check_reachable_via_rx (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (ip4_check_source_reachable_via_rx) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return ip4_source_check_inline (vm, node, frame,
IP4_SOURCE_CHECK_REACHABLE_VIA_RX);
@@ -294,7 +292,6 @@
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ip4_check_source_reachable_via_any) = {
- .function = ip4_source_check_reachable_via_any,
.name = "ip4-source-check-via-any",
.vector_size = sizeof (u32),
@@ -308,12 +305,8 @@
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (ip4_check_source_reachable_via_any,
- ip4_source_check_reachable_via_any);
-
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ip4_check_source_reachable_via_rx) = {
- .function = ip4_source_check_reachable_via_rx,
.name = "ip4-source-check-via-rx",
.vector_size = sizeof (u32),
@@ -327,9 +320,6 @@
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (ip4_check_source_reachable_via_rx,
- ip4_source_check_reachable_via_rx);
-
static clib_error_t *
set_ip_source_check (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
@@ -535,6 +525,7 @@
/* *INDENT-ON* */
+#ifndef CLIB_MARCH_VARIANT
/* Dummy init function to get us linked in. */
clib_error_t *
ip4_source_check_init (vlib_main_t * vm)
@@ -543,6 +534,7 @@
}
VLIB_INIT_FUNCTION (ip4_source_check_init);
+#endif /* CLIB_MARCH_VARIANT */
/*
* fd.io coding-style-patch-verification: ON
diff --git a/src/vnet/ip/ip6_hop_by_hop.c b/src/vnet/ip/ip6_hop_by_hop.c
index 38cdbff..da01970 100644
--- a/src/vnet/ip/ip6_hop_by_hop.c
+++ b/src/vnet/ip/ip6_hop_by_hop.c
@@ -41,7 +41,9 @@
* in-band OAM can be enabled for IPv6 traffic.
*/
+#ifndef CLIB_MARCH_VARIANT
ip6_hop_by_hop_ioam_main_t ip6_hop_by_hop_ioam_main;
+#endif /* CLIB_MARCH_VARIANT */
#define foreach_ip6_hbyh_ioam_input_next \
_(IP6_REWRITE, "ip6-rewrite") \
@@ -56,6 +58,7 @@
IP6_HBYH_IOAM_INPUT_N_NEXT,
} ip6_hbyh_ioam_input_next_t;
+#ifndef CLIB_MARCH_VARIANT
static uword
unformat_opaque_ioam (unformat_input_t * input, va_list * args)
{
@@ -196,6 +199,7 @@
hm->flow_handler[option] = NULL;
return (0);
}
+#endif /* CLIB_MARCH_VARIANT */
typedef struct
{
@@ -215,7 +219,7 @@
return s;
}
-vlib_node_registration_t ip6_add_hop_by_hop_node;
+extern vlib_node_registration_t ip6_add_hop_by_hop_node;
#define foreach_ip6_add_hop_by_hop_error \
_(PROCESSED, "Pkts w/ added ip6 hop-by-hop options")
@@ -234,9 +238,9 @@
#undef _
};
-static uword
-ip6_add_hop_by_hop_node_fn (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip6_add_hop_by_hop_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main;
u32 n_left_from, *from, *to_next;
@@ -437,7 +441,7 @@
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ip6_add_hop_by_hop_node) = /* *INDENT-OFF* */
{
- .function = ip6_add_hop_by_hop_node_fn,.name =
+ .name =
"ip6-add-hop-by-hop",.vector_size = sizeof (u32),.format_trace =
format_ip6_add_hop_by_hop_trace,.type =
VLIB_NODE_TYPE_INTERNAL,.n_errors =
@@ -455,8 +459,6 @@
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_add_hop_by_hop_node,
- ip6_add_hop_by_hop_node_fn);
/* The main h-b-h tracer was already invoked, no need to do much here */
typedef struct
{
@@ -476,6 +478,7 @@
return s;
}
+#ifndef CLIB_MARCH_VARIANT
int
ip6_hbh_pop_register_option (u8 option,
int options (vlib_buffer_t * b,
@@ -509,8 +512,9 @@
hm->pop_options[option] = NULL;
return (0);
}
+#endif /* CLIB_MARCH_VARIANT */
-vlib_node_registration_t ip6_pop_hop_by_hop_node;
+extern vlib_node_registration_t ip6_pop_hop_by_hop_node;
#define foreach_ip6_pop_hop_by_hop_error \
_(PROCESSED, "Pkts w/ removed ip6 hop-by-hop options") \
@@ -577,9 +581,9 @@
}
}
-static uword
-ip6_pop_hop_by_hop_node_fn (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip6_pop_hop_by_hop_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
u32 n_left_from, *from, *to_next;
ip_lookup_next_t next_index;
@@ -779,7 +783,7 @@
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ip6_pop_hop_by_hop_node) =
{
- .function = ip6_pop_hop_by_hop_node_fn,.name =
+ .name =
"ip6-pop-hop-by-hop",.vector_size = sizeof (u32),.format_trace =
format_ip6_pop_hop_by_hop_trace,.type =
VLIB_NODE_TYPE_INTERNAL,.sibling_of = "ip6-lookup",.n_errors =
@@ -790,8 +794,7 @@
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_pop_hop_by_hop_node,
- ip6_pop_hop_by_hop_node_fn);
+#ifndef CLIB_MARCH_VARIANT
static clib_error_t *
ip6_hop_by_hop_ioam_init (vlib_main_t * vm)
{
@@ -1157,6 +1160,7 @@
hm->ioam_end_of_path_cb = cb;
}
+#endif /* CLIB_MARCH_VARIANT */
/*
* fd.io coding-style-patch-verification: ON
*
diff --git a/src/vnet/ip/ip6_input.c b/src/vnet/ip/ip6_input.c
index a01920a..0450064 100644
--- a/src/vnet/ip/ip6_input.c
+++ b/src/vnet/ip/ip6_input.c
@@ -62,8 +62,8 @@
/* Validate IP v6 packets and pass them either to forwarding code
or drop exception packets. */
-static uword
-ip6_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip6_input_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
vnet_main_t *vnm = vnet_get_main ();
ip6_main_t *im = &ip6_main;
@@ -218,15 +218,16 @@
return frame->n_vectors;
}
+#ifndef CLIB_MARCH_VARIANT
char *ip6_error_strings[] = {
#define _(sym,string) string,
foreach_ip6_error
#undef _
};
+#endif /* CLIB_MARCH_VARIANT */
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ip6_input_node) = {
- .function = ip6_input,
.name = "ip6-input",
.vector_size = sizeof (u32),
@@ -246,8 +247,6 @@
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_input_node, ip6_input);
-
static clib_error_t *
ip6_init (vlib_main_t * vm)
{
diff --git a/src/vnet/ip/ip6_punt_drop.c b/src/vnet/ip/ip6_punt_drop.c
index 3c839ff..d1145fb 100644
--- a/src/vnet/ip/ip6_punt_drop.c
+++ b/src/vnet/ip/ip6_punt_drop.c
@@ -32,7 +32,11 @@
};
/* *INDENT-ON* */
+extern ip_punt_policer_t ip6_punt_policer_cfg;
+
+#ifndef CLIB_MARCH_VARIANT
ip_punt_policer_t ip6_punt_policer_cfg;
+#endif /* CLIB_MARCH_VARIANT */
static char *ip6_punt_policer_error_strings[] = {
#define _(sym,string) string,
@@ -40,9 +44,9 @@
#undef _
};
-static uword
-ip6_punt_policer (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip6_punt_policer_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return (ip_punt_policer (vm, node, frame,
vnet_feat_arc_ip6_punt.feature_arc_index,
@@ -52,8 +56,7 @@
/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (ip6_punt_policer_node, static) = {
- .function = ip6_punt_policer,
+VLIB_REGISTER_NODE (ip6_punt_policer_node) = {
.name = "ip6-punt-policer",
.vector_size = sizeof (u32),
.n_next_nodes = IP_PUNT_POLICER_N_NEXT,
@@ -67,9 +70,6 @@
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_punt_policer_node,
- ip6_punt_policer);
-
VNET_FEATURE_INIT (ip6_punt_policer_node, static) = {
.arc_name = "ip6-punt",
.node_name = "ip6-punt-policer",
@@ -77,8 +77,8 @@
};
/* *INDENT-ON* */
-static uword
-ip6_drop (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip6_drop_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
if (node->flags & VLIB_NODE_FLAG_TRACE)
ip6_forward_next_trace (vm, node, frame, VLIB_TX);
@@ -88,9 +88,9 @@
}
-static uword
-ip6_not_enabled (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip6_not_enabled_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
if (node->flags & VLIB_NODE_FLAG_TRACE)
ip6_forward_next_trace (vm, node, frame, VLIB_TX);
@@ -100,8 +100,8 @@
}
-static uword
-ip6_punt (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip6_punt_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
if (node->flags & VLIB_NODE_FLAG_TRACE)
ip6_forward_next_trace (vm, node, frame, VLIB_TX);
@@ -111,9 +111,8 @@
}
/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (ip6_drop_node, static) =
+VLIB_REGISTER_NODE (ip6_drop_node) =
{
- .function = ip6_drop,
.name = "ip6-drop",
.vector_size = sizeof (u32),
.format_trace = format_ip6_forward_next_trace,
@@ -123,11 +122,8 @@
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_drop_node, ip6_drop);
-
-VLIB_REGISTER_NODE (ip6_not_enabled_node, static) =
+VLIB_REGISTER_NODE (ip6_not_enabled_node) =
{
- .function = ip6_not_enabled,
.name = "ip6-not-enabled",
.vector_size = sizeof (u32),
.format_trace = format_ip6_forward_next_trace,
@@ -137,11 +133,8 @@
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_not_enabled_node, ip6_not_enabled);
-
-VLIB_REGISTER_NODE (ip6_punt_node, static) =
+VLIB_REGISTER_NODE (ip6_punt_node) =
{
- .function = ip6_punt,
.name = "ip6-punt",
.vector_size = sizeof (u32),
.format_trace = format_ip6_forward_next_trace,
@@ -151,8 +144,6 @@
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_punt_node, ip6_punt);
-
VNET_FEATURE_INIT (ip6_punt_end_of_arc, static) = {
.arc_name = "ip6-punt",
.node_name = "error-punt",
@@ -166,6 +157,7 @@
};
/* *INDENT-ON */
+#ifndef CLIB_MARCH_VARIANT
void
ip6_punt_policer_add_del (u8 is_add, u32 policer_index)
{
@@ -174,6 +166,7 @@
vnet_feature_enable_disable ("ip6-punt", "ip6-punt-policer",
0, is_add, 0, 0);
}
+#endif /* CLIB_MARCH_VARIANT */
static clib_error_t *
ip6_punt_police_cmd (vlib_main_t * vm,
@@ -234,13 +227,16 @@
.short_help = "ip6 punt policer [add|del] <index>",
};
+extern ip_punt_redirect_t ip6_punt_redirect_cfg;
+#ifndef CLIB_MARCH_VARIANT
ip_punt_redirect_t ip6_punt_redirect_cfg = {
.any_rx_sw_if_index = {
.tx_sw_if_index = ~0,
.adj_index = ADJ_INDEX_INVALID,
},
};
+#endif /* CLIB_MARCH_VARIANT */
/* *INDENT-ON* */
#define foreach_ip6_punt_redirect_error \
@@ -260,9 +256,9 @@
#undef _
};
-static uword
-ip6_punt_redirect (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip6_punt_redirect_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return (ip_punt_redirect (vm, node, frame,
vnet_feat_arc_ip6_punt.feature_arc_index,
@@ -270,8 +266,7 @@
}
/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (ip6_punt_redirect_node, static) = {
- .function = ip6_punt_redirect,
+VLIB_REGISTER_NODE (ip6_punt_redirect_node) = {
.name = "ip6-punt-redirect",
.vector_size = sizeof (u32),
.n_next_nodes = IP_PUNT_REDIRECT_N_NEXT,
@@ -287,9 +282,6 @@
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_punt_redirect_node,
- ip6_punt_redirect);
-
VNET_FEATURE_INIT (ip6_punt_redirect_node, static) = {
.arc_name = "ip6-punt",
.node_name = "ip6-punt-redirect",
@@ -297,6 +289,7 @@
};
/* *INDENT-ON* */
+#ifndef CLIB_MARCH_VARIANT
void
ip6_punt_redirect_add (u32 rx_sw_if_index,
u32 tx_sw_if_index, ip46_address_t * nh)
@@ -319,6 +312,7 @@
ip_punt_redirect_del (&ip6_punt_redirect_cfg, rx_sw_if_index);
}
+#endif /* CLIB_MARCH_VARIANT */
static clib_error_t *
ip6_punt_redirect_cmd (vlib_main_t * vm,
@@ -399,6 +393,7 @@
};
/* *INDENT-ON* */
+#ifndef CLIB_MARCH_VARIANT
ip_punt_redirect_detail_t *
ip6_punt_redirect_entries (u32 sw_if_index)
{
@@ -438,6 +433,7 @@
return prs;
}
+#endif /* CLIB_MARCH_VARIANT */
static clib_error_t *
ip6_punt_redirect_show_cmd (vlib_main_t * vm,
diff --git a/src/vnet/ip/ip6_reassembly.c b/src/vnet/ip/ip6_reassembly.c
index 0c86145..9906250 100644
--- a/src/vnet/ip/ip6_reassembly.c
+++ b/src/vnet/ip/ip6_reassembly.c
@@ -151,7 +151,11 @@
} ip6_reass_main_t;
+extern ip6_reass_main_t ip6_reass_main;
+
+#ifndef CLIB_MARCH_VARIANT
ip6_reass_main_t ip6_reass_main;
+#endif /* CLIB_MARCH_VARIANT */
typedef enum
{
@@ -1046,16 +1050,14 @@
#undef _
};
-static uword
-ip6_reassembly (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (ip6_reass_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return ip6_reassembly_inline (vm, node, frame, false /* is_feature */ );
}
/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (ip6_reass_node, static) = {
- .function = ip6_reassembly,
+VLIB_REGISTER_NODE (ip6_reass_node) = {
.name = "ip6-reassembly",
.vector_size = sizeof (u32),
.format_trace = format_ip6_reass_trace,
@@ -1072,18 +1074,15 @@
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_reass_node, ip6_reassembly);
-
-static uword
-ip6_reassembly_feature (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip6_reass_node_feature) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return ip6_reassembly_inline (vm, node, frame, true /* is_feature */ );
}
/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (ip6_reass_node_feature, static) = {
- .function = ip6_reassembly_feature,
+VLIB_REGISTER_NODE (ip6_reass_node_feature) = {
.name = "ip6-reassembly-feature",
.vector_size = sizeof (u32),
.format_trace = format_ip6_reass_trace,
@@ -1100,8 +1099,6 @@
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_reass_node_feature, ip6_reassembly_feature);
-
/* *INDENT-OFF* */
VNET_FEATURE_INIT (ip6_reassembly_feature, static) = {
.arc_name = "ip6-unicast",
@@ -1111,6 +1108,7 @@
};
/* *INDENT-ON* */
+#ifndef CLIB_MARCH_VARIANT
static u32
ip6_reass_get_nbuckets ()
{
@@ -1127,12 +1125,14 @@
return nbuckets;
}
+#endif /* CLIB_MARCH_VARIANT */
typedef enum
{
IP6_EVENT_CONFIG_CHANGED = 1,
} ip6_reass_event_t;
+#ifndef CLIB_MARCH_VARIANT
typedef struct
{
int failure;
@@ -1256,6 +1256,7 @@
}
VLIB_INIT_FUNCTION (ip6_reass_init_function);
+#endif /* CLIB_MARCH_VARIANT */
static uword
ip6_reass_walk_expired (vlib_main_t * vm,
@@ -1379,8 +1380,6 @@
return 0;
}
-static vlib_node_registration_t ip6_reass_expire_node;
-
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ip6_reass_expire_node, static) = {
.function = ip6_reass_walk_expired,
@@ -1493,12 +1492,14 @@
};
/* *INDENT-ON* */
+#ifndef CLIB_MARCH_VARIANT
vnet_api_error_t
ip6_reass_enable_disable (u32 sw_if_index, u8 enable_disable)
{
return vnet_feature_enable_disable ("ip6-unicast", "ip6-reassembly-feature",
sw_if_index, enable_disable, 0, 0);
}
+#endif /* CLIB_MARCH_VARIANT */
#define foreach_ip6_reassembly_handoff_error \
_(CONGESTION_DROP, "congestion drop")
diff --git a/src/vnet/ip/ip_in_out_acl.c b/src/vnet/ip/ip_in_out_acl.c
index 699f69e..8f550e2 100644
--- a/src/vnet/ip/ip_in_out_acl.c
+++ b/src/vnet/ip/ip_in_out_acl.c
@@ -50,10 +50,10 @@
return format_ip_in_out_acl_trace (s, 1 /* is_output */ , args);
}
-vlib_node_registration_t ip4_inacl_node;
-vlib_node_registration_t ip4_outacl_node;
-vlib_node_registration_t ip6_inacl_node;
-vlib_node_registration_t ip6_outacl_node;
+extern vlib_node_registration_t ip4_inacl_node;
+extern vlib_node_registration_t ip4_outacl_node;
+extern vlib_node_registration_t ip6_inacl_node;
+extern vlib_node_registration_t ip6_outacl_node;
#define foreach_ip_inacl_error \
_(MISS, "input ACL misses") \
@@ -486,16 +486,15 @@
return frame->n_vectors;
}
-static uword
-ip4_inacl (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip4_inacl_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return ip_in_out_acl_inline (vm, node, frame, 1 /* is_ip4 */ ,
0 /* is_output */ );
}
-static uword
-ip4_outacl (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (ip4_outacl_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return ip_in_out_acl_inline (vm, node, frame, 1 /* is_ip4 */ ,
1 /* is_output */ );
@@ -504,7 +503,6 @@
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ip4_inacl_node) = {
- .function = ip4_inacl,
.name = "ip4-inacl",
.vector_size = sizeof (u32),
.format_trace = format_ip_inacl_trace,
@@ -518,7 +516,6 @@
};
VLIB_REGISTER_NODE (ip4_outacl_node) = {
- .function = ip4_outacl,
.name = "ip4-outacl",
.vector_size = sizeof (u32),
.format_trace = format_ip_outacl_trace,
@@ -532,19 +529,15 @@
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (ip4_inacl_node, ip4_inacl);
-VLIB_NODE_FUNCTION_MULTIARCH (ip4_outacl_node, ip4_outacl);
-
-static uword
-ip6_inacl (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip6_inacl_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return ip_in_out_acl_inline (vm, node, frame, 0 /* is_ip4 */ ,
0 /* is_output */ );
}
-static uword
-ip6_outacl (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (ip6_outacl_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return ip_in_out_acl_inline (vm, node, frame, 0 /* is_ip4 */ ,
1 /* is_output */ );
@@ -552,7 +545,6 @@
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ip6_inacl_node) = {
- .function = ip6_inacl,
.name = "ip6-inacl",
.vector_size = sizeof (u32),
.format_trace = format_ip_inacl_trace,
@@ -566,7 +558,6 @@
};
VLIB_REGISTER_NODE (ip6_outacl_node) = {
- .function = ip6_outacl,
.name = "ip6-outacl",
.vector_size = sizeof (u32),
.format_trace = format_ip_outacl_trace,
@@ -580,9 +571,7 @@
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_inacl_node, ip6_inacl);
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_outacl_node, ip6_outacl);
-
+#ifndef CLIB_MARCH_VARIANT
static clib_error_t *
ip_in_out_acl_init (vlib_main_t * vm)
{
@@ -590,6 +579,7 @@
}
VLIB_INIT_FUNCTION (ip_in_out_acl_init);
+#endif /* CLIB_MARCH_VARIANT */
/*
diff --git a/src/vnet/ip/punt.c b/src/vnet/ip/punt.c
index e1c13f6..831ece2 100644
--- a/src/vnet/ip/punt.c
+++ b/src/vnet/ip/punt.c
@@ -60,12 +60,15 @@
#define punt_next_punt(is_ip4) (is_ip4 ? PUNT_NEXT_PUNT4 : PUNT_NEXT_PUNT6)
-vlib_node_registration_t udp4_punt_node;
-vlib_node_registration_t udp6_punt_node;
-vlib_node_registration_t udp4_punt_socket_node;
-vlib_node_registration_t udp6_punt_socket_node;
+extern vlib_node_registration_t udp4_punt_node;
+extern vlib_node_registration_t udp6_punt_node;
+extern vlib_node_registration_t udp4_punt_socket_node;
+extern vlib_node_registration_t udp6_punt_socket_node;
static vlib_node_registration_t punt_socket_rx_node;
+extern punt_main_t punt_main;
+
+#ifndef CLIB_MARCH_VARIANT
punt_main_t punt_main;
char *
@@ -74,6 +77,7 @@
punt_main_t *pm = &punt_main;
return pm->sun_path;
}
+#endif /* CLIB_MARCH_VARIANT */
/** @brief IPv4/IPv6 UDP punt node main loop.
@@ -159,9 +163,9 @@
<em>Next Index:</em>
- Dispatches the packet to the "error-punt" node
*/
-static uword
-udp4_punt (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * from_frame)
+VLIB_NODE_FN (udp4_punt_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * from_frame)
{
return udp46_punt_inline (vm, node, from_frame, 1 /* is_ip4 */ );
}
@@ -187,16 +191,15 @@
<em>Next Index:</em>
- Dispatches the packet to the "error-punt" node
*/
-static uword
-udp6_punt (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * from_frame)
+VLIB_NODE_FN (udp6_punt_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * from_frame)
{
return udp46_punt_inline (vm, node, from_frame, 0 /* is_ip4 */ );
}
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (udp4_punt_node) = {
- .function = udp4_punt,
.name = "ip4-udp-punt",
/* Takes a vector of packets. */
.vector_size = sizeof (u32),
@@ -212,10 +215,7 @@
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (udp4_punt_node, udp4_punt);
-
VLIB_REGISTER_NODE (udp6_punt_node) = {
- .function = udp6_punt,
.name = "ip6-udp-punt",
/* Takes a vector of packets. */
.vector_size = sizeof (u32),
@@ -231,8 +231,6 @@
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (udp6_punt_node, udp6_punt);;
-
/* *INDENT-ON* */
static punt_client_t *
@@ -259,6 +257,7 @@
return NULL;
}
+#ifndef CLIB_MARCH_VARIANT
static int
punt_socket_register (bool is_ip4, u8 protocol, u16 port,
char *client_pathname)
@@ -288,6 +287,7 @@
{
return;
}
+#endif /* CLIB_MARCH_VARIANT */
typedef struct
{
@@ -295,7 +295,7 @@
u8 is_midchain;
} udp_punt_trace_t;
-u8 *
+static u8 *
format_udp_punt_trace (u8 * s, va_list * args)
{
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
@@ -637,6 +637,7 @@
return 0;
}
+#ifndef CLIB_MARCH_VARIANT
clib_error_t *
vnet_punt_socket_add (vlib_main_t * vm, u32 header_version,
bool is_ip4, u8 protocol, u16 port,
@@ -772,6 +773,7 @@
return 0;
}
}
+#endif /* CLIB_MARCH_VARIANT */
static clib_error_t *
punt_cli (vlib_main_t * vm,
@@ -841,6 +843,7 @@
};
/* *INDENT-ON* */
+#ifndef CLIB_MARCH_VARIANT
static clib_error_t *
punt_socket_register_cmd (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
@@ -1075,6 +1078,7 @@
}
VLIB_INIT_FUNCTION (punt_init);
+#endif /* CLIB_MARCH_VARIANT */
static clib_error_t *
punt_config (vlib_main_t * vm, unformat_input_t * input)