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/vnet/adj/adj_midchain_delegate.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/vnet/adj/adj_midchain_delegate.c') diff --git a/src/vnet/adj/adj_midchain_delegate.c b/src/vnet/adj/adj_midchain_delegate.c index 922283e92cf..9e788432640 100644 --- a/src/vnet/adj/adj_midchain_delegate.c +++ b/src/vnet/adj/adj_midchain_delegate.c @@ -16,6 +16,7 @@ #include #include #include +#include /** * Midchain stacker delegate @@ -121,13 +122,11 @@ adj_midchain_delegate_stack (adj_index_t ai, amd->amd_fei = FIB_NODE_INDEX_INVALID; adj_delegate_add(adj, ADJ_DELEGATE_MIDCHAIN, amd - amd_pool); - amd->amd_fei = fib_table_entry_special_add(fib_index, - pfx, - FIB_SOURCE_RR, - FIB_ENTRY_FLAG_NONE); - amd->amd_sibling = fib_entry_child_add(amd->amd_fei, - FIB_NODE_TYPE_ADJ, - ai); + amd->amd_fei = fib_entry_track(fib_index, + pfx, + FIB_NODE_TYPE_ADJ, + ai, + &amd->amd_sibling); } adj_midchain_delegate_restack_i(ai, amd); } @@ -145,8 +144,7 @@ adj_midchain_delegate_adj_deleted (adj_delegate_t *ad) amd = pool_elt_at_index(amd_pool, ad->ad_index); - fib_entry_child_remove (amd->amd_fei, amd->amd_sibling); - fib_table_entry_delete_index (amd->amd_fei, FIB_SOURCE_RR); + fib_entry_untrack(amd->amd_fei, amd->amd_sibling); pool_put(amd_pool, amd); } -- cgit 1.2.3-korg