aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/udp/udp_encap.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/udp/udp_encap.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/udp/udp_encap.c')
-rw-r--r--src/vnet/udp/udp_encap.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/vnet/udp/udp_encap.c b/src/vnet/udp/udp_encap.c
index df4a811f3dd..0b1d3d7125b 100644
--- a/src/vnet/udp/udp_encap.c
+++ b/src/vnet/udp/udp_encap.c
@@ -15,6 +15,7 @@
#include <vnet/udp/udp_encap.h>
#include <vnet/fib/fib_entry.h>
+#include <vnet/fib/fib_entry_track.h>
#include <vnet/fib/fib_table.h>
#include <vnet/dpo/drop_dpo.h>
@@ -117,14 +118,10 @@ udp_encap_add_and_lock (fib_protocol_t proto,
.fp_addr = *dst_ip,
};
- ue->ue_fib_entry_index =
- fib_table_entry_special_add (fib_index,
- &dst_pfx,
- FIB_SOURCE_RR, FIB_ENTRY_FLAG_NONE);
- ue->ue_fib_sibling =
- fib_entry_child_add (ue->ue_fib_entry_index,
- FIB_NODE_TYPE_UDP_ENCAP, uei);
-
+ ue->ue_fib_entry_index = fib_entry_track (fib_index,
+ &dst_pfx,
+ FIB_NODE_TYPE_UDP_ENCAP,
+ uei, &ue->ue_fib_sibling);
udp_encap_restack (ue);
return (uei);
@@ -322,9 +319,7 @@ udp_encap_fib_last_lock_gone (fib_node_t * node)
*/
dpo_reset (&ue->ue_dpo);
- fib_entry_child_remove (ue->ue_fib_entry_index, ue->ue_fib_sibling);
- fib_table_entry_delete_index (ue->ue_fib_entry_index, FIB_SOURCE_RR);
-
+ fib_entry_untrack (ue->ue_fib_entry_index, ue->ue_fib_sibling);
pool_put (udp_encap_pool, ue);
}