mpls: Use the .api for the definition of error/info counters
[vpp.git] / src / vnet / mpls / mpls_output.c
index faeba74..9c1d731 100644 (file)
@@ -20,6 +20,7 @@
 #include <vnet/mpls/mpls.h>
 #include <vnet/ip/ip_frag.h>
 #include <vnet/adj/adj_dp.h>
+#include <vnet/mpls/mpls.api_enum.h>
 
 typedef struct {
   /* Adjacency taken. */
@@ -317,12 +318,6 @@ mpls_output_inline (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_NODE_FN (mpls_output_node) (vlib_main_t * vm,
              vlib_node_runtime_t * node,
              vlib_frame_t * from_frame)
@@ -335,7 +330,7 @@ VLIB_REGISTER_NODE (mpls_output_node) = {
   /* Takes a vector of packets. */
   .vector_size = sizeof (u32),
   .n_errors = MPLS_N_ERROR,
-  .error_strings = mpls_error_strings,
+  .error_counters = mpls_error_counters,
 
   .n_next_nodes = MPLS_OUTPUT_N_NEXT,
   .next_nodes = {
@@ -357,18 +352,12 @@ VLIB_REGISTER_NODE (mpls_midchain_node) = {
   .vector_size = sizeof (u32),
 
   .n_errors = MPLS_N_ERROR,
-  .error_strings = mpls_error_strings,
+  .error_counters = mpls_error_counters,
 
   .sibling_of = "mpls-output",
   .format_trace = format_mpls_output_trace,
 };
 
-static char *mpls_frag_error_strings[] = {
-#define _(sym,string) string,
-  foreach_ip_frag_error
-#undef _
-};
-
 typedef struct mpls_frag_trace_t_
 {
     u16 pkt_size;
@@ -470,14 +459,13 @@ mpls_frag (vlib_main_t * vm,
                        icmp4_error_set_vnet_buffer (
                          p0, ICMP4_destination_unreachable,
                          ICMP4_destination_unreachable_fragmentation_needed_and_dont_fragment_set,
-                         vnet_buffer (p0)->ip_frag.mtu);
+                         mtu);
                        next0 = MPLS_FRAG_NEXT_ICMP4_ERROR;
                      }
                    else
                      {
-                       icmp6_error_set_vnet_buffer (
-                         p0, ICMP6_packet_too_big, 0,
-                         adj0->rewrite_header.max_l3_packet_bytes);
+                       icmp6_error_set_vnet_buffer (p0, ICMP6_packet_too_big,
+                                                    0, mtu);
                        next0 = MPLS_FRAG_NEXT_ICMP6_ERROR;
                      }
                  }
@@ -542,7 +530,7 @@ VLIB_REGISTER_NODE (mpls_frag_node) = {
   .type = VLIB_NODE_TYPE_INTERNAL,
 
   .n_errors = IP_FRAG_N_ERROR,
-  .error_strings = mpls_frag_error_strings,
+  .error_counters = ip_frag_error_counters,
 
   .n_next_nodes = MPLS_FRAG_N_NEXT,
   .next_nodes = { [MPLS_FRAG_NEXT_REWRITE] = "mpls-output",
@@ -668,7 +656,7 @@ VLIB_REGISTER_NODE (mpls_adj_incomplete_node) = {
   /* Takes a vector of packets. */
   .vector_size = sizeof (u32),
   .n_errors = MPLS_N_ERROR,
-  .error_strings = mpls_error_strings,
+  .error_counters = mpls_error_counters,
 
   .n_next_nodes = MPLS_ADJ_INCOMPLETE_N_NEXT,
   .next_nodes = {