Skip to content

Commit

Permalink
bgpd: Add pi to bgp_process
Browse files Browse the repository at this point in the history
This will allow a consistency of approach to adding/removing
pi's to from the workqueue for processing as well as properly
handling the dest->info pi list more appropriately.

Signed-off-by: Donald Sharp <[email protected]>
  • Loading branch information
donaldsharp committed Mar 18, 2024
1 parent 8caadb0 commit 56bcfab
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 82 deletions.
4 changes: 2 additions & 2 deletions bgpd/bgp_damp.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static void bgp_reuse_timer(struct event *t)
bgp_aggregate_increment(
bgp, bgp_dest_get_prefix(bdi->dest),
bdi->path, bdi->afi, bdi->safi);
bgp_process(bgp, bdi->dest, bdi->afi,
bgp_process(bgp, bdi->dest, bdi->path, bdi->afi,
bdi->safi);
}

Expand Down Expand Up @@ -308,7 +308,7 @@ void bgp_damp_info_free(struct bgp_damp_info *bdi, int withdraw, afi_t afi,

if (bdi->lastrecord == BGP_RECORD_WITHDRAW && withdraw) {
bgp_path_info_delete(bdi->dest, path);
bgp_process(path->peer->bgp, bdi->dest, afi, safi);
bgp_process(path->peer->bgp, bdi->dest, path, afi, safi);
}

XFREE(MTYPE_BGP_DAMP_INFO, bdi);
Expand Down
24 changes: 12 additions & 12 deletions bgpd/bgp_evpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,7 @@ static void evpn_delete_old_local_route(struct bgp *bgp, struct bgpevpn *vpn,
* this table.
*/
if (pi)
bgp_process(bgp, global_dest, afi, safi);
bgp_process(bgp, global_dest, pi, afi, safi);
bgp_dest_unlock_node(global_dest);
}

Expand Down Expand Up @@ -1725,7 +1725,7 @@ static int update_evpn_type5_route(struct bgp *bgp_vrf, struct prefix_evpn *evp,

/* schedule for processing and unlock node */
if (route_changed) {
bgp_process(bgp_evpn, dest, afi, safi);
bgp_process(bgp_evpn, dest, pi, afi, safi);
bgp_dest_unlock_node(dest);
}

Expand Down Expand Up @@ -2273,7 +2273,7 @@ static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn,
false /* setup_sync */, NULL /* old_is_sync */);

/* Schedule for processing and unlock node. */
bgp_process(bgp, dest, afi, safi);
bgp_process(bgp, dest, global_pi, afi, safi);
bgp_dest_unlock_node(dest);
}

Expand Down Expand Up @@ -2333,7 +2333,7 @@ static int delete_evpn_type5_route(struct bgp *bgp_vrf, struct prefix_evpn *evp)

delete_evpn_route_entry(bgp_evpn, afi, safi, dest, &pi);
if (pi)
bgp_process(bgp_evpn, dest, afi, safi);
bgp_process(bgp_evpn, dest, pi, afi, safi);
bgp_dest_unlock_node(dest);
return 0;
}
Expand Down Expand Up @@ -2373,7 +2373,7 @@ static int delete_evpn_route(struct bgp *bgp, struct bgpevpn *vpn,
* this table.
*/
if (pi)
bgp_process(bgp, global_dest, afi, safi);
bgp_process(bgp, global_dest, pi, afi, safi);
bgp_dest_unlock_node(global_dest);
}

Expand Down Expand Up @@ -2536,7 +2536,7 @@ void bgp_evpn_update_type2_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
NULL /* old_is_sync */);

/* Schedule for processing and unlock node. */
bgp_process(bgp, global_dest, afi, safi);
bgp_process(bgp, global_dest, global_pi, afi, safi);
bgp_dest_unlock_node(global_dest);
}

Expand Down Expand Up @@ -2621,7 +2621,7 @@ static void delete_global_type2_routes(struct bgp *bgp, struct bgpevpn *vpn)

