aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Barach <openvpp@barachs.net>2016-01-19 23:18:12 +0000
committerGerrit Code Review <gerrit@fd.io>2016-01-19 23:18:13 +0000
commit13056f93d95182790224c592b4ab78cf5082ebf7 (patch)
tree260f68bae0d9132a441da3c34a4a0bfc04c2c2f5
parent1549b61e76a87e88b4c35c56e63dcbd61e00943b (diff)
parent2d34374f7d2f624a4a66cf46d4d11e5b49808ada (diff)
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."
-rw-r--r--vnet/vnet/ip/ip4_forward.c4
-rw-r--r--vnet/vnet/ip/ip6_forward.c12
-rw-r--r--vnet/vnet/l2/l2_input.c1
-rw-r--r--vnet/vnet/vxlan/encap.c3
-rw-r--r--vnet/vnet/vxlan/vxlan.c3
5 files changed, 19 insertions, 4 deletions
diff --git a/vnet/vnet/ip/ip4_forward.c b/vnet/vnet/ip/ip4_forward.c
index fd304163..010e7796 100644
--- a/vnet/vnet/ip/ip4_forward.c
+++ b/vnet/vnet/ip/ip4_forward.c
@@ -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)
{
diff --git a/vnet/vnet/ip/ip6_forward.c b/vnet/vnet/ip/ip6_forward.c
index f0065e96..abd34208 100644
--- a/vnet/vnet/ip/ip6_forward.c
+++ b/vnet/vnet/ip/ip6_forward.c
@@ -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));
diff --git a/vnet/vnet/l2/l2_input.c b/vnet/vnet/l2/l2_input.c
index 34f8a771..31744f5f 100644
--- a/vnet/vnet/l2/l2_input.c
+++ b/vnet/vnet/l2/l2_input.c
@@ -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),
diff --git a/vnet/vnet/vxlan/encap.c b/vnet/vnet/vxlan/encap.c
index 4b475f83..dfa3bf77 100644
--- a/vnet/vnet/vxlan/encap.c
+++ b/vnet/vnet/vxlan/encap.c
@@ -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);
diff --git a/vnet/vnet/vxlan/vxlan.c b/vnet/vnet/vxlan/vxlan.c
index 316f8cb1..28ed173c 100644
--- a/vnet/vnet/vxlan/vxlan.c
+++ b/vnet/vnet/vxlan/vxlan.c
@@ -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
{