l2: migrate old MULTIARCH macros to VLIB_NODE_FN

Change-Id: I8370c06150ce4499475e9d6dc6b3ab8be2016202
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt
index 73fbf3c..c5ad47e 100644
--- a/src/vnet/CMakeLists.txt
+++ b/src/vnet/CMakeLists.txt
@@ -181,6 +181,17 @@
   l2/l2_learn.c
   l2/l2_output.c
   l2/l2_patch.c
+  l2/l2_in_out_feat_arc.c
+  l2/l2_input_classify.c
+  l2/l2_input.c
+  l2/l2_output_classify.c
+  l2/l2_flood.c
+  l2/l2_uu_fwd.c
+  l2/l2_efp_filter.c
+  l2/l2_rw.c
+  l2/l2_xcrw.c
+  l2/l2_in_out_acl.c
+  l2/l2_input_vtr.c
 )
 
 list(APPEND VNET_HEADERS
diff --git a/src/vnet/l2/l2_efp_filter.c b/src/vnet/l2/l2_efp_filter.c
index 69d40a0..3d152ad 100644
--- a/src/vnet/l2/l2_efp_filter.c
+++ b/src/vnet/l2/l2_efp_filter.c
@@ -22,6 +22,7 @@
 #include <vnet/l2/feat_bitmap.h>
 #include <vnet/l2/l2_output.h>
 #include <vnet/ethernet/ethernet.h>
+#include <vnet/l2/l2_efp_filter.h>
 
 #include <vppinfra/error.h>
 #include <vppinfra/cache.h>
@@ -80,9 +81,11 @@
   return s;
 }
 
-l2_efp_filter_main_t l2_efp_filter_main;
+extern l2_efp_filter_main_t l2_efp_filter_main;
 
-static vlib_node_registration_t l2_efp_filter_node;
+#ifndef CLIB_MARCH_VARIANT
+l2_efp_filter_main_t l2_efp_filter_main;
+#endif /* CLIB_MARCH_VARIANT */
 
 #define foreach_l2_efp_filter_error			\
 _(L2_EFP_FILTER, "L2 EFP filter packets")		\
@@ -169,9 +172,9 @@
  * The post-rewrite check is performed here.
  */
 
