vlib: startup multi-arch variant configuration fix for interfaces

Propagate the multi-arch variant selection to interfaces.

Type: fix

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Change-Id: I99c4a7896f172f0d14d2ded22a27383825529a7d
diff --git a/src/vnet/interface.c b/src/vnet/interface.c
index a03ea28..5823cc4 100644
--- a/src/vnet/interface.c
+++ b/src/vnet/interface.c
@@ -811,7 +811,7 @@
   vnet_config_main_t *cm;
   u32 hw_index, i;
   char *tx_node_name = NULL, *output_node_name = NULL;
-  vlib_node_function_t *output_node = vnet_interface_output_node_get ();
+  vlib_node_function_t *output_node = vnet_interface_output_node_get (vm);
 
   pool_get (im->hw_interfaces, hw);
   clib_memset (hw, 0, sizeof (*hw));
diff --git a/src/vnet/interface.h b/src/vnet/interface.h
index 03c65d7..1d97fd0 100644
--- a/src/vnet/interface.h
+++ b/src/vnet/interface.h
@@ -326,6 +326,7 @@
   vlib_node_fn_registration_t *r;					\
   r = &CLIB_MARCH_SFX (devclass##_tx_fn_registration);			\
   r->priority = CLIB_MARCH_FN_PRIORITY();				\
+  r->name = CLIB_MARCH_VARIANT_STR;					\
   r->next_registration = devclass.tx_fn_registrations;			\
   devclass.tx_fn_registrations = r;					\
 }									\
@@ -960,7 +961,7 @@
 
 int vnet_interface_name_renumber (u32 sw_if_index, u32 new_show_dev_instance);
 
-vlib_node_function_t *vnet_interface_output_node_get (void);
+vlib_node_function_t *vnet_interface_output_node_get (vlib_main_t * vm);
 
 void vnet_register_format_buffer_opaque_helper
   (vnet_buffer_opquae_formatter_t fn);
diff --git a/src/vnet/interface_output.c b/src/vnet/interface_output.c
index 3363f76..e79ad45 100644
--- a/src/vnet/interface_output.c
+++ b/src/vnet/interface_output.c
@@ -513,9 +513,35 @@
 
 #ifndef CLIB_MARCH_VARIANT
 vlib_node_function_t *
-vnet_interface_output_node_get (void)
+vnet_interface_output_node_get (vlib_main_t * vm)
 {
-  return CLIB_MARCH_FN_POINTER (vnet_interface_output_node);
+  vlib_node_function_t *fn = 0;
+  vlib_node_fn_registration_t *fnr;
+  char *name = 0;
+  vlib_node_t *node = vlib_get_node_by_name (vm, (u8 *) "interface-output");
+  ASSERT (node);
+
+  /* search for the same name */
+  fnr = node->node_fn_registrations;
+  while (fnr)
+    {
+      if (fnr->function == node->function)
+	{
+	  name = fnr->name;
+	  break;
+	}
+      fnr = fnr->next_registration;
+    }
+
+  if (name)
+    {
+      fn = CLIB_MARCH_FN_POINTER_BY_NAME (vnet_interface_output_node, name);
+    }
+  if (!fn)			/* revert to march type selection if search failed */
+    {
+      fn = CLIB_MARCH_FN_POINTER (vnet_interface_output_node);
+    }
+  return fn;
 }
 #endif /* CLIB_MARCH_VARIANT */