Merge "Enhance and fix packet trace for IP forwarding as follows: 1. Add fib index to IP6 forwarding trace. 2. Display adjacency index in IP forwarding trace. 3. Fix adjacency display for L3 to L2 forwarding such as BVI and VXLAN tunnel decap. 4. Setup VXLAN tunnel fib index properly for packet trace."

This commit is contained in:
Dave Barach
2016-01-19 23:18:12 +00:00
committed by Gerrit Code Review
5 changed files with 19 additions and 4 deletions

View File

@ -1753,8 +1753,8 @@ static u8 * format_ip4_forward_next_trace (u8 * s, va_list * args)
uword indent = format_get_indent (s);
adj = ip_get_adjacency (&im->lookup_main, t->adj_index);
s = format (s, "fib: %d adjacency: %U flow hash: 0x%08x",
t->fib_index, format_ip_adjacency,
s = format (s, "fib %d adj-idx %d : %U flow hash: 0x%08x",
t->fib_index, t->adj_index, format_ip_adjacency,
vnm, &im->lookup_main, t->adj_index, t->flow_hash);
switch (adj->lookup_next_index)
{

View File

@ -1181,6 +1181,7 @@ typedef struct {
/* Adjacency taken. */
u32 adj_index;
u32 flow_hash;
u32 fib_index;
/* Packet data, possibly *after* rewrite. */
u8 packet_data[64 - 1*sizeof(u32)];
@ -1197,8 +1198,8 @@ static u8 * format_ip6_forward_next_trace (u8 * s, va_list * args)
uword indent = format_get_indent (s);
adj = ip_get_adjacency (&im->lookup_main, t->adj_index);
s = format (s, "adjacency: %U flow hash: 0x%08x",
format_ip_adjacency,
s = format (s, "fib %d adj-idx %d : %U flow hash: 0x%08x",
t->fib_index, t->adj_index, format_ip_adjacency,
vnm, &im->lookup_main, t->adj_index, t->flow_hash);
switch (adj->lookup_next_index)
{
@ -1225,6 +1226,7 @@ ip6_forward_next_trace (vlib_main_t * vm,
vlib_rx_or_tx_t which_adj_index)
{
u32 * from, n_left;
ip6_main_t * im = &ip6_main;
n_left = frame->n_vectors;
from = vlib_frame_vector_args (frame);
@ -1250,6 +1252,8 @@ ip6_forward_next_trace (vlib_main_t * vm,
t0 = vlib_add_trace (vm, node, b0, sizeof (t0[0]));
t0->adj_index = vnet_buffer (b0)->ip.adj_index[which_adj_index];
t0->flow_hash = vnet_buffer (b0)->ip.flow_hash;
t0->fib_index = vec_elt (im->fib_index_by_sw_if_index,
vnet_buffer(b0)->sw_if_index[VLIB_RX]);
memcpy (t0->packet_data,
vlib_buffer_get_current (b0),
sizeof (t0->packet_data));
@ -1259,6 +1263,8 @@ ip6_forward_next_trace (vlib_main_t * vm,
t1 = vlib_add_trace (vm, node, b1, sizeof (t1[0]));
t1->adj_index = vnet_buffer (b1)->ip.adj_index[which_adj_index];
t1->flow_hash = vnet_buffer (b1)->ip.flow_hash;
t1->fib_index = vec_elt (im->fib_index_by_sw_if_index,
vnet_buffer(b1)->sw_if_index[VLIB_RX]);
memcpy (t1->packet_data,
vlib_buffer_get_current (b1),
sizeof (t1->packet_data));
@ -1282,6 +1288,8 @@ ip6_forward_next_trace (vlib_main_t * vm,
t0 = vlib_add_trace (vm, node, b0, sizeof (t0[0]));
t0->adj_index = vnet_buffer (b0)->ip.adj_index[which_adj_index];
t0->flow_hash = vnet_buffer (b0)->ip.flow_hash;
t0->fib_index = vec_elt (im->fib_index_by_sw_if_index,
vnet_buffer(b0)->sw_if_index[VLIB_RX]);
memcpy (t0->packet_data,
vlib_buffer_get_current (b0),
sizeof (t0->packet_data));

View File

@ -430,6 +430,7 @@ VLIB_REGISTER_NODE (l2input_node,static) = {
.name = "l2-input",
.vector_size = sizeof (u32),
.format_trace = format_l2input_trace,
.format_buffer = format_ethernet_header_with_length,
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = ARRAY_LEN(l2input_error_strings),

View File

@ -232,6 +232,8 @@ vxlan_encap (vlib_main_t * vm,
/* Reset to look up tunnel partner in the configured FIB */
vnet_buffer(b0)->sw_if_index[VLIB_TX] = t0->encap_fib_index;
vnet_buffer(b1)->sw_if_index[VLIB_TX] = t1->encap_fib_index;
vnet_buffer(b0)->sw_if_index[VLIB_RX] = sw_if_index0;
vnet_buffer(b1)->sw_if_index[VLIB_RX] = sw_if_index1;
pkts_encapsulated += 2;
len0 = vlib_buffer_length_in_chain (vm, b0);
@ -374,6 +376,7 @@ vxlan_encap (vlib_main_t * vm,
/* Reset to look up tunnel partner in the configured FIB */
vnet_buffer(b0)->sw_if_index[VLIB_TX] = t0->encap_fib_index;
vnet_buffer(b0)->sw_if_index[VLIB_RX] = sw_if_index0;
pkts_encapsulated ++;
len0 = vlib_buffer_length_in_chain (vm, b0);

View File

@ -142,6 +142,7 @@ int vnet_vxlan_add_del_tunnel
vxlan_main_t * vxm = &vxlan_main;
vxlan_tunnel_t *t = 0;
vnet_main_t * vnm = vxm->vnet_main;
ip4_main_t * im4 = &ip4_main;
vnet_hw_interface_t * hi;
uword * p;
u32 hw_if_index = ~0;
@ -231,6 +232,8 @@ int vnet_vxlan_add_del_tunnel
}
vnet_sw_interface_set_flags (vnm, sw_if_index,
VNET_SW_INTERFACE_FLAG_ADMIN_UP);
vec_validate (im4->fib_index_by_sw_if_index, sw_if_index);
im4->fib_index_by_sw_if_index[sw_if_index] = t->encap_fib_index;
}
else
{