]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Make ucmp scale value owned by zrouter
authorDonald Sharp <sharpd@nvidia.com>
Thu, 28 Sep 2023 16:44:31 +0000 (12:44 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Thu, 12 Oct 2023 17:35:38 +0000 (13:35 -0400)
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 <sharpd@nvidia.com>
zebra/zapi_msg.c
zebra/zebra_router.c
zebra/zebra_router.h

index 2aeb1b97e9254804030b5326a9a710cce5742186..92a81f6828735068208bdc3c29d8559bf7699eae 100644 (file)
@@ -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)));
                }
        }
index 4caaf8a9e27fbf435c2a823595aa36e9aad75210..52997160918b17b3517849e275aad58dd2f50062 100644 (file)
@@ -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
index bd86cfb495191b5a09c530837e587c04a2adf409..b700851df580296bc193fc611c98c828c0bb807e 100644 (file)
@@ -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