mpls: Use the .api for the definition of error/info counters
[vpp.git] / src / vnet / mpls / mpls_lookup.c
index b2309fb..db42339 100644 (file)
  */
 
 #include <vlib/vlib.h>
-#include <vnet/pg/pg.h>
 #include <vnet/mpls/mpls_lookup.h>
 #include <vnet/fib/mpls_fib.h>
 #include <vnet/dpo/load_balance_map.h>
 #include <vnet/dpo/replicate_dpo.h>
+#include <vnet/mpls/mpls.api_enum.h>
 
 /**
  * The arc/edge from the MPLS lookup node to the MPLS replicate node
@@ -455,18 +455,12 @@ VLIB_NODE_FN (mpls_lookup_node) (vlib_main_t * vm,
   return from_frame->n_vectors;
 }
 
-static char * mpls_error_strings[] = {
-#define mpls_error(n,s) s,
-#include "error.def"
-#undef mpls_error
-};
-
 VLIB_REGISTER_NODE (mpls_lookup_node) = {
   .name = "mpls-lookup",
   /* Takes a vector of packets. */
   .vector_size = sizeof (u32),
   .n_errors = MPLS_N_ERROR,
-  .error_strings = mpls_error_strings,
+  .error_counters = mpls_error_counters,
 
   .sibling_of = "mpls-load-balance",
 
@@ -616,6 +610,14 @@ VLIB_NODE_FN (mpls_load_balance_node) (vlib_main_t * vm,
               tr->lb_index = lbi0;
               tr->hash = hc0;
           }
+          if (PREDICT_FALSE(p1->flags & VLIB_BUFFER_IS_TRACED))
+          {
+              mpls_load_balance_trace_t *tr = vlib_add_trace (vm, node,
+                                                              p1, sizeof (*tr));
+              tr->next_index = next1;
+              tr->lb_index = lbi1;
+              tr->hash = hc1;
+          }
 
           vlib_validate_buffer_enqueue_x2 (vm, node, next,
                                            to_next, n_left_to_next,
@@ -665,6 +667,15 @@ VLIB_NODE_FN (mpls_load_balance_node) (vlib_main_t * vm,
           next0 = dpo0->dpoi_next_node;
           vnet_buffer (p0)->ip.adj_index[VLIB_TX] = dpo0->dpoi_index;
 
+          if (PREDICT_FALSE(p0->flags & VLIB_BUFFER_IS_TRACED))
+          {
+              mpls_load_balance_trace_t *tr = vlib_add_trace (vm, node,
+                                                              p0, sizeof (*tr));
+              tr->next_index = next0;
+              tr->lb_index = lbi0;
+              tr->hash = hc0;
+          }
+
           vlib_increment_combined_counter
               (cm, thread_index, lbi0, 1,
                vlib_buffer_length_in_chain (vm, p0));