Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions orchagent/routeorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern FlowCounterRouteOrch *gFlowCounterRouteOrch;
extern TunnelDecapOrch *gTunneldecapOrch;

extern size_t gMaxBulkSize;
extern string gMySwitchType;

/* Default maximum number of next hop groups */
#define DEFAULT_NUMBER_OF_ECMP_GROUPS 128
Expand Down Expand Up @@ -88,6 +89,37 @@ RouteOrch::RouteOrch(DBConnector *db, vector<table_name_with_pri_t> &tableNames,

SWSS_LOG_NOTICE("Maximum number of ECMP groups supported is %d", m_maxNextHopGroupCount);

/* fetch the MAX_ECMP_MEMBER_COUNT and for voq platform, set it to 128 */
attr.id = SAI_SWITCH_ATTR_MAX_ECMP_MEMBER_COUNT;
status = sai_switch_api->get_switch_attribute(gSwitchId, 1, &attr);

if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_WARN("Failed to get switch attribute max ECMP Group size. rv:%d", status);
}
else
{
uint32_t maxEcmpGroupSize = attr.value.u32;
SWSS_LOG_NOTICE("Switch Type: %s, Max ECMP Group Size supported: %d", gMySwitchType.c_str(), attr.value.u32);

/*If the switch type is voq, and max Ecmp group size supported is greater or equal to 128, set it to 128 */
if (gMySwitchType == "voq" && maxEcmpGroupSize >= 128)
{
maxEcmpGroupSize = 128;
attr.id = SAI_SWITCH_ATTR_ECMP_MEMBER_COUNT;
attr.value.s32 = maxEcmpGroupSize;
status = sai_switch_api->set_switch_attribute(gSwitchId, &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to set switch attribute ECMP member count to 128. rv:%d", status);
}
else
{
SWSS_LOG_NOTICE("Set switch attribute ECMP member count to 128");
}
}
}

m_stateDb = shared_ptr<DBConnector>(new DBConnector("STATE_DB", 0));
m_stateDefaultRouteTb = unique_ptr<swss::Table>(new Table(m_stateDb.get(), STATE_ROUTE_TABLE_NAME));

Expand Down