aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-03-06 08:07:34 -0800
committerDamjan Marion <dmarion@me.com>2019-03-07 10:53:03 +0000
commit9b309b61d2c9c8780d94d09f706f5ecd9b808c62 (patch)
tree2111b21abae5fa4841fbc0d270233e89cacc3966 /src
parent3543908a896e6f877acc02ba7ba25a005342c2c1 (diff)
BIER: trace then drop. MPLS: trace the drops
Change-Id: I952e6aec6487270a79c4d92cfe828cc55d42d536 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/bier/bier_drop.c6
-rw-r--r--src/vnet/mpls/mpls_features.c43
2 files changed, 46 insertions, 3 deletions
diff --git a/src/vnet/bier/bier_drop.c b/src/vnet/bier/bier_drop.c
index da6d5668c7a..fa70841c1fc 100644
--- a/src/vnet/bier/bier_drop.c
+++ b/src/vnet/bier/bier_drop.c
@@ -62,6 +62,9 @@ bier_drop (vlib_main_t * vm,
u32 *buffers = vlib_frame_vector_args (frame);
uword n_packets = frame->n_vectors;
+ if (node->flags & VLIB_NODE_FLAG_TRACE)
+ bier_drop_trace (vm, node, frame);
+
vlib_error_drop_buffers (vm, node, buffers,
/* stride */ 1,
n_packets,
@@ -69,9 +72,6 @@ bier_drop (vlib_main_t * vm,
0, // bier_input_node.index,
0);
- if (node->flags & VLIB_NODE_FLAG_TRACE)
- bier_drop_trace (vm, node, frame);
-
return n_packets;
}
diff --git a/src/vnet/mpls/mpls_features.c b/src/vnet/mpls/mpls_features.c
index 5f07833b6a3..f59753723ab 100644
--- a/src/vnet/mpls/mpls_features.c
+++ b/src/vnet/mpls/mpls_features.c
@@ -17,6 +17,43 @@
#include <vnet/mpls/mpls.h>
+static u8 *
+format_mpls_drop_trace (u8 * s, va_list * args)
+{
+ CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
+ CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
+
+ return s;
+}
+
+static void
+mpls_drop_trace (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
+{
+ u32 *from, n_left;
+
+ n_left = frame->n_vectors;
+ from = vlib_frame_vector_args (frame);
+
+ while (n_left >= 1)
+ {
+ vlib_buffer_t *b0;
+ u32 bi0;
+
+ bi0 = from[0];
+
+ b0 = vlib_get_buffer (vm, bi0);
+
+ if (b0->flags & VLIB_BUFFER_IS_TRACED)
+ {
+ vlib_add_trace (vm, node, b0, 0);
+ }
+ from += 1;
+ n_left -= 1;
+ }
+}
+
always_inline uword
mpls_terminate (vlib_main_t * vm,
vlib_node_runtime_t * node,
@@ -26,6 +63,9 @@ mpls_terminate (vlib_main_t * vm,
u32 * buffers = vlib_frame_vector_args (frame);
uword n_packets = frame->n_vectors;
+ if (node->flags & VLIB_NODE_FLAG_TRACE)
+ mpls_drop_trace (vm, node, frame);
+
vlib_error_drop_buffers (vm, node,
buffers,
/* stride */ 1,
@@ -47,6 +87,7 @@ VLIB_NODE_FN (mpls_punt_node) (vlib_main_t * vm,
VLIB_REGISTER_NODE (mpls_punt_node) = {
.name = "mpls-punt",
.vector_size = sizeof (u32),
+ .format_trace = format_mpls_drop_trace,
.n_next_nodes = 1,
.next_nodes = {
@@ -64,6 +105,7 @@ VLIB_NODE_FN (mpls_drop_node) (vlib_main_t * vm,
VLIB_REGISTER_NODE (mpls_drop_node) = {
.name = "mpls-drop",
.vector_size = sizeof (u32),
+ .format_trace = format_mpls_drop_trace,
.n_next_nodes = 1,
.next_nodes = {
@@ -81,6 +123,7 @@ VLIB_NODE_FN (mpls_not_enabled_node) (vlib_main_t * vm,
VLIB_REGISTER_NODE (mpls_not_enabled_node) = {
.name = "mpls-not-enabled",
.vector_size = sizeof (u32),
+ .format_trace = format_mpls_drop_trace,
.n_next_nodes = 1,
.next_nodes = {