diff options
| author | Stephen Worley <sworley@cumulusnetworks.com> | 2019-08-07 13:47:34 -0400 |
|---|---|---|
| committer | Stephen Worley <sworley@cumulusnetworks.com> | 2019-10-25 11:13:42 -0400 |
| commit | 986a6617cc9425dfa4f9fcc879a4d98a3ab00b7c (patch) | |
| tree | 44772a96baabf35324c016c3b700a9d366a51a64 /lib/nexthop.c | |
| parent | 2001be6cc0926bfb5c38d64b74399beff13e00b2 (diff) | |
zebra: Optimize the fib/notified nexthop matching
Optimize the fib and notified nexthop group comparison algorithm
to assume ordering. There were some pretty serious performance hits with
this on high ecmp routes.
Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
Diffstat (limited to 'lib/nexthop.c')
| -rw-r--r-- | lib/nexthop.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/nexthop.c b/lib/nexthop.c index da7c934efa..3ab7284492 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -364,6 +364,19 @@ struct nexthop *nexthop_next(struct nexthop *nexthop) return NULL; } +/* Return the next nexthop in the tree that is resolved and active */ +struct nexthop *nexthop_next_active_resolved(struct nexthop *nexthop) +{ + struct nexthop *next = nexthop_next(nexthop); + + while (next + && (CHECK_FLAG(next->flags, NEXTHOP_FLAG_RECURSIVE) + || !CHECK_FLAG(next->flags, NEXTHOP_FLAG_ACTIVE))) + next = nexthop_next(next); + + return next; +} + unsigned int nexthop_level(struct nexthop *nexthop) { unsigned int rv = 0; |
