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>
This commit is contained in:
Stephen Worley 2019-08-06 13:16:07 -04:00
parent 6384cbcb0e
commit e4ac313b12

View File

@ -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;
}