delete_evpn_route_entry(bgp, afi, safi, dest, &pi);
if (pi)
bgp_process(bgp, dest, afi, safi);
bgp_process(bgp, dest, pi, afi, safi);
}

/* Unlock RD node. */
Expand Down Expand Up @@ -3075,7 +3075,7 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
safi);

/* Perform route selection and update zebra, if required. */
bgp_process(bgp_vrf, dest, afi, safi);
bgp_process(bgp_vrf, dest, pi, afi, safi);

/* Process for route leaking. */
vpn_leak_from_vrf_update(bgp_get_default(), bgp_vrf, pi);
Expand Down Expand Up @@ -3437,7 +3437,7 @@ static int uninstall_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
bgp_evpn_path_nh_del(bgp_vrf, pi);

/* Perform route selection and update zebra, if required. */
bgp_process(bgp_vrf, dest, afi, safi);
bgp_process(bgp_vrf, dest, pi, afi, safi);

/* Unlock route node. */
bgp_dest_unlock_node(dest);
Expand Down Expand Up @@ -4434,7 +4434,7 @@ static void update_advertise_vni_route(struct bgp *bgp, struct bgpevpn *vpn,
}

/* Schedule for processing and unlock node. */
bgp_process(bgp, global_dest, afi, safi);
bgp_process(bgp, global_dest, global_pi, afi, safi);
bgp_dest_unlock_node(global_dest);
}

Expand Down Expand Up @@ -4484,7 +4484,7 @@ static void update_advertise_vni_routes(struct bgp *bgp, struct bgpevpn *vpn)
false /* setup_sync */, NULL /* old_is_sync */);

/* Schedule for processing and unlock node. */
bgp_process(bgp, global_dest, afi, safi);
bgp_process(bgp, global_dest, pi, afi, safi);
bgp_dest_unlock_node(global_dest);
}

Expand Down Expand Up @@ -4529,7 +4529,7 @@ static int delete_withdraw_vni_routes(struct bgp *bgp, struct bgpevpn *vpn)
* this table.
*/
if (pi)
bgp_process(bgp, global_dest, afi, safi);
bgp_process(bgp, global_dest, pi, afi, safi);
bgp_dest_unlock_node(global_dest);
}

Expand Down
8 changes: 4 additions & 4 deletions bgpd/bgp_evpn_mh.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ static int bgp_evpn_mh_route_delete(struct bgp *bgp, struct bgp_evpn_es *es,
* this table.
*/
if (pi)
bgp_process(bgp, global_dest, afi, safi);
bgp_process(bgp, global_dest, pi, afi, safi);
bgp_dest_unlock_node(global_dest);
}

Expand Down Expand Up @@ -562,7 +562,7 @@ int delete_global_ead_evi_routes(struct bgp *bgp, struct bgpevpn *vpn)

delete_evpn_route_entry(bgp, afi, safi, bd, &pi);
if (pi)
bgp_process(bgp, bd, afi, safi);
bgp_process(bgp, bd, pi, afi, safi);
}
}

Expand Down Expand Up @@ -686,7 +686,7 @@ static int bgp_evpn_type4_route_update(struct bgp *bgp,
attr_new, &global_pi, &route_changed);

/* Schedule for processing and unlock node. */
bgp_process(bgp, dest, afi, safi);
bgp_process(bgp, dest, global_pi, afi, safi);
bgp_dest_unlock_node(dest);
}

Expand Down Expand Up @@ -1025,7 +1025,7 @@ static int bgp_evpn_type1_route_update(struct bgp *bgp, struct bgp_evpn_es *es,
attr_new, &global_pi, &route_changed);

