aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/l2/l2_fwd.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-10-24 02:25:06 -0700
committerDave Barach <openvpp@barachs.net>2018-10-24 11:16:45 +0000
commit7d645f771cea143eab834e7f3383e36cef565786 (patch)
tree4277b4681a9e974c44415482f8bb6d6f2cec183e /src/vnet/l2/l2_fwd.c
parenta1179589bea89b44f7b41001b5e5595a8793b1df (diff)
L2-fwd trace show the lookup result
Change-Id: I09cf6ee7b4874d71f293f8f1a426d3a5e9651749 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/l2/l2_fwd.c')
-rw-r--r--src/vnet/l2/l2_fwd.c106
1 files changed, 58 insertions, 48 deletions
diff --git a/src/vnet/l2/l2_fwd.c b/src/vnet/l2/l2_fwd.c
index c647e3dbd06..f1d215a87f4 100644
--- a/src/vnet/l2/l2_fwd.c
+++ b/src/vnet/l2/l2_fwd.c
@@ -65,6 +65,7 @@ typedef struct
u8 dst[6];
u32 sw_if_index;
u16 bd_index;
+ l2fib_entry_result_t result;
} l2fwd_trace_t;
/* packet trace format function */
@@ -75,10 +76,13 @@ format_l2fwd_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
l2fwd_trace_t *t = va_arg (*args, l2fwd_trace_t *);
- s = format (s, "l2-fwd: sw_if_index %d dst %U src %U bd_index %d",
- t->sw_if_index,
- format_ethernet_address, t->dst,
- format_ethernet_address, t->src, t->bd_index);
+ s =
+ format (s,
+ "l2-fwd: sw_if_index %d dst %U src %U bd_index %d result [0x%llx, %d] %U",
+ t->sw_if_index, format_ethernet_address, t->dst,
+ format_ethernet_address, t->src, t->bd_index, t->result.raw,
+ t->result.fields.sw_if_index, format_l2fib_entry_result_flags,
+ t->result.fields.flags);
return s;
}
@@ -212,7 +216,8 @@ l2fwd_process (vlib_main_t * vm,
* unless some other feature is inserted before uu_flood
*/
if (vnet_buffer (b0)->l2.feature_bitmap &
- (L2INPUT_FEAT_UU_FLOOD | L2INPUT_FEAT_UU_FWD))
+ (L2INPUT_FEAT_UU_FLOOD |
+ L2INPUT_FEAT_UU_FWD | L2INPUT_FEAT_GBP_FWD))
{
*next0 = vnet_l2_feature_next (b0, msm->feat_next_node_index,
L2INPUT_FEAT_FWD);
@@ -283,6 +288,40 @@ l2fwd_node_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
h2 = vlib_buffer_get_current (b[2]);
h3 = vlib_buffer_get_current (b[3]);
+#ifdef COUNTERS
+ em->counters[node_counter_base_index + L2FWD_ERROR_L2FWD] += 4;
+#endif
+ /* *INDENT-OFF* */
+ l2fib_lookup_4 (msm->mac_table, &cached_key, &cached_result,
+ h0->dst_address, h1->dst_address,
+ h2->dst_address, h3->dst_address,
+ vnet_buffer (b[0])->l2.bd_index,
+ vnet_buffer (b[1])->l2.bd_index,
+ vnet_buffer (b[2])->l2.bd_index,
+ vnet_buffer (b[3])->l2.bd_index,
+ &key0, /* not used */
+ &key1, /* not used */
+ &key2, /* not used */
+ &key3, /* not used */
+ &bucket0, /* not used */
+ &bucket1, /* not used */
+ &bucket2, /* not used */
+ &bucket3, /* not used */
+ &result0,
+ &result1,
+ &result2,
+ &result3);
+ /* *INDENT-ON* */
+ l2fwd_process (vm, node, msm, em, b[0], sw_if_index0, &result0, next);
+ l2fwd_process (vm, node, msm, em, b[1], sw_if_index1, &result1,
+ next + 1);
+ l2fwd_process (vm, node, msm, em, b[2], sw_if_index2, &result2,
+ next + 2);
+ l2fwd_process (vm, node, msm, em, b[3], sw_if_index3, &result3,
+ next + 3);
+
+ /* verify speculative enqueues, maybe switch current next frame */
+ /* if next0==next1==next_index then nothing special needs to be done */
if (do_trace)
{
if (b[0]->flags & VLIB_BUFFER_IS_TRACED)
@@ -292,6 +331,7 @@ l2fwd_node_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
t->bd_index = vnet_buffer (b[0])->l2.bd_index;
clib_memcpy (t->src, h0->src_address, 6);
clib_memcpy (t->dst, h0->dst_address, 6);
+ t->result = result0;
}
if (b[1]->flags & VLIB_BUFFER_IS_TRACED)
{
@@ -300,6 +340,7 @@ l2fwd_node_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
t->bd_index = vnet_buffer (b[1])->l2.bd_index;
clib_memcpy (t->src, h1->src_address, 6);
clib_memcpy (t->dst, h1->dst_address, 6);
+ t->result = result1;
}
if (b[2]->flags & VLIB_BUFFER_IS_TRACED)
{
@@ -308,6 +349,7 @@ l2fwd_node_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
t->bd_index = vnet_buffer (b[2])->l2.bd_index;
clib_memcpy (t->src, h2->src_address, 6);
clib_memcpy (t->dst, h2->dst_address, 6);
+ t->result = result2;
}
if (b[3]->flags & VLIB_BUFFER_IS_TRACED)
{
@@ -316,43 +358,10 @@ l2fwd_node_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
t->bd_index = vnet_buffer (b[3])->l2.bd_index;
clib_memcpy (t->src, h3->src_address, 6);
clib_memcpy (t->dst, h3->dst_address, 6);
+ t->result = result3;
}
}
-#ifdef COUNTERS
- em->counters[node_counter_base_index + L2FWD_ERROR_L2FWD] += 4;
-#endif
- /* *INDENT-OFF* */
- l2fib_lookup_4 (msm->mac_table, &cached_key, &cached_result,
- h0->dst_address, h1->dst_address,
- h2->dst_address, h3->dst_address,
- vnet_buffer (b[0])->l2.bd_index,
- vnet_buffer (b[1])->l2.bd_index,
- vnet_buffer (b[2])->l2.bd_index,
- vnet_buffer (b[3])->l2.bd_index,
- &key0, /* not used */
- &key1, /* not used */
- &key2, /* not used */
- &key3, /* not used */
- &bucket0, /* not used */
- &bucket1, /* not used */
- &bucket2, /* not used */
- &bucket3, /* not used */
- &result0,
- &result1,
- &result2,
- &result3);
- /* *INDENT-ON* */
- l2fwd_process (vm, node, msm, em, b[0], sw_if_index0, &result0, next);
- l2fwd_process (vm, node, msm, em, b[1], sw_if_index1, &result1,
- next + 1);
- l2fwd_process (vm, node, msm, em, b[2], sw_if_index2, &result2,
- next + 2);
- l2fwd_process (vm, node, msm, em, b[3], sw_if_index3, &result3,
- next + 3);
-
- /* verify speculative enqueues, maybe switch current next frame */
- /* if next0==next1==next_index then nothing special needs to be done */
next += 4;
b += 4;
n_left -= 4;
@@ -370,15 +379,6 @@ l2fwd_node_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
h0 = vlib_buffer_get_current (b[0]);
- if (do_trace && PREDICT_FALSE (b[0]->flags & VLIB_BUFFER_IS_TRACED))
- {
- l2fwd_trace_t *t = vlib_add_trace (vm, node, b[0], sizeof (*t));
- t->sw_if_index = sw_if_index0;
- t->bd_index = vnet_buffer (b[0])->l2.bd_index;
- clib_memcpy (t->src, h0->src_address, 6);
- clib_memcpy (t->dst, h0->dst_address, 6);
- }
-
/* process 1 pkt */
#ifdef COUNTERS
em->counters[node_counter_base_index + L2FWD_ERROR_L2FWD] += 1;
@@ -388,6 +388,16 @@ l2fwd_node_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
&result0);
l2fwd_process (vm, node, msm, em, b[0], sw_if_index0, &result0, next);
+ if (do_trace && PREDICT_FALSE (b[0]->flags & VLIB_BUFFER_IS_TRACED))
+ {
+ l2fwd_trace_t *t = vlib_add_trace (vm, node, b[0], sizeof (*t));
+ t->sw_if_index = sw_if_index0;
+ t->bd_index = vnet_buffer (b[0])->l2.bd_index;
+ clib_memcpy (t->src, h0->src_address, 6);
+ clib_memcpy (t->dst, h0->dst_address, 6);
+ t->result = result0;
+ }
+
/* verify speculative enqueue, maybe switch current next frame */
next += 1;
b += 1;