diff options
| author | Stephen Worley <sworley@cumulusnetworks.com> | 2020-05-13 14:32:13 -0400 |
|---|---|---|
| committer | Stephen Worley <sworley@cumulusnetworks.com> | 2020-09-28 12:40:59 -0400 |
| commit | 54c89c9377685e32010ab1f788b2a19c0bc3531b (patch) | |
| tree | 0c3e604646bd67b9230d151058fdcb9a9358197f /zebra/zebra_nhg.c | |
| parent | 16b20ad0628ee98537c79ae7e018303ad1de8aca (diff) | |
zebra: NHG ID bounds macros
Determine the NHG ID spacing and lower bound with ZEBRA_ROUTE_MAX
in macros.
Directly set the upperbound to be the lower 28bits of the uint32_t ID
space (the top 4 are reserved for l2-NHGs). Round that number down
a bit to make it more even.
Convert all former lower_bound calls to just use the macro.
Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_nhg.c')
| -rw-r--r-- | zebra/zebra_nhg.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 74551e31c4..c078b25ab1 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -676,7 +676,7 @@ static bool zebra_nhe_find(struct nhg_hash_entry **nhe, /* return value */ if (lookup->id == 0) lookup->id = ++id_counter; - if (lookup->id < zclient_get_nhg_lower_bound()) { + if (lookup->id < ZEBRA_NHG_PROTO_LOWER) { /* * This is a zebra hashed/owned NHG. * @@ -730,7 +730,7 @@ static bool zebra_nhe_find(struct nhg_hash_entry **nhe, /* return value */ if (CHECK_FLAG(nh->flags, NEXTHOP_FLAG_ACTIVE)) SET_FLAG(newnhe->flags, NEXTHOP_GROUP_VALID); - if (nh->next == NULL && newnhe->id < zclient_get_nhg_lower_bound()) { + if (nh->next == NULL && newnhe->id < ZEBRA_NHG_PROTO_LOWER) { if (CHECK_FLAG(nh->flags, NEXTHOP_FLAG_RECURSIVE)) { /* Single recursive nexthop */ handle_recursive_depend(&newnhe->nhg_depends, @@ -1246,7 +1246,7 @@ int zebra_nhg_kernel_find(uint32_t id, struct nexthop *nh, struct nh_grp *grp, zlog_debug("%s: nh %pNHv, id %u, count %d", __func__, nh, id, (int)count); - if (id > id_counter && id < zclient_get_nhg_lower_bound()) + if (id > id_counter && id < ZEBRA_NHG_PROTO_LOWER) /* Increase our counter so we don't try to create * an ID that already exists */ @@ -2319,7 +2319,7 @@ int nexthop_active_update(struct route_node *rn, struct route_entry *re) struct nhg_hash_entry *curr_nhe; uint32_t curr_active = 0, backup_active = 0; - if (re->nhe->id >= zclient_get_nhg_lower_bound()) + if (re->nhe->id >= ZEBRA_NHG_PROTO_LOWER) return proto_nhg_nexthop_active_update(&re->nhe->nhg); afi_t rt_afi = family2afi(rn->p.family); @@ -2525,7 +2525,7 @@ void zebra_nhg_install_kernel(struct nhg_hash_entry *nhe) if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_VALID) && (!CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED) - || nhe->id >= zclient_get_nhg_lower_bound()) + || nhe->id >= ZEBRA_NHG_PROTO_LOWER) && !CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_QUEUED)) { /* Change its type to us since we are installing it */ if (!ZEBRA_NHG_CREATED(nhe)) |
