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 Sep 28, 2023
1 parent cb5c1c9 commit 5dc4067
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions zebra/zapi_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1905,7 +1905,7 @@ static int zapi_nhg_decode(struct stream *s, int cmd, struct zapi_nhg *api_nhg)

znh = &((api_nhg->nexthops)[i]);

tmp = (uint64_t)znh->weight * 255;
tmp = (uint64_t)znh->weight * zrouter.weight_scale_value;
znh->weight = MAX(1, ((uint32_t)(tmp/max_weight)));
}
}
Expand Down Expand Up @@ -1944,7 +1944,7 @@ static int zapi_nhg_decode(struct stream *s, int cmd, struct zapi_nhg *api_nhg)

znh = &((api_nhg->backup_nexthops)[i]);

tmp = (uint64_t)znh->weight * 255;
tmp = (uint64_t)znh->weight * zrouter.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.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 weight_scale_value;
};

#define GRACEFUL_RESTART_TIME 60
Expand Down

0 comments on commit 5dc4067

Please sign in to comment.