summaryrefslogtreecommitdiffstats
path: root/src/vnet/l2/l2_output.c
diff options
context:
space:
mode:
authorPavel Kotucek <pkotucek@cisco.com>2017-01-16 17:01:56 +0100
committerJohn Lo <loj@cisco.com>2017-02-21 00:00:12 +0000
commit65e845785f21e6b43c026f092e982171eec1f641 (patch)
treeb0fed4d7d055d61e1c659030eef8950ab8460151 /src/vnet/l2/l2_output.c
parent9745aceb240d4586c47869203f48479c58e0f86e (diff)
VPP-540 : pbb tag rewrite details
Extended sw_interface_dump to provide 802.1ah (pbb) tag rewrite info if present. Extended log "l2-output" to provide raw data to display result of prospetive pbb tag rewrite. Tracing is moved after l2output_vtr to show these changes. Change-Id: I8b7cb865dc67ce21afab402cc086dac35f7c0f07 Signed-off-by: Pavel Kotucek <pkotucek@cisco.com>
Diffstat (limited to 'src/vnet/l2/l2_output.c')
-rw-r--r--src/vnet/l2/l2_output.c115
1 files changed, 63 insertions, 52 deletions
diff --git a/src/vnet/l2/l2_output.c b/src/vnet/l2/l2_output.c
index acfe3abad90..00f22571790 100644
--- a/src/vnet/l2/l2_output.c
+++ b/src/vnet/l2/l2_output.c
@@ -48,6 +48,7 @@ typedef struct
u8 src[6];
u8 dst[6];
u32 sw_if_index;
+ u8 raw[12]; /* raw data */
} l2output_trace_t;
/* packet trace format function */
@@ -58,10 +59,15 @@ format_l2output_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
l2output_trace_t *t = va_arg (*args, l2output_trace_t *);
- s = format (s, "l2-output: sw_if_index %d dst %U src %U",
+ s = format (s, "l2-output: sw_if_index %d dst %U src %U data "
+ "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
t->sw_if_index,
format_ethernet_address, t->dst,
- format_ethernet_address, t->src);
+ format_ethernet_address, t->src,
+ t->raw[0], t->raw[1], t->raw[2], t->raw[3], t->raw[4],
+ t->raw[5], t->raw[6], t->raw[7], t->raw[8], t->raw[9],
+ t->raw[10], t->raw[11]);
+
return s;
}
@@ -214,46 +220,6 @@ l2output_node_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
sw_if_index2 = vnet_buffer (b2)->sw_if_index[VLIB_TX];
sw_if_index3 = vnet_buffer (b3)->sw_if_index[VLIB_TX];
- if (do_trace)
- {
- h0 = vlib_buffer_get_current (b0);
- h1 = vlib_buffer_get_current (b1);
- h2 = vlib_buffer_get_current (b2);
- h3 = vlib_buffer_get_current (b3);
- if (b0->flags & VLIB_BUFFER_IS_TRACED)
- {
- l2output_trace_t *t =
- vlib_add_trace (vm, node, b0, sizeof (*t));
- t->sw_if_index = sw_if_index0;
- clib_memcpy (t->src, h0->src_address, 6);
- clib_memcpy (t->dst, h0->dst_address, 6);
- }
- if (b1->flags & VLIB_BUFFER_IS_TRACED)
- {
- l2output_trace_t *t =
- vlib_add_trace (vm, node, b1, sizeof (*t));
- t->sw_if_index = sw_if_index1;
- clib_memcpy (t->src, h1->src_address, 6);
- clib_memcpy (t->dst, h1->dst_address, 6);
- }
- if (b2->flags & VLIB_BUFFER_IS_TRACED)
- {
- l2output_trace_t *t =
- vlib_add_trace (vm, node, b2, sizeof (*t));
- t->sw_if_index = sw_if_index2;
- clib_memcpy (t->src, h2->src_address, 6);
- clib_memcpy (t->dst, h2->dst_address, 6);
- }
- if (b3->flags & VLIB_BUFFER_IS_TRACED)
- {
- l2output_trace_t *t =
- vlib_add_trace (vm, node, b3, sizeof (*t));
- t->sw_if_index = sw_if_index3;
- clib_memcpy (t->src, h3->src_address, 6);
- clib_memcpy (t->dst, h3->dst_address, 6);
- }
- }
-
vlib_node_increment_counter (vm, l2output_node.index,
L2OUTPUT_ERROR_L2OUTPUT, 4);
@@ -314,6 +280,50 @@ l2output_node_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
l2output_vtr (node, config2, feature_bitmap2, b2, &next2);
l2output_vtr (node, config3, feature_bitmap3, b3, &next3);
+ if (do_trace)
+ {
+ h0 = vlib_buffer_get_current (b0);
+ h1 = vlib_buffer_get_current (b1);
+ h2 = vlib_buffer_get_current (b2);
+ h3 = vlib_buffer_get_current (b3);
+ if (b0->flags & VLIB_BUFFER_IS_TRACED)
+ {
+ l2output_trace_t *t =
+ vlib_add_trace (vm, node, b0, sizeof (*t));
+ t->sw_if_index = sw_if_index0;
+ clib_memcpy (t->src, h0->src_address, 6);
+ clib_memcpy (t->dst, h0->dst_address, 6);
+ clib_memcpy (t->raw, &h0->type, sizeof (t->raw));
+ }
+ if (b1->flags & VLIB_BUFFER_IS_TRACED)
+ {
+ l2output_trace_t *t =
+ vlib_add_trace (vm, node, b1, sizeof (*t));
+ t->sw_if_index = sw_if_index1;
+ clib_memcpy (t->src, h1->src_address, 6);
+ clib_memcpy (t->dst, h1->dst_address, 6);
+ clib_memcpy (t->raw, &h1->type, sizeof (t->raw));
+ }
+ if (b2->flags & VLIB_BUFFER_IS_TRACED)
+ {
+ l2output_trace_t *t =
+ vlib_add_trace (vm, node, b2, sizeof (*t));
+ t->sw_if_index = sw_if_index2;
+ clib_memcpy (t->src, h2->src_address, 6);
+ clib_memcpy (t->dst, h2->dst_address, 6);
+ clib_memcpy (t->raw, &h2->type, sizeof (t->raw));
+ }
+ if (b3->flags & VLIB_BUFFER_IS_TRACED)
+ {
+ l2output_trace_t *t =
+ vlib_add_trace (vm, node, b3, sizeof (*t));
+ t->sw_if_index = sw_if_index3;
+ clib_memcpy (t->src, h3->src_address, 6);
+ clib_memcpy (t->dst, h3->dst_address, 6);
+ clib_memcpy (t->raw, &h3->type, sizeof (t->raw));
+ }
+ }
+
/*
* Perform the split horizon check
* The check can only fail for non-zero shg's
@@ -378,16 +388,6 @@ l2output_node_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_TX];
- if (do_trace && PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
- {
- l2output_trace_t *t =
- vlib_add_trace (vm, node, b0, sizeof (*t));
- t->sw_if_index = sw_if_index0;
- h0 = vlib_buffer_get_current (b0);
- clib_memcpy (t->src, h0->src_address, 6);
- clib_memcpy (t->dst, h0->dst_address, 6);
- }
-
vlib_node_increment_counter (vm, l2output_node.index,
L2OUTPUT_ERROR_L2OUTPUT, 1);
@@ -412,6 +412,17 @@ l2output_node_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
l2output_vtr (node, config0, feature_bitmap0, b0, &next0);
+ if (do_trace && PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
+ {
+ l2output_trace_t *t =
+ vlib_add_trace (vm, node, b0, sizeof (*t));
+ t->sw_if_index = sw_if_index0;
+ h0 = vlib_buffer_get_current (b0);
+ clib_memcpy (t->src, h0->src_address, 6);
+ clib_memcpy (t->dst, h0->dst_address, 6);
+ clib_memcpy (t->raw, &h0->type, sizeof (t->raw));
+ }
+
/* Perform the split horizon check */
if (PREDICT_FALSE
(split_horizon_violation