ip: punt add punt socket support for icmp6
[vpp.git] / src / vnet / mpls / mpls_input.c
index d1881d4..c18cbda 100644 (file)
@@ -19,6 +19,7 @@
 #include <vnet/pg/pg.h>
 #include <vnet/mpls/mpls.h>
 #include <vnet/feature/feature.h>
+#include <vnet/mpls/mpls.api_enum.h>
 
 typedef struct {
   u32 next_index;
@@ -50,8 +51,8 @@ format_mpls_input_trace (u8 * s, va_list * args)
 #define _(a,b) if (t->next_index == MPLS_INPUT_NEXT_##a) next_name = b;
   foreach_mpls_input_next;
 #undef _
-  
-  s = format (s, "MPLS: next %s[%d]  label %d ttl %d exp %d", 
+
+  s = format (s, "MPLS: next %s[%d]  label %d ttl %d exp %d",
               next_name, t->next_index,
              vnet_mpls_uc_get_label(label),
              vnet_mpls_uc_get_ttl(label),
@@ -60,8 +61,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;
@@ -109,11 +108,11 @@ mpls_input_inline (vlib_main_t * vm,
               p2 = vlib_get_buffer (vm, from[2]);
               p3 = vlib_get_buffer (vm, from[3]);
 
-              vlib_prefetch_buffer_header (p2, STORE);
-              vlib_prefetch_buffer_header (p3, STORE);
+              vlib_prefetch_buffer_header (p2, LOAD);
+              vlib_prefetch_buffer_header (p3, LOAD);
 
-              CLIB_PREFETCH (p2->data, sizeof (h0[0]), STORE);
-              CLIB_PREFETCH (p3->data, sizeof (h1[0]), STORE);
+              CLIB_PREFETCH (p2->data, sizeof (h0[0]), LOAD);
+              CLIB_PREFETCH (p3->data, sizeof (h1[0]), LOAD);
           }
 
           bi0 = to_next[0] = from[0];
@@ -211,9 +210,9 @@ mpls_input_inline (vlib_main_t * vm,
               vlib_increment_simple_counter (cm, thread_index, sw_if_index0, 1);
             }
 
-          if (PREDICT_FALSE(b0->flags & VLIB_BUFFER_IS_TRACED)) 
+          if (PREDICT_FALSE(b0->flags & VLIB_BUFFER_IS_TRACED))
             {
-              mpls_input_trace_t *tr = vlib_add_trace (vm, node, 
+              mpls_input_trace_t *tr = vlib_add_trace (vm, node,
                                                       b0, sizeof (*tr));
               tr->next_index = next0;
               tr->label_net_byte_order = *(u32*)h0;
@@ -231,22 +230,14 @@ 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)
 {
   return mpls_input_inline (vm, node, from_frame);
 }
 
-static char * mpls_error_strings[] = {
-#define mpls_error(n,s) s,
-#include "error.def"
-#undef mpls_error
-};
-
 VLIB_REGISTER_NODE (mpls_input_node) = {
-  .function = mpls_input,
   .name = "mpls-input",
   /* Takes a vector of packets. */
   .vector_size = sizeof (u32),
@@ -254,7 +245,7 @@ VLIB_REGISTER_NODE (mpls_input_node) = {
   .runtime_data_bytes = sizeof(mpls_input_runtime_t),
 
   .n_errors = MPLS_N_ERROR,
-  .error_strings = mpls_error_strings,
+  .error_counters = mpls_error_counters,
 
   .n_next_nodes = MPLS_INPUT_N_NEXT,
   .next_nodes = {
@@ -267,8 +258,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)
 {
@@ -283,15 +273,15 @@ mpls_setup_nodes (vlib_main_t * vm)
 
 static clib_error_t * mpls_input_init (vlib_main_t * vm)
 {
-  clib_error_t * error; 
-
-  error = vlib_call_init_function (vm, mpls_init);
-  if (error)
-    clib_error_report (error);
-
   mpls_setup_nodes (vm);
 
   return 0;
 }
 
-VLIB_INIT_FUNCTION (mpls_input_init);
+/* *INDENT-OFF* */
+VLIB_INIT_FUNCTION (mpls_input_init) =
+{
+  .runs_after = VLIB_INITS("mpls_init"),
+};
+/* *INDENT-ON* */
+#endif /* CLIB_MARCH_VARIANT */