Skip to content

Commit

Permalink
zebra: Make ucmp scale value owned by zrouter
Browse files Browse the repository at this point in the history
The weight scale value might be useful to have it
change it's behavior at a later time or controlled
by something depending on how FRR is compiled/ran.
Let's start that process

Signed-off-by: Donald Sharp <[email protected]>
  • Loading branch information
donaldsharp committed Oct 12, 2023
1 parent 35718a2 commit 2d6a012
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion zebra/zapi_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1730,7 +1730,8 @@ static bool zapi_read_nexthops(struct zserv *client, struct prefix *p,
for (i = 0; i < nexthop_num; i++) {
znh = &nhops[i];

tmp = (uint64_t)znh->weight * 255;
tmp = (uint64_t)znh->weight *
zrouter.nexthop_weight_scale_value;
znh->weight = MAX(1, ((uint32_t)(tmp / max_weight)));
}
}
Expand Down
2 changes: 2 additions & 0 deletions zebra/zebra_router.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ void zebra_router_init(bool asic_offload, bool notify_on_ack,
#endif
zrouter.asic_notification_nexthop_control = false;

zrouter.nexthop_weight_scale_value = 255;

#ifdef HAVE_SCRIPTING
zebra_script_init();
#endif
Expand Down
2 changes: 2 additions & 0 deletions zebra/zebra_router.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ struct zebra_router {
bool allow_delete;

uint8_t protodown_r_bit;

uint64_t nexthop_weight_scale_value;
};

#define GRACEFUL_RESTART_TIME 60
Expand Down

0 comments on commit 2d6a012

Please sign in to comment.