aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/fib/fib_entry_track.h
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_track.h
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_track.h')
-rw-r--r--src/vnet/fib/fib_entry_track.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/vnet/fib/fib_entry_track.h b/src/vnet/fib/fib_entry_track.h
new file mode 100644
index 00000000000..63d1be0ef9a
--- /dev/null
+++ b/src/vnet/fib/fib_entry_track.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2019 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __FIB_TRACKER_H__
+#define __FIB_TRACKER_H__
+
+#include <vnet/fib/fib_entry.h>
+
+/**
+ * Trackers are used on FIB entries by objects that which to track the
+ * changing state of the entry. For example a tunnel would track its
+ * destination address to be informed of reachability changes.
+ *
+ * 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.
+ */
+
+/**
+ * Track a FIB entry
+ * @param fib_index The FIB the entry is in
+ * @param prefix The Prefix of the entry to track
+ * @param child_type The type of object that is tracking this entry
+ * @param child_index The pool index of the object tracking
+ * @param sigbling [RETURNED] The sibling index of the child on the tracker
+ * @return The index of the FIB entry
+ */
+extern fib_node_index_t fib_entry_track(u32 fib_index,
+ const fib_prefix_t *prefix,
+ fib_node_type_t child_type,
+ index_t child_index,
+ u32 *sibling);
+
+/**
+ * Stop tracking a FIB entry
+ * @param fei FIB entry index (as returned from the track API above)
+ * @param sibling Sibling index (as returned from the track API above)
+ */
+extern void fib_entry_untrack(fib_node_index_t fei,
+ u32 sibling);
+
+extern void fib_entry_track_module_init(void);
+
+#endif