@@ -23,6 +23,10 @@ extern NhgOrch *gNhgOrch;
23
23
24
24
extern size_t gMaxBulkSize ;
25
25
26
+ /* Default maximum number of next hop groups */
27
+ #define DEFAULT_NUMBER_OF_ECMP_GROUPS 128
28
+ #define DEFAULT_MAX_ECMP_GROUP_SIZE 32
29
+
26
30
RouteOrch::RouteOrch (DBConnector *db, vector<table_name_with_pri_t > &tableNames, SwitchOrch *switchOrch, NeighOrch *neighOrch, IntfsOrch *intfsOrch, VRFOrch *vrfOrch, FgNhgOrch *fgNhgOrch) :
27
31
gRouteBulker(sai_route_api, gMaxBulkSize ),
28
32
gLabelRouteBulker(sai_mpls_api, gMaxBulkSize ),
@@ -1675,7 +1679,7 @@ bool RouteOrch::addRoute(RouteBulkContext& ctx, const NextHopGroupKey &nextHops)
1675
1679
/* Failed to create the next hop group and check if a temporary route is needed */
1676
1680
1677
1681
/* If the current next hop is part of the next hop group to sync,
1678
- * then return false and no need to add another temporary route. */
1682
+ * then return false and no need to add another temporary route. */
1679
1683
if (it_route != m_syncdRoutes.at (vrf_id).end () && it_route->second .nhg_key .getSize () == 1 )
1680
1684
{
1681
1685
const NextHopKey& nexthop = *it_route->second .nhg_key .getNextHops ().begin ();
@@ -1686,8 +1690,8 @@ bool RouteOrch::addRoute(RouteBulkContext& ctx, const NextHopGroupKey &nextHops)
1686
1690
}
1687
1691
1688
1692
/* Add a temporary route when a next hop group cannot be added,
1689
- * and there is no temporary route right now or the current temporary
1690
- * route is not pointing to a member of the next hop group to sync. */
1693
+ * and there is no temporary route right now or the current temporary
1694
+ * route is not pointing to a member of the next hop group to sync. */
1691
1695
addTempRoute (ctx, nextHops);
1692
1696
/* Return false since the original route is not successfully added */
1693
1697
return false ;
@@ -1842,8 +1846,6 @@ bool RouteOrch::addRoutePost(const RouteBulkContext& ctx, const NextHopGroupKey
1842
1846
{
1843
1847
if (!hasNextHopGroup (nextHops))
1844
1848
{
1845
- SWSS_LOG_DEBUG (" Next hop group is temporary, represented by %s" ,
1846
- ctx.tmp_next_hop .to_string ().c_str ());
1847
1849
// Previous added an temporary route
1848
1850
auto & tmp_next_hop = ctx.tmp_next_hop ;
1849
1851
addRoutePost (ctx, tmp_next_hop);
@@ -2190,8 +2192,13 @@ bool RouteOrch::removeRoutePost(const RouteBulkContext& ctx)
2190
2192
/* Delete Fine Grained nhg if the revmoved route pointed to it */
2191
2193
m_fgNhgOrch->removeFgNhg (vrf_id, ipPrefix);
2192
2194
}
2193
- /* Check that the next hop group is not owned by NhgOrch. */
2194
- else if (it_route->second .nhg_index .empty ())
2195
+ /* Check if the next hop group is not owned by NhgOrch. */
2196
+ else if (!it_route->second .nhg_index .empty ())
2197
+ {
2198
+ gNhgOrch ->decNhgRefCount (it_route->second .nhg_index );
2199
+ }
2200
+ /* The NHG is owned by RouteOrch */
2201
+ else
2195
2202
{
2196
2203
auto ol_nextHops = it_route->second .nhg_key ;
2197
2204
@@ -2224,11 +2231,6 @@ bool RouteOrch::removeRoutePost(const RouteBulkContext& ctx)
2224
2231
}
2225
2232
}
2226
2233
}
2227
- /* The NHG is owned by NhgOrch */
2228
- else
2229
- {
2230
- gNhgOrch ->decNhgRefCount (it_route->second .nhg_index );
2231
- }
2232
2234
2233
2235
SWSS_LOG_INFO (" Remove route %s with next hop(s) %s" ,
2234
2236
ipPrefix.to_string ().c_str (), it_route->second .nhg_key .to_string ().c_str ());
0 commit comments