Merge pull request #15563 from donaldsharp/bgp_musings

Bgp musings
This commit is contained in:
Russ White 2024-10-30 06:04:45 -04:00 committed by GitHub
commit 56d994aeca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 17 deletions

View File

@ -697,14 +697,9 @@ static uint32_t srv6_l3vpn_hash_key_make(const void *p)
uint32_t key = 0;
key = jhash(&l3vpn->sid, 16, key);
key = jhash_1word(l3vpn->sid_flags, key);
key = jhash_1word(l3vpn->endpoint_behavior, key);
key = jhash_1word(l3vpn->loc_block_len, key);
key = jhash_1word(l3vpn->loc_node_len, key);
key = jhash_1word(l3vpn->func_len, key);
key = jhash_1word(l3vpn->arg_len, key);
key = jhash_1word(l3vpn->transposition_len, key);
key = jhash_1word(l3vpn->transposition_offset, key);
key = jhash_3words(l3vpn->sid_flags, l3vpn->endpoint_behavior, l3vpn->loc_block_len, key);
key = jhash_3words(l3vpn->loc_node_len, l3vpn->func_len, l3vpn->arg_len, key);
key = jhash_2words(l3vpn->transposition_len, l3vpn->transposition_offset, key);
return key;
}
@ -863,15 +858,11 @@ unsigned int attrhash_key_make(const void *p)
if (vnc_subtlvs)
MIX(encap_hash_key_make(vnc_subtlvs));
#endif
MIX(attr->mp_nexthop_len);
MIX3(attr->mp_nexthop_len, attr->rmap_table_id, attr->nh_type);
key = jhash(attr->mp_nexthop_global.s6_addr, IPV6_MAX_BYTELEN, key);
key = jhash(attr->mp_nexthop_local.s6_addr, IPV6_MAX_BYTELEN, key);
MIX3(attr->nh_ifindex, attr->nh_lla_ifindex, attr->distance);
MIX(attr->rmap_table_id);
MIX(attr->nh_type);
MIX(attr->bh_type);
MIX(attr->otc);
MIX(bgp_attr_get_aigp_metric(attr));
MIX3(attr->bh_type, attr->otc, bgp_attr_get_aigp_metric(attr));
return key;
}
@ -976,8 +967,11 @@ static void attr_show_all_iterator(struct hash_bucket *bucket, struct vty *vty)
"\n",
attr->flag, attr->distance, attr->med, attr->local_pref,
attr->origin, attr->weight, attr->label, sid, attr->aigp_metric);
vty_out(vty, "\taspath: %s Community: %s Large Community: %s\n",
aspath_print(attr->aspath),
vty_out(vty,
"\tnh_ifindex: %u nh_flags: %u distance: %u nexthop_global: %pI6 nexthop_local: %pI6 nexthop_local_ifindex: %u\n",
attr->nh_ifindex, attr->nh_flags, attr->distance, &attr->mp_nexthop_global,
&attr->mp_nexthop_local, attr->nh_lla_ifindex);
vty_out(vty, "\taspath: %s Community: %s Large Community: %s\n", aspath_print(attr->aspath),
community_str(attr->community, false, false),
lcommunity_str(attr->lcommunity, false, false));
vty_out(vty, "\tExtended Community: %s Extended IPv6 Community: %s\n",

View File

@ -745,6 +745,8 @@ int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
struct bgp_path_info *bpi_ultimate;
struct peer *peer_new, *peer_exist;
bgp->bestpath_runs++;
*paths_eq = 0;
/* 0. Null check. */
@ -4119,8 +4121,10 @@ static void bgp_process_internal(struct bgp *bgp, struct bgp_dest *dest,
}
/* already scheduled for processing? */
if (CHECK_FLAG(dest->flags, BGP_NODE_PROCESS_SCHEDULED))
if (CHECK_FLAG(dest->flags, BGP_NODE_PROCESS_SCHEDULED)) {
bgp->node_already_on_queue++;
return;
}
/* If the flag BGP_NODE_SELECT_DEFER is set, do not add route to
* the workqueue
@ -4129,6 +4133,7 @@ static void bgp_process_internal(struct bgp *bgp, struct bgp_dest *dest,
if (BGP_DEBUG(update, UPDATE_OUT))
zlog_debug("BGP_NODE_SELECT_DEFER set for route %p",
dest);
bgp->node_deferred_on_queue++;
return;
}
@ -13095,6 +13100,9 @@ DEFUN(show_ip_bgp_afi_safi_statistics, show_ip_bgp_afi_safi_statistics_cmd,
json = json_object_new_object();
json_object_object_add(json, get_afi_safi_str(afi, safi, true),
json_afi_safi);
json_object_int_add(json, "bgpBestPathCalls", bgp->bestpath_runs);
json_object_int_add(json, "bgpNodeOnQueue", bgp->node_already_on_queue);
json_object_int_add(json, "bgpNodeDeferredOnQueue", bgp->node_deferred_on_queue);
vty_json(vty, json);
}
return ret;

View File

@ -864,6 +864,10 @@ struct bgp {
/* BGP route flap dampening configuration */
struct bgp_damp_config damp[AFI_MAX][SAFI_MAX];
uint64_t bestpath_runs;
uint64_t node_already_on_queue;
uint64_t node_deferred_on_queue;
QOBJ_FIELDS;
};
DECLARE_QOBJ_TYPE(bgp);