bgpd: Only grab the confed path count if we are comparing it

This is just a small optimization but when calling path_info_cmp
hundreds of millions of times this adds up.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2024-10-24 11:40:56 -04:00
parent ed94fbfe5b
commit e68550b8d8

View File

@ -1133,9 +1133,9 @@ int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
/* 4. AS path length check. */
if (!CHECK_FLAG(bgp->flags, BGP_FLAG_ASPATH_IGNORE)) {
int exist_hops = aspath_count_hops(existattr->aspath);
int exist_confeds = aspath_count_confeds(existattr->aspath);
if (CHECK_FLAG(bgp->flags, BGP_FLAG_ASPATH_CONFED)) {
int exist_confeds = aspath_count_confeds(existattr->aspath);
int aspath_hops;
aspath_hops = aspath_count_hops(newattr->aspath);