diff options
author | Neale Ranns <nranns@cisco.com> | 2019-07-16 15:28:52 +0000 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2019-07-19 21:46:36 +0000 |
commit | 1f50bf8fc57ebf78f9056185a342493be460a847 (patch) | |
tree | 55bcf7508dc679b9a38552438d21b8b1fa05331e /src/plugins/map/map.c | |
parent | cca9618a5e1b126263ef262974b0b4d6ac6352a2 (diff) |
fib: FIB Entry tracking
Instead of all clients directly RR sourcing the entry they are tracking,
use a deidcated 'tracker' object. This tracker object is a entry
delegate and a child of the entry. The clients are then children of the
tracker.
The benefit of this aproach is that each time a new client tracks the
entry it doesn't RR source it. When an entry is sourced all its children
are updated. Thus, new clients tracking an entry is O(n^2). With the
tracker as indirection, the entry is sourced only once.
Type: feature
Change-Id: I5b80bdda6c02057152e5f721e580e786cd840a3b
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/plugins/map/map.c')
-rw-r--r-- | src/plugins/map/map.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/plugins/map/map.c b/src/plugins/map/map.c index 9d89382ad17..d3ae23bbf50 100644 --- a/src/plugins/map/map.c +++ b/src/plugins/map/map.c @@ -16,6 +16,7 @@ */ #include <vnet/fib/fib_table.h> +#include <vnet/fib/fib_entry_track.h> #include <vnet/fib/ip6_fib.h> #include <vnet/adj/adj.h> #include <vppinfra/crc32.h> @@ -385,10 +386,8 @@ map_fib_resolve (map_main_pre_resolved_t * pr, .fp_addr = *addr, }; - pr->fei = fib_table_entry_special_add (0, // default fib - &pfx, - FIB_SOURCE_RR, FIB_ENTRY_FLAG_NONE); - pr->sibling = fib_entry_child_add (pr->fei, FIB_NODE_TYPE_MAP_E, proto); + pr->fei = fib_entry_track (0, // default fib + &pfx, FIB_NODE_TYPE_MAP_E, proto, &pr->sibling); map_stack (pr); } @@ -396,18 +395,10 @@ static void map_fib_unresolve (map_main_pre_resolved_t * pr, fib_protocol_t proto, u8 len, const ip46_address_t * addr) { - fib_prefix_t pfx = { - .fp_proto = proto, - .fp_len = len, - .fp_addr = *addr, - }; - if (pr->fei != FIB_NODE_INDEX_INVALID) { - fib_entry_child_remove (pr->fei, pr->sibling); + fib_entry_untrack (pr->fei, pr->sibling); - fib_table_entry_special_remove (0, // default fib - &pfx, FIB_SOURCE_RR); dpo_reset (&pr->dpo); pr->fei = FIB_NODE_INDEX_INVALID; |