summaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/dpo/dpo.c47
-rw-r--r--vnet/vnet/dpo/lookup_dpo.c6
-rw-r--r--vnet/vnet/dpo/mpls_label_dpo.c11
-rw-r--r--vnet/vnet/fib/fib_entry_src.c17
-rw-r--r--vnet/vnet/fib/fib_test.c4
5 files changed, 38 insertions, 47 deletions
diff --git a/vnet/vnet/dpo/dpo.c b/vnet/vnet/dpo/dpo.c
index efee6d6b..3542b3f1 100644
--- a/vnet/vnet/dpo/dpo.c
+++ b/vnet/vnet/dpo/dpo.c
@@ -65,15 +65,18 @@ static const char* const * const ** dpo_nodes;
/**
* @brief Vector of edge indicies from parent DPO nodes to child
*
- * dpo_edges[child_type][child_proto][parent_type] = edge_index
+ * dpo_edges[child_type][child_proto][parent_type][parent_proto] = edge_index
*
* This array is derived at init time from the dpo_nodes above. Note that
* the third dimension in dpo_nodes is lost, hence, the edge index from each
* node MUST be the same.
+ * Including both the child and parent protocol is required to support the
+ * case where it changes as the grapth is traversed, most notablly when an
+ * MPLS label is popped.
*
* Note that this array is child type specific, not child instance specific.
*/
-static u32 ***dpo_edges;
+static u32 ****dpo_edges;
/**
* @brief The DPO type value that can be assigend to the next dynamic
@@ -269,13 +272,15 @@ dpo_get_next_node (dpo_type_t child_type,
vec_validate(dpo_edges, child_type);
vec_validate(dpo_edges[child_type], child_proto);
- vec_validate_init_empty(dpo_edges[child_type][child_proto],
- parent_dpo->dpoi_type, ~0);
+ vec_validate(dpo_edges[child_type][child_proto], parent_type);
+ vec_validate_init_empty(
+ dpo_edges[child_type][child_proto][parent_type],
+ parent_proto, ~0);
/*
* if the edge index has not yet been created for this node to node transistion
*/
- if (~0 == dpo_edges[child_type][child_proto][parent_type])
+ if (~0 == dpo_edges[child_type][child_proto][parent_type][parent_proto])
{
vlib_node_t *parent_node, *child_node;
vlib_main_t *vm;
@@ -288,45 +293,45 @@ dpo_get_next_node (dpo_type_t child_type,
ASSERT(NULL != dpo_nodes[parent_type]);
ASSERT(NULL != dpo_nodes[parent_type][parent_proto]);
- pp = 0;
+ cc = 0;
/*
* create a graph arc from each of the parent's registered node types,
* to each of the childs.
*/
- while (NULL != dpo_nodes[child_type][child_proto][pp])
+ while (NULL != dpo_nodes[child_type][child_proto][cc])
{
- parent_node =
+ child_node =
vlib_get_node_by_name(vm,
- (u8*) dpo_nodes[child_type][child_proto][pp]);
+ (u8*) dpo_nodes[child_type][child_proto][cc]);
- cc = 0;
+ pp = 0;
- while (NULL != dpo_nodes[parent_type][child_proto][cc])
+ while (NULL != dpo_nodes[parent_type][parent_proto][pp])
{
- child_node =
+ parent_node =
vlib_get_node_by_name(vm,
- (u8*) dpo_nodes[parent_type][parent_proto][cc]);
+ (u8*) dpo_nodes[parent_type][parent_proto][pp]);
edge = vlib_node_add_next(vm,
- parent_node->index,
- child_node->index);
+ child_node->index,
+ parent_node->index);
- if (~0 == dpo_edges[child_type][child_proto][parent_type])
+ if (~0 == dpo_edges[child_type][child_proto][parent_type][parent_proto])
{
- dpo_edges[child_type][child_proto][parent_type] = edge;
+ dpo_edges[child_type][child_proto][parent_type][parent_proto] = edge;
}
else
{
- ASSERT(dpo_edges[child_type][child_proto][parent_type] == edge);
+ ASSERT(dpo_edges[child_type][child_proto][parent_type][parent_proto] == edge);
}
- cc++;
+ pp++;
}
- pp++;
+ cc++;
}
}
- return (dpo_edges[child_type][child_proto][parent_type]);
+ return (dpo_edges[child_type][child_proto][parent_type][parent_proto]);
}
/**
diff --git a/vnet/vnet/dpo/lookup_dpo.c b/vnet/vnet/dpo/lookup_dpo.c
index c9e0fca7..b13000dd 100644
--- a/vnet/vnet/dpo/lookup_dpo.c
+++ b/vnet/vnet/dpo/lookup_dpo.c
@@ -685,10 +685,10 @@ lookup_dpo_ip6_inline (vlib_main_t * vm,
if (table_from_interface)
{
fib_index0 =
- ip4_fib_table_get_index_for_sw_if_index(
+ ip6_fib_table_get_index_for_sw_if_index(
vnet_buffer(b0)->sw_if_index[VLIB_RX]);
fib_index1 =
- ip4_fib_table_get_index_for_sw_if_index(
+ ip6_fib_table_get_index_for_sw_if_index(
vnet_buffer(b1)->sw_if_index[VLIB_RX]);
}
else
@@ -810,7 +810,7 @@ lookup_dpo_ip6_inline (vlib_main_t * vm,
if (table_from_interface)
{
fib_index0 =
- ip4_fib_table_get_index_for_sw_if_index(
+ ip6_fib_table_get_index_for_sw_if_index(
vnet_buffer(b0)->sw_if_index[VLIB_RX]);
}
else
diff --git a/vnet/vnet/dpo/mpls_label_dpo.c b/vnet/vnet/dpo/mpls_label_dpo.c
index 532d0447..48c03be5 100644
--- a/vnet/vnet/dpo/mpls_label_dpo.c
+++ b/vnet/vnet/dpo/mpls_label_dpo.c
@@ -82,11 +82,12 @@ format_mpls_label_dpo (u8 *s, va_list *args)
hdr.label_exp_s_ttl =
clib_net_to_host_u32(mld->mld_hdr.label_exp_s_ttl);
- return (format(s, "mpls-label:[%d]:%U\n%U%U",
- index,
- format_mpls_header, hdr,
- format_white_space, indent,
- format_dpo_id, &mld->mld_dpo, indent+2));
+ s = format(s, "mpls-label:[%d]:", index);
+ s = format(s, "%U\n", format_mpls_header, hdr);
+ s = format(s, "%U", format_white_space, indent);
+ s = format(s, "%U", format_dpo_id, &mld->mld_dpo, indent+2);
+
+ return (s);
}
static void
diff --git a/vnet/vnet/fib/fib_entry_src.c b/vnet/vnet/fib/fib_entry_src.c
index 2cbdf187..6fb2e64c 100644
--- a/vnet/vnet/fib/fib_entry_src.c
+++ b/vnet/vnet/fib/fib_entry_src.c
@@ -34,21 +34,6 @@ fib_entry_get_proto (const fib_entry_t * fib_entry)
return (fib_entry->fe_prefix.fp_proto);
}
-static dpo_proto_t
-fib_entry_get_payload_proto (const fib_entry_t * fib_entry)
-{
- switch (fib_entry->fe_prefix.fp_proto)
- {
- case FIB_PROTOCOL_IP4:
- case FIB_PROTOCOL_IP6:
- return fib_proto_to_dpo(fib_entry->fe_prefix.fp_proto);
- case FIB_PROTOCOL_MPLS:
- return fib_entry->fe_prefix.fp_payload_proto;
- }
-
- return (fib_proto_to_dpo(fib_entry->fe_prefix.fp_proto));
-}
-
void
fib_entry_src_register (fib_source_t source,
const fib_entry_src_vft_t *vft)
@@ -344,7 +329,7 @@ fib_entry_src_mk_lb (fib_entry_t *fib_entry,
.fct = fct,
};
- lb_proto = fib_entry_get_payload_proto(fib_entry);
+ lb_proto = fib_proto_to_dpo(fib_entry->fe_prefix.fp_proto);
fib_path_list_walk(esrc->fes_pl,
fib_entry_src_collect_forwarding,
diff --git a/vnet/vnet/fib/fib_test.c b/vnet/vnet/fib/fib_test.c
index 800f4e6a..2194fcbc 100644
--- a/vnet/vnet/fib/fib_test.c
+++ b/vnet/vnet/fib/fib_test.c
@@ -4824,7 +4824,7 @@ fib_test_validate_lb_v (const load_balance_t *lb,
FIB_TEST_LB((exp->special.adj == dpo->dpoi_index),
"bucket %d stacks on drop %d",
bucket,
- exp->adj.adj);
+ exp->special.adj);
break;
}
}
@@ -5489,7 +5489,7 @@ fib_test_label (void)
fib_test_lb_bucket_t bucket_drop = {
.type = FT_LB_SPECIAL,
.special = {
- .adj = 1,
+ .adj = DPO_PROTO_IP4,
},
};