/* Schedule for processing and unlock node. */
bgp_process(bgp, dest, afi, safi);
bgp_process(bgp, dest, global_pi, afi, safi);
bgp_dest_unlock_node(dest);
}

Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_label.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int bgp_parse_fec_update(void)
bgp_set_valid_label(&dest->local_label);
}
SET_FLAG(dest->flags, BGP_NODE_LABEL_CHANGED);
bgp_process(bgp, dest, afi, safi);
bgp_process(bgp, dest, NULL, afi, safi);
bgp_dest_unlock_node(dest);
return 1;
}
Expand Down
14 changes: 7 additions & 7 deletions bgpd/bgp_mplsvpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,7 @@ leak_update(struct bgp *to_bgp, struct bgp_dest *bn,

/* Process change. */
bgp_aggregate_increment(to_bgp, p, bpi, afi, safi);
bgp_process(to_bgp, bn, afi, safi);
bgp_process(to_bgp, bn, bpi, afi, safi);

if (debug)
zlog_debug("%s: ->%s: %pBD Found route, changed attr",
Expand Down Expand Up @@ -1263,7 +1263,7 @@ leak_update(struct bgp *to_bgp, struct bgp_dest *bn,
bgp_aggregate_increment(to_bgp, p, new, afi, safi);
bgp_path_info_add(bn, new);

bgp_process(to_bgp, bn, afi, safi);
bgp_process(to_bgp, bn, new, afi, safi);

if (debug)
zlog_debug("%s: ->%s: %pBD: Added new route", __func__,
Expand Down Expand Up @@ -1949,7 +1949,7 @@ void vpn_leak_from_vrf_withdraw(struct bgp *to_bgp, /* to */

bgp_aggregate_decrement(to_bgp, p, bpi, afi, safi);
bgp_path_info_delete(bn, bpi);
bgp_process(to_bgp, bn, afi, safi);
bgp_process(to_bgp, bn, bpi, afi, safi);
}
bgp_dest_unlock_node(bn);
}
Expand Down Expand Up @@ -2005,7 +2005,7 @@ void vpn_leak_from_vrf_withdraw_all(struct bgp *to_bgp, struct bgp *from_bgp,
to_bgp, bgp_dest_get_prefix(bn),
bpi, afi, safi);
bgp_path_info_delete(bn, bpi);
bgp_process(to_bgp, bn, afi, safi);
bgp_process(to_bgp, bn, bpi, afi, safi);
bgp_mplsvpn_path_nh_label_unlink(
bpi->extra->vrfleak->parent);
}
Expand Down Expand Up @@ -2499,7 +2499,7 @@ void vpn_leak_to_vrf_withdraw(struct bgp_path_info *path_vpn)
bpi);
bgp_aggregate_decrement(bgp, p, bpi, afi, safi);
bgp_path_info_delete(bn, bpi);
bgp_process(bgp, bn, afi, safi);
bgp_process(bgp, bn, bpi, afi, safi);
}
bgp_dest_unlock_node(bn);
}
Expand Down Expand Up @@ -2531,7 +2531,7 @@ void vpn_leak_to_vrf_withdraw_all(struct bgp *to_bgp, afi_t afi)
bgp_dest_get_prefix(bn),
bpi, afi, safi);
bgp_path_info_delete(bn, bpi);
bgp_process(to_bgp, bn, afi, safi);
bgp_process(to_bgp, bn, bpi, afi, safi);
}
}
}
Expand Down Expand Up @@ -4182,7 +4182,7 @@ static int bgp_mplsvpn_nh_label_bind_get_local_label_cb(mpls_label_t label,
if (!table)
continue;
SET_FLAG(pi->net->flags, BGP_NODE_LABEL_CHANGED);
bgp_process(table->bgp, pi->net, table->afi, table->safi);
bgp_process(table->bgp, pi->net, pi, table->afi, table->safi);
}

return 0;
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_nht.c
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ void evaluate_paths(struct bgp_nexthop_cache *bnc)
}
}

bgp_process(bgp_path, dest, afi, safi);
bgp_process(bgp_path, dest, path, afi, safi);
}

if (peer) {
Expand Down
Loading

0 comments on commit 56bcfab

Please sign in to comment.