diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-11-19 22:47:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-19 22:47:55 +0100 |
| commit | 91f482a8546ef4d1b686b70683b7ae17f676ad4f (patch) | |
| tree | e406020d6eb4837a518dea6f6cafd5629e523e10 | |
| parent | 22746b8d59e6e6cb77ced61bc9e0cff2ead227b5 (diff) | |
| parent | a7aae788ec09ca99994d05546f361fe05a363053 (diff) | |
Merge pull request #17437 from FRRouting/mergify/bp/stable/10.2/pr-17432
bgpd : backpressure - Fix to pop items off zebra_announce FIFO for few EVPN triggers (backport #17432)
| -rw-r--r-- | bgpd/bgp_evpn.c | 44 | ||||
| -rw-r--r-- | bgpd/bgp_evpn.h | 1 |
2 files changed, 32 insertions, 13 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 0a8ce61548..1348319001 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -5112,6 +5112,33 @@ static void evpn_mpattr_encode_type5(struct stream *s, const struct prefix *p, } /* + * In cases such as 'no advertise-all-vni' and L2 VNI DELETE, we need to + * pop all the VPN routes present in the bgp_zebra_announce FIFO yet to + * be processed regardless of VNI is configured or not. + * + * NOTE: NO need to pop the VPN routes in two cases + * 1) In free_vni_entry + * - Called by bgp_free()->bgp_evpn_cleanup(). + * - Since bgp_delete is called before bgp_free and we pop all the dest + * pertaining to bgp under delete. + * 2) evpn_delete_vni() when user configures "no vni" since the withdraw + * of all routes happen in normal cycle. + */ +void bgp_zebra_evpn_pop_items_from_announce_fifo(struct bgpevpn *vpn) +{ + struct bgp_dest *dest = NULL; + struct bgp_dest *dest_next = NULL; + + for (dest = zebra_announce_first(&bm->zebra_announce_head); dest; dest = dest_next) { + dest_next = zebra_announce_next(&bm->zebra_announce_head, dest); + if (dest->za_vpn == vpn) { + zebra_announce_del(&bm->zebra_announce_head, dest); + bgp_path_info_unlock(dest->za_bgp_pi); + bgp_dest_unlock_node(dest); + } + } +} +/* * Cleanup specific VNI upon EVPN (advertise-all-vni) being disabled. */ static void cleanup_vni_on_disable(struct hash_bucket *bucket, struct bgp *bgp) @@ -5123,6 +5150,8 @@ static void cleanup_vni_on_disable(struct hash_bucket *bucket, struct bgp *bgp) /* Clear "live" flag and see if hash needs to be freed. */ UNSET_FLAG(vpn->flags, VNI_FLAG_LIVE); + /* Pop items from bgp_zebra_announce FIFO for any VPN routes pending*/ + bgp_zebra_evpn_pop_items_from_announce_fifo(vpn); if (!is_vni_configured(vpn)) bgp_evpn_free(bgp, vpn); } @@ -6354,19 +6383,6 @@ struct bgpevpn *bgp_evpn_new(struct bgp *bgp, vni_t vni, */ void bgp_evpn_free(struct bgp *bgp, struct bgpevpn *vpn) { - struct bgp_dest *dest = NULL; - struct bgp_dest *dest_next = NULL; - - for (dest = zebra_announce_first(&bm->zebra_announce_head); dest; - dest = dest_next) { - dest_next = zebra_announce_next(&bm->zebra_announce_head, dest); - if (dest->za_vpn == vpn) { - zebra_announce_del(&bm->zebra_announce_head, dest); - bgp_path_info_unlock(dest->za_bgp_pi); - bgp_dest_unlock_node(dest); - } - } - bgp_evpn_remote_ip_hash_destroy(vpn); bgp_evpn_vni_es_cleanup(vpn); bgpevpn_unlink_from_l3vni(vpn); @@ -7047,6 +7063,8 @@ int bgp_evpn_local_vni_del(struct bgp *bgp, vni_t vni) /* Clear "live" flag and see if hash needs to be freed. */ UNSET_FLAG(vpn->flags, VNI_FLAG_LIVE); + /* Pop items from bgp_zebra_announce FIFO for any VPN routes pending*/ + bgp_zebra_evpn_pop_items_from_announce_fifo(vpn); if (!is_vni_configured(vpn)) bgp_evpn_free(bgp, vpn); diff --git a/bgpd/bgp_evpn.h b/bgpd/bgp_evpn.h index 10eff1dcfb..1a333a5a09 100644 --- a/bgpd/bgp_evpn.h +++ b/bgpd/bgp_evpn.h @@ -199,4 +199,5 @@ bool bgp_evpn_skip_vrf_import_of_local_es(struct bgp *bgp_vrf, const struct pref struct bgp_path_info *pi, int install); int uninstall_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, const struct prefix_evpn *evp, struct bgp_path_info *parent_pi); +extern void bgp_zebra_evpn_pop_items_from_announce_fifo(struct bgpevpn *vpn); #endif /* _QUAGGA_BGP_EVPN_H */ |
