summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/CMakeLists.txt1
-rw-r--r--src/vnet/mpls/error.def32
-rw-r--r--src/vnet/mpls/mpls.api102
-rw-r--r--src/vnet/mpls/mpls.h8
-rw-r--r--src/vnet/mpls/mpls_features.c1
-rw-r--r--src/vnet/mpls/mpls_input.c9
-rw-r--r--src/vnet/mpls/mpls_lookup.c9
-rw-r--r--src/vnet/mpls/mpls_output.c13
8 files changed, 111 insertions, 64 deletions
diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt
index 54c986f54a1..99cc551f576 100644
--- a/src/vnet/CMakeLists.txt
+++ b/src/vnet/CMakeLists.txt
@@ -779,7 +779,6 @@ list(APPEND VNET_HEADERS
mpls/mpls_types.h
mpls/mpls_tunnel.h
mpls/packet.h
- mpls/error.def
)
list(APPEND VNET_API_FILES mpls/mpls.api)
diff --git a/src/vnet/mpls/error.def b/src/vnet/mpls/error.def
deleted file mode 100644
index 9941b18baf4..00000000000
--- a/src/vnet/mpls/error.def
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * mpls_error.def: mpls errors
- *
- * Copyright (c) 2012 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-mpls_error (NONE, "no error")
-mpls_error (UNKNOWN_PROTOCOL, "unknown protocol")
-mpls_error (UNSUPPORTED_VERSION, "unsupported version")
-mpls_error (PKTS_DECAP, "MPLS input packets decapsulated")
-mpls_error (PKTS_ENCAP, "MPLS output packets encapsulated")
-mpls_error (PKTS_NEED_FRAG, "MPLS output packets needs fragmentation")
-mpls_error (NO_LABEL, "MPLS no label for fib/dst")
-mpls_error (TTL_EXPIRED, "MPLS ttl expired")
-mpls_error (S_NOT_SET, "MPLS s-bit not set")
-mpls_error (BAD_LABEL, "invalid FIB id in label")
-mpls_error (NOT_IP4, "non-ip4 packets dropped")
-mpls_error (DISALLOWED_FIB, "disallowed FIB id")
-mpls_error (NOT_ENABLED, "MPLS not enabled")
-mpls_error (DROP, "MPLS DROP DPO")
-mpls_error (PUNT, "MPLS PUNT DPO")
diff --git a/src/vnet/mpls/mpls.api b/src/vnet/mpls/mpls.api
index 9d4ec0bf7bf..4c164bb2bf2 100644
--- a/src/vnet/mpls/mpls.api
+++ b/src/vnet/mpls/mpls.api
@@ -212,6 +212,108 @@ autoreply define sw_interface_set_mpls_enable
bool enable [default=true];
};
+counters mpls {
+ none {
+ severity info;
+ type counter64;
+ units "packets";
+ description "no error";
+ };
+ unknown_protocol {
+ severity error;
+ type counter64;
+ units "packets";
+ description "unknown protocol";
+ };
+ unsupported_version {
+ severity error;
+ type counter64;
+ units "packets";
+ description "unsupported version";
+ };
+ pkts_decap {
+ severity info;
+ type counter64;
+ units "packets";
+ description "MPLS input packets decapsulated";
+ };
+ pkts_encap {
+ severity info;
+ type counter64;
+ units "packets";
+ description "MPLS output packets encapsulated";
+ };
+ pkts_need_frag {
+ severity info;
+ type counter64;
+ units "packets";
+ description "MPLS output packets needs fragmentation";
+ };
+ no_label {
+ severity error;
+ type counter64;
+ units "packets";
+ description "MPLS no label for fib/dst";
+ };
+ ttl_expired {
+ severity error;
+ type counter64;
+ units "packets";
+ description "MPLS ttl expired";
+ };
+ s_not_set {
+ severity error;
+ type counter64;
+ units "packets";
+ description "MPLS s-bit not set";
+ };
+ bad_label {
+ severity error;
+ type counter64;
+ units "packets";
+ description "invalid FIB id in label";
+ };
+ not_ip4 {
+ severity error;
+ type counter64;
+ units "packets";
+ description "non-ip4 packets dropped";
+ };
+ disallowed_fib {
+ severity error;
+ type counter64;
+ units "packets";
+ description "disallowed FIB id";
+ };
+ not_enabled {
+ severity error;
+ type counter64;
+ units "packets";
+ description "MPLS not enabled";
+ };
+ drop {
+ severity error;
+ type counter64;
+ units "packets";
+ description "MPLS DROP DPO";
+ };
+ punt {
+ severity error;
+ type counter64;
+ units "packets";
+ description "MPLS PUNT DPO";
+ };
+};
+
+paths {
+ "/err/mpls-input" "mpls";
+ "/err/mpls-output" "mpls";
+ "/err/mpls-lookup" "mpls";
+ "/err/mpls-midchain" "mpls";
+ "/err/mpls-adj-incomplete" "mpls";
+ "/err/mpls-frag" "mpls";
+};
+
/*
* Local Variables:
* eval: (c-set-style "gnu")
diff --git a/src/vnet/mpls/mpls.h b/src/vnet/mpls/mpls.h
index b4f90a13f3c..885901f89a4 100644
--- a/src/vnet/mpls/mpls.h
+++ b/src/vnet/mpls/mpls.h
@@ -23,14 +23,6 @@
#include <vnet/fib/fib_node.h>
#include <vnet/adj/adj.h>
-typedef enum
-{
-#define mpls_error(n,s) MPLS_ERROR_##n,
-#include <vnet/mpls/error.def>
-#undef mpls_error
- MPLS_N_ERROR,
-} mpls_error_t;
-
/**
* @brief Definition of a callback for receiving MPLS interface state change
* notifications
diff --git a/src/vnet/mpls/mpls_features.c b/src/vnet/mpls/mpls_features.c
index 070f90a1cc6..3b535032908 100644
--- a/src/vnet/mpls/mpls_features.c
+++ b/src/vnet/mpls/mpls_features.c
@@ -16,6 +16,7 @@
*/
#include <vnet/mpls/mpls.h>
+#include <vnet/mpls/mpls.api_enum.h>
static u8 *
format_mpls_drop_trace (u8 * s, va_list * args)
diff --git a/src/vnet/mpls/mpls_input.c b/src/vnet/mpls/mpls_input.c
index 37fa1aead12..c18cbda6315 100644
--- a/src/vnet/mpls/mpls_input.c
+++ b/src/vnet/mpls/mpls_input.c
@@ -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;
@@ -236,12 +237,6 @@ VLIB_NODE_FN (mpls_input_node) (vlib_main_t * vm,
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) = {
.name = "mpls-input",
/* Takes a vector of packets. */
@@ -250,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 = {
diff --git a/src/vnet/mpls/mpls_lookup.c b/src/vnet/mpls/mpls_lookup.c
index 07c5cc47198..db423392c03 100644
--- a/src/vnet/mpls/mpls_lookup.c
+++ b/src/vnet/mpls/mpls_lookup.c
@@ -20,6 +20,7 @@
#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
@@ -454,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",
diff --git a/src/vnet/mpls/mpls_output.c b/src/vnet/mpls/mpls_output.c
index 3ea6ce5bf7c..9c1d7316db7 100644
--- a/src/vnet/mpls/mpls_output.c
+++ b/src/vnet/mpls/mpls_output.c
@@ -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,7 +352,7 @@ 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,
@@ -661,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 = {