summaryrefslogtreecommitdiffstats
path: root/src/vnet/adj/adj_midchain_delegate.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-07-16 15:28:52 +0000
committerDave Barach <openvpp@barachs.net>2019-07-19 21:46:36 +0000
commit1f50bf8fc57ebf78f9056185a342493be460a847 (patch)
tree55bcf7508dc679b9a38552438d21b8b1fa05331e /src/vnet/adj/adj_midchain_delegate.c
parentcca9618a5e1b126263ef262974b0b4d6ac6352a2 (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/vnet/adj/adj_midchain_delegate.c')
-rw-r--r--src/vnet/adj/adj_midchain_delegate.c16
1 files changed, 7 insertions, 9 deletions
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 <vnet/adj/adj_delegate.h>
#include <vnet/adj/adj_midchain.h>
#include <vnet/fib/fib_table.h>
+#include <vnet/fib/fib_entry_track.h>
/**
* 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);
}