-static uword
-l2_efp_filter_node_fn (vlib_main_t * vm,
-		       vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (l2_efp_filter_node) (vlib_main_t * vm,
+				   vlib_node_runtime_t * node,
+				   vlib_frame_t * frame)
 {
   u32 n_left_from, *from, *to_next;
   l2_efp_filter_next_t next_index;
@@ -457,8 +460,7 @@
 
 
 /* *INDENT-OFF* */
-VLIB_REGISTER_NODE (l2_efp_filter_node,static) = {
-  .function = l2_efp_filter_node_fn,
+VLIB_REGISTER_NODE (l2_efp_filter_node) = {
   .name = "l2-efp-filter",
   .vector_size = sizeof (u32),
   .format_trace = format_l2_efp_filter_trace,
@@ -476,8 +478,9 @@
 };
 /* *INDENT-ON* */
 
-VLIB_NODE_FUNCTION_MULTIARCH (l2_efp_filter_node, l2_efp_filter_node_fn)
-     clib_error_t *l2_efp_filter_init (vlib_main_t * vm)
+#ifndef CLIB_MARCH_VARIANT
+clib_error_t *
+l2_efp_filter_init (vlib_main_t * vm)
 {
   l2_efp_filter_main_t *mp = &l2_efp_filter_main;
 
@@ -562,6 +565,7 @@
 };
 /* *INDENT-ON* */
 
+#endif /* CLIB_MARCH_VARIANT */
 
 /*
  * fd.io coding-style-patch-verification: ON
diff --git a/src/vnet/l2/l2_efp_filter.h b/src/vnet/l2/l2_efp_filter.h
index f40851d..4bd4358 100644
--- a/src/vnet/l2/l2_efp_filter.h
+++ b/src/vnet/l2/l2_efp_filter.h
@@ -22,6 +22,8 @@
 #include <vlib/vlib.h>
 #include <vnet/vnet.h>
 
+extern vlib_node_registration_t l2_efp_filter_node;
+
 #endif
 
 /*
diff --git a/src/vnet/l2/l2_flood.c b/src/vnet/l2/l2_flood.c
index 3198d32..1bc5281 100644
--- a/src/vnet/l2/l2_flood.c
+++ b/src/vnet/l2/l2_flood.c
@@ -87,9 +87,11 @@
   return s;
 }
 
-l2flood_main_t l2flood_main;
+extern l2flood_main_t l2flood_main;
 
-static vlib_node_registration_t l2flood_node;
+#ifndef CLIB_MARCH_VARIANT
+l2flood_main_t l2flood_main;
+#endif /* CLIB_MARCH_VARIANT */
 
 #define foreach_l2flood_error					\
 _(L2FLOOD,           "L2 flood packets")			\
@@ -134,9 +136,8 @@
  * could be turned into an ICMP reply. If BVI processing is not performed
  * last, the modified packet would be replicated to the remaining members.
  */
-static uword
-l2flood_node_fn (vlib_main_t * vm,
-		 vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (l2flood_node) (vlib_main_t * vm,
+			     vlib_node_runtime_t * node, vlib_frame_t * frame)
 {
   u32 n_left_from, *from, *to_next;
   l2flood_next_t next_index;
@@ -362,8 +363,7 @@
 
 
 /* *INDENT-OFF* */
-VLIB_REGISTER_NODE (l2flood_node,static) = {
-  .function = l2flood_node_fn,
+VLIB_REGISTER_NODE (l2flood_node) = {
   .name = "l2-flood",
   .vector_size = sizeof (u32),
   .format_trace = format_l2flood_trace,
@@ -380,10 +380,9 @@
         [L2FLOOD_NEXT_DROP] = "error-drop",
   },
 };
-
-VLIB_NODE_FUNCTION_MULTIARCH (l2flood_node, l2flood_node_fn)
 /* *INDENT-ON* */
 
+#ifndef CLIB_MARCH_VARIANT
 clib_error_t *
 l2flood_init (vlib_main_t * vm)
 {
@@ -421,6 +420,7 @@
 
   next_by_ethertype_register (&mp->l3_next, type, next_index);
 }
+#endif /* CLIB_MARCH_VARIANT */
 
 
 /**
diff --git a/src/vnet/l2/l2_in_out_acl.c b/src/vnet/l2/l2_in_out_acl.c
index 1ca1361..50e87f3 100644
--- a/src/vnet/l2/l2_in_out_acl.c
+++ b/src/vnet/l2/l2_in_out_acl.c
@@ -80,10 +80,14 @@
   return format_l2_in_out_acl_trace (s, IN_OUT_ACL_OUTPUT_TABLE_GROUP, args);
 }
 
-l2_in_out_acl_main_t l2_in_out_acl_main;
+extern l2_in_out_acl_main_t l2_in_out_acl_main;
 
-static vlib_node_registration_t l2_inacl_node;
-static vlib_node_registration_t l2_outacl_node;
+#ifndef CLIB_MARCH_VARIANT
+l2_in_out_acl_main_t l2_in_out_acl_main;
+#endif /* CLIB_MARCH_VARIANT */
+
+extern vlib_node_registration_t l2_inacl_node;
+extern vlib_node_registration_t l2_outacl_node;
 
 #define foreach_l2_inacl_error                  \
 _(NONE, "valid input ACL packets")              \
@@ -445,25 +449,24 @@
   return frame->n_vectors;
 }
 
-static uword
-l2_inacl_node_fn (vlib_main_t * vm,
-		  vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (l2_inacl_node) (vlib_main_t * vm,
+			      vlib_node_runtime_t * node,
+			      vlib_frame_t * frame)
 {
   return l2_in_out_acl_node_fn (vm, node, frame,
 				IN_OUT_ACL_INPUT_TABLE_GROUP);
 }
 
-static uword
-l2_outacl_node_fn (vlib_main_t * vm,
-		   vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (l2_outacl_node) (vlib_main_t * vm,
+			       vlib_node_runtime_t * node,
+			       vlib_frame_t * frame)
 {
   return l2_in_out_acl_node_fn (vm, node, frame,
 				IN_OUT_ACL_OUTPUT_TABLE_GROUP);
 }
 
 /* *INDENT-OFF* */
-VLIB_REGISTER_NODE (l2_inacl_node,static) = {
-  .function = l2_inacl_node_fn,
+VLIB_REGISTER_NODE (l2_inacl_node) = {
   .name = "l2-input-acl",
   .vector_size = sizeof (u32),
   .format_trace = format_l2_inacl_trace,
@@ -480,8 +483,7 @@
   },
 };
 
-VLIB_REGISTER_NODE (l2_outacl_node,static) = {
-  .function = l2_outacl_node_fn,
+VLIB_REGISTER_NODE (l2_outacl_node) = {
   .name = "l2-output-acl",
   .vector_size = sizeof (u32),
   .format_trace = format_l2_outacl_trace,
@@ -497,12 +499,10 @@
        [ACL_NEXT_INDEX_DENY]  = "error-drop",
   },
 };
-
-VLIB_NODE_FUNCTION_MULTIARCH (l2_inacl_node, l2_inacl_node_fn)
-VLIB_NODE_FUNCTION_MULTIARCH (l2_outacl_node, l2_outacl_node_fn)
 /* *INDENT-ON* */
 
 
+#ifndef CLIB_MARCH_VARIANT
 clib_error_t *
 l2_in_out_acl_init (vlib_main_t * vm)
 {
@@ -527,6 +527,7 @@
 }
 
 VLIB_INIT_FUNCTION (l2_in_out_acl_init);
+#endif /* CLIB_MARCH_VARIANT */
 
 /*
  * fd.io coding-style-patch-verification: ON
diff --git a/src/vnet/l2/l2_in_out_feat_arc.c b/src/vnet/l2/l2_in_out_feat_arc.c
index 083a720..8717ea9 100644
--- a/src/vnet/l2/l2_in_out_feat_arc.c
+++ b/src/vnet/l2/l2_in_out_feat_arc.c
@@ -128,8 +128,11 @@
 #undef _
 };
 
+extern l2_in_out_feat_arc_main_t l2_in_out_feat_arc_main;
 
+#ifndef CLIB_MARCH_VARIANT
 l2_in_out_feat_arc_main_t l2_in_out_feat_arc_main;
+#endif /* CLIB_MARCH_VARIANT */
 
 #define get_u16(addr) ( *((u16 *)(addr)) )
 #define L2_FEAT_ARC_VEC_SIZE 2
@@ -332,10 +335,9 @@
   return frame->n_vectors;
 }
 
-static vlib_node_registration_t l2_in_feat_arc_node;
-static uword
-l2_in_feat_arc_node_fn (vlib_main_t * vm,
-			vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (l2_in_feat_arc_node) (vlib_main_t * vm,
+				    vlib_node_runtime_t * node,
+				    vlib_frame_t * frame)
 {
   if (PREDICT_FALSE (node->flags & VLIB_NODE_FLAG_TRACE))
     return l2_in_out_feat_arc_node_fn (vm, node, frame,
@@ -347,10 +349,9 @@
 				       &l2_in_feat_arc_node, 1, 0);
 }
 
-static vlib_node_registration_t l2_out_feat_arc_node;
-static uword
-l2_out_feat_arc_node_fn (vlib_main_t * vm,
-			 vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (l2_out_feat_arc_node) (vlib_main_t * vm,
+				     vlib_node_runtime_t * node,
+				     vlib_frame_t * frame)
 {
   if (PREDICT_FALSE (node->flags & VLIB_NODE_FLAG_TRACE))
     return l2_in_out_feat_arc_node_fn (vm, node, frame,
@@ -362,10 +363,9 @@
 				       &l2_out_feat_arc_node, 1, 0);
 }
 
-static vlib_node_registration_t l2_in_feat_arc_end_node;
-static uword
-l2_in_feat_arc_end_node_fn (vlib_main_t * vm,
-			    vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (l2_in_feat_arc_end_node) (vlib_main_t * vm,
+					vlib_node_runtime_t * node,
+					vlib_frame_t * frame)
 {
   if (PREDICT_FALSE (node->flags & VLIB_NODE_FLAG_TRACE))
     return l2_in_out_feat_arc_node_fn (vm, node, frame,
@@ -377,10 +377,9 @@
 				       &l2_in_feat_arc_end_node, 0, 0);
 }
 
-static vlib_node_registration_t l2_out_feat_arc_end_node;
-static uword
-l2_out_feat_arc_end_node_fn (vlib_main_t * vm,
-			     vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (l2_out_feat_arc_end_node) (vlib_main_t * vm,
+					 vlib_node_runtime_t * node,
+					 vlib_frame_t * frame)
 {
   if (PREDICT_FALSE (node->flags & VLIB_NODE_FLAG_TRACE))
     return l2_in_out_feat_arc_node_fn (vm, node, frame,
@@ -393,6 +392,7 @@
 }
 
 
+#ifndef CLIB_MARCH_VARIANT
 void
 vnet_l2_in_out_feat_arc_enable_disable (u32 sw_if_index, int is_output,
 					int enable_disable)
@@ -404,6 +404,7 @@
     l2input_intf_bitmap_enable (sw_if_index, L2INPUT_FEAT_INPUT_FEAT_ARC,
 				(u32) enable_disable);
 }
+#endif /* CLIB_MARCH_VARIANT */
 
 /* *INDENT-OFF* */
 VNET_FEATURE_ARC_INIT (l2_in_ip4_arc, static) =
@@ -451,9 +452,8 @@
 
 
 /* *INDENT-OFF* */
-VLIB_REGISTER_NODE (l2_in_feat_arc_node,static) = {
+VLIB_REGISTER_NODE (l2_in_feat_arc_node) = {
   .name = "l2-input-feat-arc",
-  .function = l2_in_feat_arc_node_fn,
   .vector_size = sizeof (u32),
   .format_trace = format_l2_in_feat_arc_trace,
   .type = VLIB_NODE_TYPE_INTERNAL,
@@ -463,9 +463,8 @@
 
 };
 
-VLIB_REGISTER_NODE (l2_out_feat_arc_node,static) = {
+VLIB_REGISTER_NODE (l2_out_feat_arc_node) = {
   .name = "l2-output-feat-arc",
-  .function = l2_out_feat_arc_node_fn,
   .vector_size = sizeof (u32),
   .format_trace = format_l2_out_feat_arc_trace,
   .type = VLIB_NODE_TYPE_INTERNAL,
@@ -475,17 +474,15 @@
 
 };
 
-VLIB_REGISTER_NODE (l2_in_feat_arc_end_node,static) = {
+VLIB_REGISTER_NODE (l2_in_feat_arc_end_node) = {
   .name = "l2-input-feat-arc-end",
-  .function = l2_in_feat_arc_end_node_fn,
   .vector_size = sizeof (u32),
   .format_trace = format_l2_in_feat_arc_trace,
   .sibling_of = "l2-input-feat-arc",
 };
 
-VLIB_REGISTER_NODE (l2_out_feat_arc_end_node,static) = {
+VLIB_REGISTER_NODE (l2_out_feat_arc_end_node) = {
   .name = "l2-output-feat-arc-end",
-  .function = l2_out_feat_arc_end_node_fn,
   .vector_size = sizeof (u32),
   .format_trace = format_l2_out_feat_arc_trace,
   .sibling_of = "l2-output-feat-arc",
@@ -534,16 +531,10 @@
   .node_name = "l2-output-feat-arc-end",
   .runs_before = 0,     /* not before any other features */
 };
-
-
-VLIB_NODE_FUNCTION_MULTIARCH (l2_in_feat_arc_node, l2_in_feat_arc_node_fn)
-VLIB_NODE_FUNCTION_MULTIARCH (l2_out_feat_arc_node, l2_out_feat_arc_node_fn)
-VLIB_NODE_FUNCTION_MULTIARCH (l2_in_feat_arc_end_node, l2_in_feat_arc_end_node_fn)
-VLIB_NODE_FUNCTION_MULTIARCH (l2_out_feat_arc_end_node, l2_out_feat_arc_end_node_fn)
-
 /* *INDENT-ON* */
 
 
+#ifndef CLIB_MARCH_VARIANT
 clib_error_t *
 l2_in_out_feat_arc_init (vlib_main_t * vm)
 {
@@ -642,6 +633,7 @@
 
 
 VLIB_INIT_FUNCTION (l2_in_out_feat_arc_init);
+#endif /* CLIB_MARCH_VARIANT */
 
 /*
  * fd.io coding-style-patch-verification: ON
diff --git a/src/vnet/l2/l2_in_out_feat_arc.h b/src/vnet/l2/l2_in_out_feat_arc.h
index 799edee..0b5279c 100644
--- a/src/vnet/l2/l2_in_out_feat_arc.h
+++ b/src/vnet/l2/l2_in_out_feat_arc.h
@@ -58,7 +58,10 @@
 				    int enable_disable, void *feature_config,
 				    u32 n_feature_config_bytes);
 
-
+extern vlib_node_registration_t l2_in_feat_arc_end_node;
+extern vlib_node_registration_t l2_out_feat_arc_end_node;
+extern vlib_node_registration_t l2_out_feat_arc_node;
+extern vlib_node_registration_t l2_in_feat_arc_node;
 
 #endif /* __included_vnet_in_out_feat_arc_h__ */
 
diff --git a/src/vnet/l2/l2_input.c b/src/vnet/l2/l2_input.c
index b66a744..704223a 100644
--- a/src/vnet/l2/l2_input.c
+++ b/src/vnet/l2/l2_input.c
@@ -49,6 +49,8 @@
  * For interfaces in Layer 3 mode, the packets will be routed.
  */
 
+#ifndef CLIB_MARCH_VARIANT
+
 /* Feature graph node names */
 static char *l2input_feat_names[] = {
 #define _(sym,name) name,
@@ -94,6 +96,7 @@
     }
   return s;
 }
+#endif /* CLIB_MARCH_VARIANT */
 
 typedef struct
 {
@@ -119,7 +122,11 @@
   return s;
 }
 
+extern l2input_main_t l2input_main;
+
+#ifndef CLIB_MARCH_VARIANT
 l2input_main_t l2input_main;
+#endif /* CLIB_MARCH_VARIANT */
 
 #define foreach_l2input_error			\
 _(L2INPUT,     "L2 input packets")		\
@@ -455,9 +462,8 @@
   return frame->n_vectors;
 }
 
-static uword
-l2input_node_fn (vlib_main_t * vm,
-		 vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (l2input_node) (vlib_main_t * vm,
+			     vlib_node_runtime_t * node, vlib_frame_t * frame)
 {
   if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE)))
     return l2input_node_inline (vm, node, frame, 1 /* do_trace */ );
@@ -466,7 +472,6 @@
 
 /* *INDENT-OFF* */
 VLIB_REGISTER_NODE (l2input_node) = {
-  .function = l2input_node_fn,
   .name = "l2-input",
   .vector_size = sizeof (u32),
   .format_trace = format_l2input_trace,
@@ -487,8 +492,9 @@
 };
 /* *INDENT-ON* */
 
-VLIB_NODE_FUNCTION_MULTIARCH (l2input_node, l2input_node_fn)
-     clib_error_t *l2input_init (vlib_main_t * vm)
+#ifndef CLIB_MARCH_VARIANT
+clib_error_t *
+l2input_init (vlib_main_t * vm)
 {
   l2input_main_t *mp = &l2input_main;
 
@@ -851,6 +857,7 @@
 
   return 0;
 }
+#endif /* CLIB_MARCH_VARIANT */
 
 /**
  * Set subinterface in bridging mode with a bridge-domain ID.
@@ -1213,6 +1220,7 @@
 _(l2_patch_init)				\
 _(l2_xcrw_init)
 
+#ifndef CLIB_MARCH_VARIANT
 clib_error_t *
 l2_init (vlib_main_t * vm)
 {
@@ -1227,6 +1235,7 @@
 }
 
 VLIB_INIT_FUNCTION (l2_init);
+#endif /* CLIB_MARCH_VARIANT */
 
 /*
  * fd.io coding-style-patch-verification: ON
diff --git a/src/vnet/l2/l2_input_classify.c b/src/vnet/l2/l2_input_classify.c
index fcf4783..ffd1078 100644
--- a/src/vnet/l2/l2_input_classify.c
+++ b/src/vnet/l2/l2_input_classify.c
@@ -67,10 +67,12 @@
   return s;
 }
 
+extern l2_input_classify_main_t l2_input_classify_main;
+
+#ifndef CLIB_MARCH_VARIANT
 /** l2 input classifier main data structure. */
 l2_input_classify_main_t l2_input_classify_main;
-
-vlib_node_registration_t l2_input_classify_node;
+#endif /* CLIB_MARCH_VARIANT */
 
 #define foreach_l2_input_classify_error               \
 _(MISS, "Classify misses")                      \
@@ -142,9 +144,9 @@
  *   Classifier hits in other than the first table
  */
 
-static uword
-l2_input_classify_node_fn (vlib_main_t * vm,
-			   vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (l2_input_classify_node) (vlib_main_t * vm,
+				       vlib_node_runtime_t * node,
+				       vlib_frame_t * frame)
 {
   u32 n_left_from, *from, *to_next;
   l2_input_classify_next_t next_index;
@@ -443,7 +445,6 @@
 
 /* *INDENT-OFF* */
 VLIB_REGISTER_NODE (l2_input_classify_node) = {
-  .function = l2_input_classify_node_fn,
   .name = "l2-input-classify",
   .vector_size = sizeof (u32),
   .format_trace = format_l2_input_classify_trace,
@@ -467,9 +468,7 @@
 };
 /* *INDENT-ON* */
 
-VLIB_NODE_FUNCTION_MULTIARCH (l2_input_classify_node,
-			      l2_input_classify_node_fn);
-
+#ifndef CLIB_MARCH_VARIANT
 /** l2 input classsifier feature initialization. */
 clib_error_t *
 l2_input_classify_init (vlib_main_t * vm)
@@ -577,6 +576,7 @@
 
   return 0;
 }
+#endif /* CLIB_MARCH_VARIANT */
 
 static clib_error_t *
 int_l2_input_classify_command_fn (vlib_main_t * vm,
diff --git a/src/vnet/l2/l2_input_vtr.c b/src/vnet/l2/l2_input_vtr.c
index 25b3bd0..be3e6ba 100644
--- a/src/vnet/l2/l2_input_vtr.c
+++ b/src/vnet/l2/l2_input_vtr.c
@@ -57,9 +57,9 @@
   return s;
 }
 
+#ifndef CLIB_MARCH_VARIANT
 l2_invtr_main_t l2_invtr_main;
-
-static vlib_node_registration_t l2_invtr_node;
+#endif /* CLIB_MARCH_VARIANT */
 
 #define foreach_l2_invtr_error			\
 _(L2_INVTR,    "L2 inverter packets")		\
@@ -86,9 +86,9 @@
 } l2_invtr_next_t;
 
 
-static uword
-l2_invtr_node_fn (vlib_main_t * vm,
-		  vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (l2_invtr_node) (vlib_main_t * vm,
+			      vlib_node_runtime_t * node,
+			      vlib_frame_t * frame)
 {
   u32 n_left_from, *from, *to_next;
   l2_invtr_next_t next_index;
@@ -320,8 +320,7 @@
 
 
 /* *INDENT-OFF* */
-VLIB_REGISTER_NODE (l2_invtr_node,static) = {
-  .function = l2_invtr_node_fn,
+VLIB_REGISTER_NODE (l2_invtr_node) = {
   .name = "l2-input-vtr",
   .vector_size = sizeof (u32),
   .format_trace = format_l2_invtr_trace,
@@ -339,8 +338,9 @@
 };
 /* *INDENT-ON* */
 
-VLIB_NODE_FUNCTION_MULTIARCH (l2_invtr_node, l2_invtr_node_fn)
-     clib_error_t *l2_invtr_init (vlib_main_t * vm)
+#ifndef CLIB_MARCH_VARIANT
+clib_error_t *
+l2_invtr_init (vlib_main_t * vm)
 {
   l2_invtr_main_t *mp = &l2_invtr_main;
 
@@ -358,6 +358,7 @@
 }
 
 VLIB_INIT_FUNCTION (l2_invtr_init);
+#endif /* CLIB_MARCH_VARIANT */
 
 
 /*
diff --git a/src/vnet/l2/l2_output_classify.c b/src/vnet/l2/l2_output_classify.c
index 49a589c..1e55afc 100644
--- a/src/vnet/l2/l2_output_classify.c
+++ b/src/vnet/l2/l2_output_classify.c
@@ -59,10 +59,12 @@
   return s;
 }
 
+extern l2_output_classify_main_t l2_output_classify_main;
+
+#ifndef CLIB_MARCH_VARIANT
 /** l2 output classifier main data structure. */
 l2_output_classify_main_t l2_output_classify_main;
-
-vlib_node_registration_t l2_output_classify_node;
+#endif /* CLIB_MARCH_VARIANT */
 
 #define foreach_l2_output_classify_error               \
 _(MISS, "Classify misses")                      \
@@ -134,9 +136,9 @@
  *   Classifier hits in other than the first table
  */
 
-static uword
-l2_output_classify_node_fn (vlib_main_t * vm,
-			    vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (l2_output_classify_node) (vlib_main_t * vm,
+					vlib_node_runtime_t * node,
+					vlib_frame_t * frame)
 {
   u32 n_left_from, *from, *to_next;
   l2_output_classify_next_t next_index;
@@ -436,7 +438,6 @@
 
 /* *INDENT-OFF* */
 VLIB_REGISTER_NODE (l2_output_classify_node) = {
-  .function = l2_output_classify_node_fn,
   .name = "l2-output-classify",
   .vector_size = sizeof (u32),
   .format_trace = format_l2_output_classify_trace,
@@ -456,9 +457,7 @@
 };
 /* *INDENT-ON* */
 
-VLIB_NODE_FUNCTION_MULTIARCH (l2_output_classify_node,
-			      l2_output_classify_node_fn);
-
+#ifndef CLIB_MARCH_VARIANT
 /** l2 output classsifier feature initialization. */
 clib_error_t *
 l2_output_classify_init (vlib_main_t * vm)
@@ -568,6 +567,7 @@
 
   return 0;
 }
+#endif /* CLIB_MARCH_VARIANT */
 
 static clib_error_t *
 int_l2_output_classify_command_fn (vlib_main_t * vm,
diff --git a/src/vnet/l2/l2_rw.c b/src/vnet/l2/l2_rw.c
index ac83483..85a53aa 100644
--- a/src/vnet/l2/l2_rw.c
+++ b/src/vnet/l2/l2_rw.c
@@ -26,9 +26,9 @@
  */
 
 
+#ifndef CLIB_MARCH_VARIANT
 l2_rw_main_t l2_rw_main;
-
-vlib_node_registration_t l2_rw_node;
+#endif /* CLIB_MARCH_VARIANT */
 
 typedef struct
 {
@@ -156,9 +156,8 @@
     }
 }
 
-static uword
-l2_rw_node_fn (vlib_main_t * vm,
-	       vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (l2_rw_node) (vlib_main_t * vm,
+			   vlib_node_runtime_t * node, vlib_frame_t * frame)
 {
   l2_rw_main_t *rw = &l2_rw_main;
   u32 n_left_from, *from, *to_next, next_index;
@@ -347,6 +346,7 @@
   return frame->n_vectors;
 }
 
+#ifndef CLIB_MARCH_VARIANT
 int
 l2_rw_mod_entry (u32 * index,
 		 u8 * mask, u8 * value, u32 len, u32 skip, u8 is_del)
@@ -395,6 +395,7 @@
 
   return 0;
 }
+#endif /* CLIB_MARCH_VARIANT */
 
 static clib_error_t *
 l2_rw_entry_cli_fn (vlib_main_t * vm,
@@ -453,6 +454,7 @@
 };
 /* *INDENT-ON* */
 
+#ifndef CLIB_MARCH_VARIANT
 int
 l2_rw_interface_set_table (u32 sw_if_index, u32 table_index, u32 miss_index)
 {
@@ -470,6 +472,7 @@
 
   return 0;
 }
+#endif /* CLIB_MARCH_VARIANT */
 
 static clib_error_t *
 l2_rw_interface_cli_fn (vlib_main_t * vm,
@@ -594,7 +597,7 @@
 };
 /* *INDENT-ON* */
 
-int
+static int
 l2_rw_enable_disable (u32 bridge_domain, u8 disable)
 {
   u32 mask = L2INPUT_FEAT_RW;
@@ -686,7 +689,6 @@
 
 /* *INDENT-OFF* */
 VLIB_REGISTER_NODE (l2_rw_node) = {
-  .function = l2_rw_node_fn,
   .name = "l2-rw",
   .vector_size = sizeof (u32),
   .format_trace = format_l2_rw_trace,
@@ -699,7 +701,6 @@
 };
 /* *INDENT-ON* */
 
-VLIB_NODE_FUNCTION_MULTIARCH (l2_rw_node, l2_rw_node_fn)
 /*
  * fd.io coding-style-patch-verification: ON
  *
diff --git a/src/vnet/l2/l2_rw.h b/src/vnet/l2/l2_rw.h
index 49aa25f..f9b1033 100644
--- a/src/vnet/l2/l2_rw.h
+++ b/src/vnet/l2/l2_rw.h
@@ -84,6 +84,8 @@
 int l2_rw_mod_entry (u32 * index,
 		     u8 * mask, u8 * value, u32 len, u32 skip, u8 is_del);
 
+extern vlib_node_registration_t l2_rw_node;
+
 #endif /* L2_FW_H_ */
 
 /*
diff --git a/src/vnet/l2/l2_uu_fwd.c b/src/vnet/l2/l2_uu_fwd.c
index fd79387..fb3571d 100644
--- a/src/vnet/l2/l2_uu_fwd.c
+++ b/src/vnet/l2/l2_uu_fwd.c
@@ -59,9 +59,9 @@
   return s;
 }
 
-static uword
-l2_uu_fwd_node_fn (vlib_main_t * vm,
-		   vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (l2_uu_fwd_node) (vlib_main_t * vm,
+			       vlib_node_runtime_t * node,
+			       vlib_frame_t * frame)
 {
   u32 n_left_from, *from, *to_next;
   l2_uu_fwd_next_t next_index;
@@ -212,8 +212,7 @@
 }
 
 /* *INDENT-OFF* */
-VLIB_REGISTER_NODE (l2_uu_fwd_node,static) = {
-  .function = l2_uu_fwd_node_fn,
+VLIB_REGISTER_NODE (l2_uu_fwd_node) = {
   .name = "l2-uu-fwd",
   .vector_size = sizeof (u32),
   .format_trace = format_l2_uu_fwd_trace,
@@ -229,8 +228,6 @@
         [L2_UU_FWD_NEXT_L2_OUTPUT] = "l2-output",
   },
 };
-
-VLIB_NODE_FUNCTION_MULTIARCH (l2_uu_fwd_node, l2_uu_fwd_node_fn)
 /* *INDENT-ON* */
 
 /*
diff --git a/src/vnet/l2/l2_xcrw.c b/src/vnet/l2/l2_xcrw.c
index b7ccd81..1280b11 100644
--- a/src/vnet/l2/l2_xcrw.c
+++ b/src/vnet/l2/l2_xcrw.c
@@ -57,9 +57,11 @@
   return s;
 }
 
-l2_xcrw_main_t l2_xcrw_main;
+extern l2_xcrw_main_t l2_xcrw_main;
 
-static vlib_node_registration_t l2_xcrw_node;
+#ifndef CLIB_MARCH_VARIANT
+l2_xcrw_main_t l2_xcrw_main;
+#endif /* CLIB_MARCH_VARIANT */
 
 static char *l2_xcrw_error_strings[] = {
 #define _(sym,string) string,
@@ -67,9 +69,8 @@
 #undef _
 };
 
-static uword
-l2_xcrw_node_fn (vlib_main_t * vm,
-		 vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (l2_xcrw_node) (vlib_main_t * vm,
+			     vlib_node_runtime_t * node, vlib_frame_t * frame)
 {
   u32 n_left_from, *from, *to_next;
   l2_xcrw_next_t next_index;
@@ -238,8 +239,7 @@
 }
 
 /* *INDENT-OFF* */
-VLIB_REGISTER_NODE (l2_xcrw_node, static) = {
-  .function = l2_xcrw_node_fn,
+VLIB_REGISTER_NODE (l2_xcrw_node) = {
   .name = "l2-xcrw",
   .vector_size = sizeof (u32),
   .format_trace = format_l2_xcrw_trace,
@@ -257,8 +257,9 @@
 };
 /* *INDENT-ON* */
 
-VLIB_NODE_FUNCTION_MULTIARCH (l2_xcrw_node, l2_xcrw_node_fn)
-     clib_error_t *l2_xcrw_init (vlib_main_t * vm)
+#ifndef CLIB_MARCH_VARIANT
+clib_error_t *
+l2_xcrw_init (vlib_main_t * vm)
 {
   l2_xcrw_main_t *mp = &l2_xcrw_main;
 
@@ -514,6 +515,8 @@
 };
 /* *INDENT-ON* */
 
+#endif /* CLIB_MARCH_VARIANT */
+
 static u8 *
 format_l2xcrw (u8 * s, va_list * args)
 {
diff --git a/src/vnet/l2/l2_xcrw.h b/src/vnet/l2/l2_xcrw.h
index ca80aae..e21c884 100644
--- a/src/vnet/l2/l2_xcrw.h
+++ b/src/vnet/l2/l2_xcrw.h
@@ -80,6 +80,8 @@
     L2_XCRW_N_ERROR,
 } l2_xcrw_error_t;
 
+extern vlib_node_registration_t l2_xcrw_node;
+
 #endif /* __included_l2_xcrw_h__ */
 
 /*