summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Worley <sworley@cumulusnetworks.com>2019-08-06 13:16:07 -0400
committerStephen Worley <sworley@cumulusnetworks.com>2019-10-25 11:13:42 -0400
commite4ac313b1280e15c13d12ff3dd25c7c09382920a (patch)
tree6c5510889ef95b5ecd4c0dc1a8a8b28fea17e284
parent6384cbcb0eaed417b95e9bce9f666d4f8ef4d7ca (diff)
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 <sworley@cumulusnetworks.com>
-rw-r--r--zebra/zebra_nhg.c6
1 files 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;
}