diff options
author | Neale Ranns <nranns@cisco.com> | 2016-10-08 13:03:40 +0100 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2016-10-14 13:50:39 +0000 |
commit | b80c536e34b610ca77cd84448754e4bd9c46cf68 (patch) | |
tree | d7a868cdd657a3a54ff9eef76bfe3e7e4678e6d3 /vnet/vnet/fib/fib_test.c | |
parent | 3ae1a91430a341cd9ca96023e4fb619efe7cac7e (diff) |
FIB2.0: Adjacency complete pull model (VPP-487)
Change the adjacency completion model to pull not push.
A complete adjacency has a rewirte string, an incomplete one does not. the re-write string for a peer comes either from a discovery protocol (i.e. ARP/ND) or can be directly derived from the link type (i.e. GRE tunnels). Which method it is, is interface type specific.
For each packet type sent on a link to a peer there is a corresponding adjacency. For example, if there is a peer 10.0.0.1 on Eth0 and we need to send to it IPv4 and MPLS packets, there will be two adjacencies; one for the IPv4 and one for the MPLS packets. The adjacencies are thus distinguished by the packets the carry, this is known as the adjacency's 'link-type'. It is not an L3 packet type, since the adjacency can have a link type of Ethernet (for L2 over GRE).
The discovery protocols are not aware of all the link types required - only the FIB is. the FIB will create adjacencies as and when they are required, and it is thus then desirable to 'pull' from the discovery protocol the re-write required. The alternative (that we have now) is that the discovery protocol pushes (i.e. creates) adjacencies for each link type - this creates more adjacencies than we need.
To pull, FIB now requests from the interface-type to 'complete' the adjacency. The interface can then delegate to the discovery protocol (on ethernet links) or directly build the re-write (i.e on GRE).
Change-Id: I61451789ae03f26b1012d8d6524007b769b6c6ee
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'vnet/vnet/fib/fib_test.c')
-rw-r--r-- | vnet/vnet/fib/fib_test.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/vnet/vnet/fib/fib_test.c b/vnet/vnet/fib/fib_test.c index 7729209d6ab..1e459cf1a6c 100644 --- a/vnet/vnet/fib/fib_test.c +++ b/vnet/vnet/fib/fib_test.c @@ -222,6 +222,19 @@ fib_test_urpf_is_equal (fib_node_index_t fei, return (1); } +static u8* +fib_test_build_rewrite (u8 *eth_addr) +{ + u8* rewrite = NULL; + + vec_validate(rewrite, 13); + + memcpy(rewrite, eth_addr, 6); + memcpy(rewrite+6, eth_addr, 6); + + return (rewrite); +} + static void fib_test_v4 (void) { @@ -523,6 +536,7 @@ fib_test_v4 (void) u8 eth_addr[] = { 0xde, 0xde, 0xde, 0xba, 0xba, 0xba, }; + ip46_address_t nh_12_12_12_12 = { .ip4.as_u32 = clib_host_to_net_u32(0x0c0c0c0c), }; @@ -561,7 +575,8 @@ fib_test_v4 (void) &adj->sub_type.nbr.next_hop)), "adj nbr next-hop ok"); - adj_nbr_update_rewrite(ai_01, eth_addr); + adj_nbr_update_rewrite(ai_01, ADJ_NBR_REWRITE_FLAG_COMPLETE, + fib_test_build_rewrite(eth_addr)); FIB_TEST((IP_LOOKUP_NEXT_REWRITE == adj->lookup_next_index), "adj is complete"); FIB_TEST((0 == ip46_address_cmp(&pfx_10_10_10_1_s_32.fp_addr, @@ -589,7 +604,8 @@ fib_test_v4 (void) FIB_TEST((0 == ip46_address_cmp(&nh_12_12_12_12, &adj->sub_type.nbr.next_hop)), "adj nbr next-hop ok"); - adj_nbr_update_rewrite(ai_12_12_12_12, eth_addr); + adj_nbr_update_rewrite(ai_12_12_12_12, ADJ_NBR_REWRITE_FLAG_COMPLETE, + fib_test_build_rewrite(eth_addr)); FIB_TEST((IP_LOOKUP_NEXT_REWRITE == adj->lookup_next_index), "adj is complete"); @@ -636,7 +652,8 @@ fib_test_v4 (void) &adj->sub_type.nbr.next_hop)), "adj nbr next-hop ok"); - adj_nbr_update_rewrite(ai_02, eth_addr); + adj_nbr_update_rewrite(ai_02, ADJ_NBR_REWRITE_FLAG_COMPLETE, + fib_test_build_rewrite(eth_addr)); FIB_TEST((IP_LOOKUP_NEXT_REWRITE == adj->lookup_next_index), "adj is complete"); FIB_TEST((0 == ip46_address_cmp(&pfx_10_10_10_2_s_32.fp_addr, @@ -3113,7 +3130,8 @@ fib_test_v6 (void) &adj->sub_type.nbr.next_hop)), "adj nbr next-hop ok"); - adj_nbr_update_rewrite(ai_01, eth_addr); + adj_nbr_update_rewrite(ai_01, ADJ_NBR_REWRITE_FLAG_COMPLETE, + fib_test_build_rewrite(eth_addr)); FIB_TEST((IP_LOOKUP_NEXT_REWRITE == adj->lookup_next_index), "adj is complete"); FIB_TEST((0 == ip46_address_cmp(&pfx_2001_1_2_s_128.fp_addr, @@ -3150,7 +3168,8 @@ fib_test_v6 (void) &adj->sub_type.nbr.next_hop)), "adj nbr next-hop ok"); - adj_nbr_update_rewrite(ai_02, eth_addr); + adj_nbr_update_rewrite(ai_02, ADJ_NBR_REWRITE_FLAG_COMPLETE, + fib_test_build_rewrite(eth_addr)); FIB_TEST((IP_LOOKUP_NEXT_REWRITE == adj->lookup_next_index), "adj is complete"); FIB_TEST((0 == ip46_address_cmp(&pfx_2001_1_3_s_128.fp_addr, |