From e4ac313b1280e15c13d12ff3dd25c7c09382920a Mon Sep 17 00:00:00 2001 From: Stephen Worley Date: Tue, 6 Aug 2019 13:16:07 -0400 Subject: [PATCH] zebra: Check active count first in nhg_hash_equal Before checking the equivalence of the whole group itself, check to see if they contain the same number of non-recursive active nexthops. This should shorten lookup time for the case of non-resolved nexthop group creation. Signed-off-by: Stephen Worley --- zebra/zebra_nhg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index b343778bf3..3a2efacd9b 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -387,13 +387,13 @@ bool zebra_nhg_hash_equal(const void *arg1, const void *arg2) if (nhe1->afi != nhe2->afi) return false; - if (!nexthop_group_equal(nhe1->nhg, nhe2->nhg)) - return false; - if (nexthop_group_active_nexthop_num_no_recurse(nhe1->nhg) != nexthop_group_active_nexthop_num_no_recurse(nhe2->nhg)) return false; + if (!nexthop_group_equal(nhe1->nhg, nhe2->nhg)) + return false; + return true; } -- 2.39.5