diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-11-30 14:03:07 -0500 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-12-05 17:26:32 -0500 |
| commit | 5f7a4718e201724a8ca697dedaa8ce008949c3f5 (patch) | |
| tree | 076ee09a55a48257a55f90812babd340ba012b4f /zebra/zebra_static.c | |
| parent | 17473b9a4589054ce2b3c81e4f2f32e7573d75c3 (diff) | |
zebra: Replace SELECTED_FIB flag with a rib_dest_t pointer
The SELECTED_FIB flag was placed upon the entry that we
have inserted into the kernel. Remove this flag and replace
with a `rib_dest_t` *selected_fib. Just keep track of the
selected_fib as we modify it. This removes allot of
FOREACH_RE loops as that we do not need to find the
entry anymore.
At this point in time I think this is a very minor performance
boost. Most `rib_dest_t` structures do not typically carry
more than 1 route_entry, but the minute you start having more
than one entry you can and will start having significant processing
time spent finding the selected_fib.
A future commit may re-order the route entries and possibly
keep more pointers on `rib_dest_t` to avoid lookup. This
is a bit tricky because of the FIB_OVERRIDE code.
Signed-off-by Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_static.c')
| -rw-r--r-- | zebra/zebra_static.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c index 5927ba9d75..751ea08a38 100644 --- a/zebra/zebra_static.c +++ b/zebra/zebra_static.c @@ -331,11 +331,12 @@ void static_uninstall_route(afi_t afi, safi_t safi, struct prefix *p, } UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE); if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB)) { + rib_dest_t *dest = rib_dest_from_rnode(rn); + /* If there are other active nexthops, do an update. */ if (re->nexthop_active_num > 1) { /* Update route in kernel if it's in fib */ - if (CHECK_FLAG(re->status, - ROUTE_ENTRY_SELECTED_FIB)) + if (dest->selected_fib) rib_install_kernel(rn, re, re); /* Update redistribution if it's selected */ if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED)) @@ -350,8 +351,7 @@ void static_uninstall_route(afi_t afi, safi_t safi, struct prefix *p, p, (struct prefix *)src_p, re); /* Remove from kernel if fib route becomes * inactive */ - if (CHECK_FLAG(re->status, - ROUTE_ENTRY_SELECTED_FIB)) + if (dest->selected_fib) rib_uninstall_kernel(rn, re); } } |
