Skip to content

Commit 9edf45b

Browse files
committed
bgpd: Increase install/uninstall speed of evpn vpn vni's
BGP receives notification from zebra about an vpn that needs to be installed into the evpn tables. Unfortunately this function was walking the entirety of evpn tables 3 times. Modify the code to walk the tree 1 time and to just look for the needed route types as you go. This reduces, in a scaled environment, processing time of the zclient_read function from 130 seconds to 95 seconds. For a up / down / up interface scenario. Signed-off-by: Rajasekar Raja <rajasekarr@vndia.com> Signed-off-by: Donald Sharp <sharpd@nvidia.com>
1 parent 5139ce8 commit 9edf45b

File tree

1 file changed

+21
-47
lines changed

1 file changed

+21
-47
lines changed

bgpd/bgp_evpn.c

Lines changed: 21 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3926,9 +3926,7 @@ static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf, int install)
39263926
* particular VNI.
39273927
*/
39283928
static int install_uninstall_routes_for_vni(struct bgp *bgp,
3929-
struct bgpevpn *vpn,
3930-
bgp_evpn_route_type rtype,
3931-
int install)
3929+
struct bgpevpn *vpn, int install)
39323930
{
39333931
afi_t afi;
39343932
safi_t safi;
@@ -3959,7 +3957,9 @@ static int install_uninstall_routes_for_vni(struct bgp *bgp,
39593957
(const struct prefix_evpn *)bgp_dest_get_prefix(
39603958
dest);
39613959

3962-
if (evp->prefix.route_type != rtype)
3960+
if (evp->prefix.route_type != BGP_EVPN_IMET_ROUTE &&
3961+
evp->prefix.route_type != BGP_EVPN_AD_ROUTE &&
3962+
evp->prefix.route_type != BGP_EVPN_MAC_IP_ROUTE)
39633963
continue;
39643964

39653965
for (pi = bgp_dest_get_bgp_path_info(dest); pi;
@@ -3986,16 +3986,16 @@ static int install_uninstall_routes_for_vni(struct bgp *bgp,
39863986
bgp, vpn, evp, pi);
39873987

39883988
if (ret) {
3989-
flog_err(
3990-
EC_BGP_EVPN_FAIL,
3991-
"%u: Failed to %s EVPN %s route in VNI %u",
3992-
bgp->vrf_id,
3993-
install ? "install"
3994-
: "uninstall",
3995-
rtype == BGP_EVPN_MAC_IP_ROUTE
3996-
? "MACIP"
3997-
: "IMET",
3998-
vpn->vni);
3989+
flog_err(EC_BGP_EVPN_FAIL,
3990+
"%u: Failed to %s EVPN %s route in VNI %u",
3991+
bgp->vrf_id,
3992+
install ? "install"
3993+
: "uninstall",
3994+
evp->prefix.route_type ==
3995+
BGP_EVPN_MAC_IP_ROUTE
3996+
? "MACIP"
3997+
: "IMET",
3998+
vpn->vni);
39993999

40004000
bgp_dest_unlock_node(rd_dest);
40014001
bgp_dest_unlock_node(dest);
@@ -4024,23 +4024,11 @@ static int install_routes_for_vrf(struct bgp *bgp_vrf)
40244024
*/
40254025
static int install_routes_for_vni(struct bgp *bgp, struct bgpevpn *vpn)
40264026
{
4027-
int ret;
4028-
4029-
/* Install type-3 routes followed by type-2 routes - the ones applicable
4027+
/*
4028+
* Install type-3 routes followed by type-2 routes - the ones applicable
40304029
* for this VNI.
40314030
*/
4032-
ret = install_uninstall_routes_for_vni(bgp, vpn, BGP_EVPN_IMET_ROUTE,
4033-
1);
4034-
if (ret)
4035-
return ret;
4036-
4037-
ret = install_uninstall_routes_for_vni(bgp, vpn, BGP_EVPN_AD_ROUTE,
4038-
1);
4039-
if (ret)
4040-
return ret;
4041-
4042-
return install_uninstall_routes_for_vni(bgp, vpn, BGP_EVPN_MAC_IP_ROUTE,
4043-
1);
4031+
return install_uninstall_routes_for_vni(bgp, vpn, 1);
40444032
}
40454033

40464034
/* uninstall routes from l3vni vrf. */
@@ -4056,25 +4044,11 @@ static int uninstall_routes_for_vrf(struct bgp *bgp_vrf)
40564044
*/
40574045
static int uninstall_routes_for_vni(struct bgp *bgp, struct bgpevpn *vpn)
40584046
{
4059-
int ret;
4060-
4061-
/* Uninstall type-2 routes followed by type-3 routes - the ones
4062-
* applicable
4063-
* for this VNI.
4047+
/*
4048+
* Uninstall type-2 routes followed by type-3 routes - the ones
4049+
* applicable for this VNI.
40644050
*/
4065-
ret = install_uninstall_routes_for_vni(bgp, vpn, BGP_EVPN_MAC_IP_ROUTE,
4066-
0);
4067-
if (ret)
4068-
return ret;
4069-
4070-
ret = install_uninstall_routes_for_vni(bgp, vpn, BGP_EVPN_AD_ROUTE,
4071-
0);
4072-
if (ret)
4073-
return ret;
4074-
4075-
4076-
return install_uninstall_routes_for_vni(bgp, vpn, BGP_EVPN_IMET_ROUTE,
4077-
0);
4051+
return install_uninstall_routes_for_vni(bgp, vpn, 0);
40784052
}
40794053

40804054
/*

0 commit comments

Comments
 (0)