summaryrefslogtreecommitdiffstats
path: root/src/vnet/fib/fib_entry.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/fib/fib_entry.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/fib/fib_entry.c')
-rw-r--r--src/vnet/fib/fib_entry.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/vnet/fib/fib_entry.c b/src/vnet/fib/fib_entry.c
index 6ff692dea98..9169dccff8a 100644
--- a/src/vnet/fib/fib_entry.c
+++ b/src/vnet/fib/fib_entry.c
@@ -28,6 +28,8 @@
#include <vnet/fib/fib_internal.h>
#include <vnet/fib/fib_attached_export.h>
#include <vnet/fib/fib_path_ext.h>
+#include <vnet/fib/fib_entry_delegate.h>
+#include <vnet/fib/fib_entry_track.h>
/*
* Array of strings/names for the FIB sources
@@ -203,14 +205,13 @@ format_fib_entry (u8 * s, va_list * args)
if (level >= FIB_ENTRY_FORMAT_DETAIL2)
{
- fib_entry_delegate_type_t fdt;
- fib_entry_delegate_t *fed;
+ index_t *fedi;
s = format (s, " Delegates:\n");
- FOR_EACH_DELEGATE(fib_entry, fdt, fed,
+ vec_foreach(fedi, fib_entry->fe_delegates)
{
- s = format(s, " %U\n", format_fib_entry_deletegate, fed);
- });
+ s = format(s, " %U\n", format_fib_entry_delegate, *fedi);
+ }
}
}
@@ -464,8 +465,8 @@ fib_entry_contribute_forwarding (fib_node_index_t fib_entry_index,
}
else
{
- fed = fib_entry_delegate_get(fib_entry,
- fib_entry_chain_type_to_delegate_type(fct));
+ fed = fib_entry_delegate_find(fib_entry,
+ fib_entry_chain_type_to_delegate_type(fct));
if (NULL == fed)
{
@@ -1486,7 +1487,7 @@ fib_entry_is_resolved (fib_node_index_t fib_entry_index)
fib_entry = fib_entry_get(fib_entry_index);
- fed = fib_entry_delegate_get(fib_entry, FIB_ENTRY_DELEGATE_BFD);
+ fed = fib_entry_delegate_find(fib_entry, FIB_ENTRY_DELEGATE_BFD);
if (NULL == fed)
{
@@ -1642,6 +1643,8 @@ fib_entry_module_init (void)
{
fib_node_register_type(FIB_NODE_TYPE_ENTRY, &fib_entry_vft);
fib_entry_logger = vlib_log_register_class("fib", "entry");
+
+ fib_entry_track_module_init();
}
fib_route_path_t *