Skip to content

Commit 77da6fa

Browse files
committed
Minor fixes
1 parent 56878db commit 77da6fa

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

orchagent/nhgorch.h

-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
#include "orch.h"
44
#include "nexthopgroupkey.h"
55

6-
/* Default maximum number of next hop groups */
7-
#define DEFAULT_NUMBER_OF_ECMP_GROUPS 128
8-
#define DEFAULT_MAX_ECMP_GROUP_SIZE 32
9-
106
class NextHopGroupMember
117
{
128
public:

orchagent/routeorch.cpp

+14-12
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ extern NhgOrch *gNhgOrch;
2323

2424
extern size_t gMaxBulkSize;
2525

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+
2630
RouteOrch::RouteOrch(DBConnector *db, vector<table_name_with_pri_t> &tableNames, SwitchOrch *switchOrch, NeighOrch *neighOrch, IntfsOrch *intfsOrch, VRFOrch *vrfOrch, FgNhgOrch *fgNhgOrch) :
2731
gRouteBulker(sai_route_api, gMaxBulkSize),
2832
gLabelRouteBulker(sai_mpls_api, gMaxBulkSize),
@@ -1675,7 +1679,7 @@ bool RouteOrch::addRoute(RouteBulkContext& ctx, const NextHopGroupKey &nextHops)
16751679
/* Failed to create the next hop group and check if a temporary route is needed */
16761680

16771681
/* 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. */
16791683
if (it_route != m_syncdRoutes.at(vrf_id).end() && it_route->second.nhg_key.getSize() == 1)
16801684
{
16811685
const NextHopKey& nexthop = *it_route->second.nhg_key.getNextHops().begin();
@@ -1686,8 +1690,8 @@ bool RouteOrch::addRoute(RouteBulkContext& ctx, const NextHopGroupKey &nextHops)
16861690
}
16871691

16881692
/* 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. */
16911695
addTempRoute(ctx, nextHops);
16921696
/* Return false since the original route is not successfully added */
16931697
return false;
@@ -1842,8 +1846,6 @@ bool RouteOrch::addRoutePost(const RouteBulkContext& ctx, const NextHopGroupKey
18421846
{
18431847
if (!hasNextHopGroup(nextHops))
18441848
{
1845-
SWSS_LOG_DEBUG("Next hop group is temporary, represented by %s",
1846-
ctx.tmp_next_hop.to_string().c_str());
18471849
// Previous added an temporary route
18481850
auto& tmp_next_hop = ctx.tmp_next_hop;
18491851
addRoutePost(ctx, tmp_next_hop);
@@ -2190,8 +2192,13 @@ bool RouteOrch::removeRoutePost(const RouteBulkContext& ctx)
21902192
/* Delete Fine Grained nhg if the revmoved route pointed to it */
21912193
m_fgNhgOrch->removeFgNhg(vrf_id, ipPrefix);
21922194
}
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
21952202
{
21962203
auto ol_nextHops = it_route->second.nhg_key;
21972204

@@ -2224,11 +2231,6 @@ bool RouteOrch::removeRoutePost(const RouteBulkContext& ctx)
22242231
}
22252232
}
22262233
}
2227-
/* The NHG is owned by NhgOrch */
2228-
else
2229-
{
2230-
gNhgOrch->decNhgRefCount(it_route->second.nhg_index);
2231-
}
22322234

22332235
SWSS_LOG_INFO("Remove route %s with next hop(s) %s",
22342236
ipPrefix.to_string().c_str(), it_route->second.nhg_key.to_string().c_str());

tests/test_nhg.py

-1
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,6 @@ def asic_route_nhg_fvs(k):
612612
route_count = 0
613613
self.r = 0
614614
while route_count < self.MAX_ECMP_COUNT:
615-
binary = self.gen_valid_binary()
616615
route_ipprefix = gen_ipprefix(route_count)
617616
self.rt_ps._del(route_ipprefix)
618617
route_count += 1

0 commit comments

Comments
 (0)