From 383e1a6ab8e0b4106f2f74002e38b4c46e8982e9 Mon Sep 17 00:00:00 2001 From: Rajasekar Raja Date: Tue, 26 Nov 2024 12:02:53 -0800 Subject: [PATCH] bgpd: Suppress redundant L3VNI delete processing Consider a master bridge interface (br_l3vni) having a slave vxlan99 mapped to vlans used by 3 L3VNIs. During ifdown br_l3vni interface, the function zebra_vxlan_process_l3vni_oper_down() where zebra sends ZAPI to bgp for a delete L3VNI is sent twice. 1) if_down -> zebra_vxlan_svi_down() 2) VXLAN is unlinked from the bridge i.e. vxlan99 zebra_if_dplane_ifp_handling() --> zebra_vxlan_if_update_vni() (since ZEBRA_VXLIF_MASTER_CHANGE flag is set) During ifup br_l3vni interface, the function zebra_vxlan_process_l3vni_oper_down() is invoked because of access-vlan change - process oper down, associate with new svi_if and then process oper up again The problem here is that the redundant ZAPI message of L3VNI delete results in BGP doing a inline Global table walk for remote route installation when the L3VNI is already removed/deleted. Bigger the scale, more wastage is the CPU utilization. Given the triggers for bridge flap is not a common scenario, idea is to simply return from BGP if the L3VNI is already set to 0 i.e. if the L3VNI is already deleted, do nothing and return. NOTE/TBD: An ideal fix is to make zebra not send the second L3VNI delete ZAPI message. However it is a much involved and a day-1 code to handle corner cases. Ticket :#3864372 Signed-off-by: Rajasekar Raja --- bgpd/bgp_evpn.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 5b6988bbc710..9e8d5985ed2a 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -7234,6 +7234,15 @@ int bgp_evpn_local_l3vni_del(vni_t l3vni, vrf_id_t vrf_id) return -1; } + if (!bgp_vrf->l3vni) { + if (BGP_DEBUG(zebra, ZEBRA)) + zlog_debug( + "Returning from %s since VNI %u is already deleted", + __func__, l3vni); + + return -1; + } + /* * Move all the l3vni_delete operation post the remote route * installation processing i.e. add the L3VNI DELETE item on the