From 1f50bf8fc57ebf78f9056185a342493be460a847 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Tue, 16 Jul 2019 15:28:52 +0000 Subject: 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 --- src/plugins/map/map.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'src/plugins') 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 +#include #include #include #include @@ -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; -- cgit 1.2.3-korg