Skip to content

Commit

Permalink
Save code change
Browse files Browse the repository at this point in the history
  • Loading branch information
liuh-80 committed Sep 10, 2024
1 parent b0413d1 commit d3c6cc8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 49 deletions.
2 changes: 0 additions & 2 deletions orchagent/orch.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ class Executor : public swss::Selectable
// Name for Executor
std::string m_name;

// Get the underlying selectable
friend class RouteOrch;
swss::Selectable *getSelectable() const { return m_selectable; }
};

Expand Down
2 changes: 1 addition & 1 deletion orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ bool OrchDaemon::init()
{ APP_ROUTE_TABLE_NAME, routeorch_pri },
{ APP_LABEL_ROUTE_TABLE_NAME, routeorch_pri }
};
gRouteOrch = new RouteOrch(m_applDb, route_tables, gSwitchOrch, gNeighOrch, gIntfsOrch, vrf_orch, gFgNhgOrch, gSrv6Orch, m_select);
gRouteOrch = new RouteOrch(m_applDb, route_tables, gSwitchOrch, gNeighOrch, gIntfsOrch, vrf_orch, gFgNhgOrch, gSrv6Orch);
gNhgOrch = new NhgOrch(m_applDb, APP_NEXTHOP_GROUP_TABLE_NAME);
gCbfNhgOrch = new CbfNhgOrch(m_applDb, APP_CLASS_BASED_NEXT_HOP_GROUP_TABLE_NAME);

Expand Down
51 changes: 8 additions & 43 deletions orchagent/routeorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extern size_t gMaxBulkSize;
#define DEFAULT_NUMBER_OF_ECMP_GROUPS 128
#define DEFAULT_MAX_ECMP_GROUP_SIZE 32

RouteOrch::RouteOrch(DBConnector *db, vector<table_name_with_pri_t> &tableNames, SwitchOrch *switchOrch, NeighOrch *neighOrch, IntfsOrch *intfsOrch, VRFOrch *vrfOrch, FgNhgOrch *fgNhgOrch, Srv6Orch *srv6Orch, Select *select) :
RouteOrch::RouteOrch(DBConnector *db, vector<table_name_with_pri_t> &tableNames, SwitchOrch *switchOrch, NeighOrch *neighOrch, IntfsOrch *intfsOrch, VRFOrch *vrfOrch, FgNhgOrch *fgNhgOrch, Srv6Orch *srv6Orch) :
gRouteBulker(sai_route_api, gMaxBulkSize),
gLabelRouteBulker(sai_mpls_api, gMaxBulkSize),
gNextHopGroupMemberBulker(sai_next_hop_group_api, gSwitchId, gMaxBulkSize),
Expand All @@ -47,8 +47,7 @@ RouteOrch::RouteOrch(DBConnector *db, vector<table_name_with_pri_t> &tableNames,
m_nextHopGroupCount(0),
m_srv6Orch(srv6Orch),
m_resync(false),
m_appTunnelDecapTermProducer(db, APP_TUNNEL_DECAP_TERM_TABLE_NAME),
m_select(select)
m_appTunnelDecapTermProducer(db, APP_TUNNEL_DECAP_TERM_TABLE_NAME)
{
SWSS_LOG_ENTER();

Expand Down Expand Up @@ -188,40 +187,6 @@ std::string RouteOrch::getLinkLocalEui64Addr(void)
return ip_prefix;
}

bool RouteOrch::checkHighPriorityNotification(int pri)
{
if (m_select == nullptr)
{
SWSS_LOG_ERROR("[HUA] checkHighPriorityNotification nullptr\n");
return false;
}

static long count = 0;
count++;
if (count <= 128)
{
// check every 128 entries
return false;
}

count = 0;
Selectable *s;
int ret;
ret = m_select->select(&s, 0);
if (ret == Select::ERROR)
{
return false;
}

if (ret == Select::TIMEOUT)
{
return false;
}

SWSS_LOG_ERROR("[HUA] checkHighPriorityNotification pri %d, current pri: %d\n", (int)(s->getPri()), (int)(pri));
return s->getPri() > pri;
}

void RouteOrch::addLinkLocalRouteToMe(sai_object_id_t vrf_id, IpPrefix linklocal_prefix)
{
sai_route_entry_t unicast_route_entry;
Expand Down Expand Up @@ -519,9 +484,9 @@ void RouteOrch::doTask(Consumer& consumer)

/* Default handling is for APP_ROUTE_TABLE_NAME */
auto it = consumer.m_toSync.begin();
bool hasHighPriNotification = false;
int currentPri = consumer.getSelectable()->getPri();
while (!hasHighPriNotification && it != consumer.m_toSync.end())
bool exitLoop = false;
long exitentryCount = 0;
while (!exitLoop && it != consumer.m_toSync.end())
{
// Route bulk results will be stored in a map
std::map<
Expand All @@ -535,10 +500,10 @@ void RouteOrch::doTask(Consumer& consumer)
// Add or remove routes with a route bulker
while (it != consumer.m_toSync.end())
{
hasHighPriNotification = checkHighPriorityNotification(currentPri);
if (hasHighPriNotification)
exitentryCount++;
if (exitentryCount >= 1280)
{
SWSS_LOG_ERROR("[HUA] checkHighPriorityNotification true\n");
exitLoop = true;
break;
}

Expand Down
4 changes: 1 addition & 3 deletions orchagent/routeorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ struct LabelRouteBulkContext
class RouteOrch : public Orch, public Subject
{
public:
RouteOrch(DBConnector *db, vector<table_name_with_pri_t> &tableNames, SwitchOrch *switchOrch, NeighOrch *neighOrch, IntfsOrch *intfsOrch, VRFOrch *vrfOrch, FgNhgOrch *fgNhgOrch, Srv6Orch *srv6Orch, Select *select=nullptr);
RouteOrch(DBConnector *db, vector<table_name_with_pri_t> &tableNames, SwitchOrch *switchOrch, NeighOrch *neighOrch, IntfsOrch *intfsOrch, VRFOrch *vrfOrch, FgNhgOrch *fgNhgOrch, Srv6Orch *srv6Orch);

bool hasNextHopGroup(const NextHopGroupKey&) const;
sai_object_id_t getNextHopGroupId(const NextHopGroupKey&);
Expand Down Expand Up @@ -228,7 +228,6 @@ class RouteOrch : public Orch, public Subject
void decreaseNextHopGroupCount();
bool checkNextHopGroupCount();
const RouteTables& getSyncdRoutes() const { return m_syncdRoutes; }
bool checkHighPriorityNotification(int pri);

private:
SwitchOrch *m_switchOrch;
Expand All @@ -237,7 +236,6 @@ class RouteOrch : public Orch, public Subject
VRFOrch *m_vrfOrch;
FgNhgOrch *m_fgNhgOrch;
Srv6Orch *m_srv6Orch;
Select *m_select;

unsigned int m_nextHopGroupCount;
unsigned int m_maxNextHopGroupCount;
Expand Down

0 comments on commit d3c6cc8

Please sign in to comment.