mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-29 14:40:47 +00:00
bgpd: Break up rpki prefix revalidation by bgp structure
RPKI revalidation is an possibly expensive operation. Break up revalidation on a prefix basis by the `struct bgp` pointer. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
fc15f734aa
commit
7f1f931447
@ -387,6 +387,36 @@ static void pfx_record_to_prefix(struct pfx_record *record,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct rpki_revalidate_prefix {
|
||||||
|
struct bgp *bgp;
|
||||||
|
struct prefix prefix;
|
||||||
|
afi_t afi;
|
||||||
|
safi_t safi;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void rpki_revalidate_prefix(struct thread *thread)
|
||||||
|
{
|
||||||
|
struct rpki_revalidate_prefix *rrp = THREAD_ARG(thread);
|
||||||
|
struct bgp_dest *match, *node;
|
||||||
|
|
||||||
|
match = bgp_table_subtree_lookup(rrp->bgp->rib[rrp->afi][rrp->safi],
|
||||||
|
&rrp->prefix);
|
||||||
|
node = match;
|
||||||
|
|
||||||
|
while (node) {
|
||||||
|
if (bgp_dest_has_bgp_path_info_data(node)) {
|
||||||
|
revalidate_bgp_node(node, rrp->afi, rrp->safi);
|
||||||
|
}
|
||||||
|
|
||||||
|
node = bgp_route_next_until(node, match);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (match)
|
||||||
|
bgp_dest_unlock_node(match);
|
||||||
|
|
||||||
|
XFREE(MTYPE_BGP_RPKI_REVALIDATE, rrp);
|
||||||
|
}
|
||||||
|
|
||||||
static void bgpd_sync_callback(struct thread *thread)
|
static void bgpd_sync_callback(struct thread *thread)
|
||||||
{
|
{
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
@ -423,26 +453,18 @@ static void bgpd_sync_callback(struct thread *thread)
|
|||||||
|
|
||||||
for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) {
|
for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) {
|
||||||
struct bgp_table *table = bgp->rib[afi][safi];
|
struct bgp_table *table = bgp->rib[afi][safi];
|
||||||
|
struct rpki_revalidate_prefix *rrp;
|
||||||
|
|
||||||
if (!table)
|
if (!table)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
struct bgp_dest *match;
|
rrp = XCALLOC(MTYPE_BGP_RPKI_REVALIDATE, sizeof(*rrp));
|
||||||
struct bgp_dest *node;
|
rrp->bgp = bgp;
|
||||||
|
rrp->prefix = prefix;
|
||||||
match = bgp_table_subtree_lookup(table, &prefix);
|
rrp->afi = afi;
|
||||||
node = match;
|
rrp->safi = safi;
|
||||||
|
thread_add_event(bm->master, rpki_revalidate_prefix,
|
||||||
while (node) {
|
rrp, 0, &bgp->t_revalidate[afi][safi]);
|
||||||
if (bgp_dest_has_bgp_path_info_data(node)) {
|
|
||||||
revalidate_bgp_node(node, afi, safi);
|
|
||||||
}
|
|
||||||
|
|
||||||
node = bgp_route_next_until(node, match);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (match)
|
|
||||||
bgp_dest_unlock_node(match);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3645,6 +3645,9 @@ int bgp_delete(struct bgp *bgp)
|
|||||||
|
|
||||||
hook_call(bgp_inst_delete, bgp);
|
hook_call(bgp_inst_delete, bgp);
|
||||||
|
|
||||||
|
FOREACH_AFI_SAFI (afi, safi)
|
||||||
|
THREAD_OFF(bgp->t_revalidate[afi][safi]);
|
||||||
|
|
||||||
THREAD_OFF(bgp->t_condition_check);
|
THREAD_OFF(bgp->t_condition_check);
|
||||||
THREAD_OFF(bgp->t_startup);
|
THREAD_OFF(bgp->t_startup);
|
||||||
THREAD_OFF(bgp->t_maxmed_onstartup);
|
THREAD_OFF(bgp->t_maxmed_onstartup);
|
||||||
|
@ -470,6 +470,8 @@ struct bgp {
|
|||||||
/* BGP update delay on startup */
|
/* BGP update delay on startup */
|
||||||
struct thread *t_update_delay;
|
struct thread *t_update_delay;
|
||||||
struct thread *t_establish_wait;
|
struct thread *t_establish_wait;
|
||||||
|
struct thread *t_revalidate[AFI_MAX][SAFI_MAX];
|
||||||
|
|
||||||
uint8_t update_delay_over;
|
uint8_t update_delay_over;
|
||||||
uint8_t main_zebra_update_hold;
|
uint8_t main_zebra_update_hold;
|
||||||
uint8_t main_peers_update_hold;
|
uint8_t main_peers_update_hold;
|
||||||
|
Loading…
Reference in New Issue
Block a user