]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Just pass down the Bandwidth unmodified so that Zebra can use it
authorDonald Sharp <sharpd@nvidia.com>
Fri, 29 Sep 2023 19:17:14 +0000 (15:17 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Thu, 12 Oct 2023 17:35:39 +0000 (13:35 -0400)
Instead of scaling the bandwith to something between 1 and 100, just
send down the bandwidth Available for the link.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/bgp_zebra.c

index 5b69de08c2e98df9370dfddb888a8ba33c71e436..50835ff86c37b7e9160e4d1db1bc88ef85aaa516 100644 (file)
@@ -1209,24 +1209,18 @@ static bool update_ipv6nh_for_route_install(int nh_othervrf, struct bgp *nh_bgp,
 static bool bgp_zebra_use_nhop_weighted(struct bgp *bgp, struct attr *attr,
                                        uint64_t tot_bw, uint32_t *nh_weight)
 {
-       uint32_t bw;
-       uint64_t tmp;
-
-       bw = attr->link_bw;
        /* zero link-bandwidth and link-bandwidth not present are treated
         * as the same situation.
         */
-       if (!bw) {
+       if (!attr->link_bw) {
                /* the only situations should be if we're either told
                 * to skip or use default weight.
                 */
                if (bgp->lb_handling == BGP_LINK_BW_SKIP_MISSING)
                        return false;
                *nh_weight = BGP_ZEBRA_DEFAULT_NHOP_WEIGHT;
-       } else {
-               tmp = (uint64_t)bw * 100;
-               *nh_weight = ((uint32_t)(tmp / tot_bw));
-       }
+       } else
+               *nh_weight = attr->link_bw;
 
        return true;
 }