diff options
author | Ole Troan <ot@cisco.com> | 2016-06-14 21:12:32 +0200 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2016-06-16 18:05:51 +0000 |
commit | f0f852251c885fc5f73125a4365cf356feeb0cdd (patch) | |
tree | 27174d12213ccc53fb9bf2a85b9643eb93e5d7df /vnet/vnet/classify | |
parent | 81f7092d34d9ce2c674fb0ff7683188231d1b773 (diff) |
VPP-19: Split the lookup.h IP_LOOKUP_NEXT enum.
IP4 and IP6 nodes currently shares the adj->lookup_next_index. That
has some issues, e.g. that one has to add non-functional nodes like
ip4-hop-by-hop and that anyone dynamically adding nodes to any of the
IP4/IP6 lookup nodes must ensure they add themselves to all relevant
nodes to ensure next index consistency.
This patch splits the IP_LOOKUP_NEXT into separate enums for IP4 and
IP6 with a common part for next-nodes used by both. It sets up other
IP nodes as siblings to avoid inconsistencies. This allows IP4 and IP6
lookup next nodes to evolve independently. The adj->lookup_next_index is
still shared, assuming that an IP4 adjacency isn't used by an
IP6 graph node.
Change-Id: I589b8364fe54e7a10c059b7ef9d6707eb0a345cc
Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'vnet/vnet/classify')
-rw-r--r-- | vnet/vnet/classify/ip_classify.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/vnet/vnet/classify/ip_classify.c b/vnet/vnet/classify/ip_classify.c index 75e80ad67ab..c44f25e2add 100644 --- a/vnet/vnet/classify/ip_classify.c +++ b/vnet/vnet/classify/ip_classify.c @@ -68,11 +68,15 @@ ip_classify_inline (vlib_main_t * vm, u32 hits = 0; u32 misses = 0; u32 chain_hits = 0; + u32 n_next; - if (is_ip4) + if (is_ip4) { lm = &ip4_main.lookup_main; - else + n_next = IP4_LOOKUP_N_NEXT; + } else { lm = &ip6_main.lookup_main; + n_next = IP6_LOOKUP_N_NEXT; + } from = vlib_frame_vector_args (frame); n_left_from = frame->n_vectors; @@ -253,8 +257,8 @@ ip_classify_inline (vlib_main_t * vm, t0->next_table_index); else { - next0 = (t0->miss_next_index < IP_LOOKUP_N_NEXT)? - t0->miss_next_index:next0; + next0 = (t0->miss_next_index < n_next) ? + t0->miss_next_index : next0; misses++; break; } @@ -321,12 +325,12 @@ VLIB_REGISTER_NODE (ip4_classify_node) = { .function = ip4_classify, .name = "ip4-classify", .vector_size = sizeof (u32), + .sibling_of = "ip4-lookup", .format_trace = format_ip_classify_trace, .n_errors = ARRAY_LEN(ip_classify_error_strings), .error_strings = ip_classify_error_strings, - .n_next_nodes = IP_LOOKUP_N_NEXT, - .next_nodes = IP4_LOOKUP_NEXT_NODES, + .n_next_nodes = 0, }; VLIB_NODE_FUNCTION_MULTIARCH (ip4_classify_node, ip4_classify) @@ -344,12 +348,12 @@ VLIB_REGISTER_NODE (ip6_classify_node) = { .function = ip6_classify, .name = "ip6-classify", .vector_size = sizeof (u32), + .sibling_of = "ip6-lookup", .format_trace = format_ip_classify_trace, .n_errors = ARRAY_LEN(ip_classify_error_strings), .error_strings = ip_classify_error_strings, - .n_next_nodes = IP_LOOKUP_N_NEXT, - .next_nodes = IP6_LOOKUP_NEXT_NODES, + .n_next_nodes = 0, }; VLIB_NODE_FUNCTION_MULTIARCH (ip6_classify_node, ip6_classify) |