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_vty.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_vty.c')
| -rw-r--r-- | zebra/zebra_vty.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index c2c7075671..198eb090cd 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -961,6 +961,7 @@ static int do_show_ip_route(struct vty *vty, const char *vrf_name, afi_t afi, u_short ospf_instance_id) { struct route_table *table; + rib_dest_t *dest; struct route_node *rn; struct route_entry *re; int first = 1; @@ -998,10 +999,11 @@ static int do_show_ip_route(struct vty *vty, const char *vrf_name, afi_t afi, /* Show all routes. */ for (rn = route_top(table); rn; rn = route_next(rn)) { + dest = rib_dest_from_rnode(rn); + RNODE_FOREACH_RE (rn, re) { if (use_fib - && !CHECK_FLAG(re->status, - ROUTE_ENTRY_SELECTED_FIB)) + && re != dest->selected_fib) continue; if (tag && re->tag != tag) |
