uint32_t rmap_table_id;
/* Link bandwidth value, if any. */
- uint32_t link_bw;
+ uint64_t link_bw;
/* EVPN ES */
esi_t esi;
* return the BGP link bandwidth extended community, if present;
* the actual bandwidth is returned via param
*/
-const uint8_t *ecommunity_linkbw_present(struct ecommunity *ecom, uint32_t *bw)
+const uint8_t *ecommunity_linkbw_present(struct ecommunity *ecom, uint64_t *bw)
{
const uint8_t *eval;
uint32_t i;
pnt = ptr_get_be32(pnt, &bwval);
(void)pnt; /* consume value */
if (bw)
- *bw = ecom->disable_ieee_floating
- ? bwval
- : ieee_float_uint32_to_uint32(
- bwval);
+ *bw = (uint64_t)(ecom->disable_ieee_floating
+ ? bwval
+ : ieee_float_uint32_to_uint32(
+ bwval));
return eval;
}
}
struct ecommunity_val lb_eval;
const uint8_t *eval;
uint8_t type;
- uint32_t cur_bw;
+ uint64_t cur_bw;
/* Nothing to replace if link-bandwidth doesn't exist or
* is non-transitive - just return existing extcommunity.
* Encode BGP Link Bandwidth extended community
* bandwidth (bw) is in bytes-per-sec
*/
-static inline void encode_lb_extcomm(as_t as, uint32_t bw, bool non_trans,
+static inline void encode_lb_extcomm(as_t as, uint64_t bw, bool non_trans,
struct ecommunity_val *eval,
bool disable_ieee_floating)
{
- uint32_t bandwidth =
- disable_ieee_floating ? bw : uint32_to_ieee_float_uint32(bw);
+ uint64_t bandwidth = disable_ieee_floating
+ ? bw
+ : uint32_to_ieee_float_uint32(bw);
memset(eval, 0, sizeof(*eval));
eval->val[0] = ECOMMUNITY_ENCODE_AS;
struct ecommunity *ecommunity);
extern void bgp_aggr_ecommunity_remove(void *arg);
extern const uint8_t *ecommunity_linkbw_present(struct ecommunity *ecom,
- uint32_t *bw);
+ uint64_t *bw);
extern struct ecommunity *ecommunity_replace_linkbw(as_t as,
struct ecommunity *ecom,
uint64_t cum_bw,
struct bgp_maxpaths_cfg *mpath_cfg)
{
uint16_t maxpaths, mpath_count, old_mpath_count;
- uint32_t bwval;
+ uint64_t bwval;
uint64_t cum_bw, old_cum_bw;
struct listnode *mp_node, *mp_next_node;
struct bgp_path_info *cur_mpath, *new_mpath, *next_mpath, *prev_mpath;
#define RMAP_ECOMM_LB_SET_CUMUL 2
#define RMAP_ECOMM_LB_SET_NUM_MPATH 3
bool non_trans;
- uint32_t bw;
+ uint64_t bw;
};
static enum route_map_cmd_result_t
struct peer *peer;
struct ecommunity ecom_lb = {0};
struct ecommunity_val lb_eval;
- uint32_t bw_bytes = 0;
+ uint64_t bw_bytes = 0;
uint16_t mpath_count = 0;
struct ecommunity *new_ecom;
struct ecommunity *old_ecom;
/* Build link bandwidth extended community */
as = (peer->bgp->as > BGP_AS_MAX) ? BGP_AS_TRANS : peer->bgp->as;
if (rels->lb_type == RMAP_ECOMM_LB_SET_VALUE) {
- bw_bytes = ((uint64_t)rels->bw * 1000 * 1000) / 8;
+ bw_bytes = (rels->bw * 1000 * 1000) / 8;
} else if (rels->lb_type == RMAP_ECOMM_LB_SET_CUMUL) {
/* process this only for the best path. */
if (!CHECK_FLAG(path->flags, BGP_PATH_SELECTED))
return RMAP_OKAY;
- bw_bytes = (uint32_t)bgp_path_info_mpath_cumbw(path);
+ bw_bytes = bgp_path_info_mpath_cumbw(path);
if (!bw_bytes)
return RMAP_OKAY;
if (!CHECK_FLAG(path->flags, BGP_PATH_SELECTED))
return RMAP_OKAY;
- bw_bytes = ((uint64_t)peer->bgp->lb_ref_bw * 1000 * 1000) / 8;
+ bw_bytes = (peer->bgp->lb_ref_bw * 1000 * 1000) / 8;
mpath_count = bgp_path_info_mpath_count(path) + 1;
bw_bytes *= mpath_count;
}
{
struct rmap_ecomm_lb_set *rels;
uint8_t lb_type;
- uint32_t bw = 0;
+ uint64_t bw = 0;
char bw_str[40] = {0};
char *p, *str;
bool non_trans = false;