Skip to content

Commit

Permalink
VOQ: Set the ECMP group size to 128. (sonic-net#3351)
Browse files Browse the repository at this point in the history
What I did
Set the ECMP group size on VOQ platform to 128.

Why I did it
in SAI 11.x, the MAX ECMP group size on DNX chipsets is set to 64. This is causing issues on VOQ platforms, where ECMP group size in control plane (ebgp+ibgp) is set to 128. We see ECMP group creation failures and eventually leading to orchagent crash.
Related issue: sonic-net/sonic-buildimage#20622
  • Loading branch information
deepak-singhal0408 authored and github-actions[bot] committed Nov 19, 2024
1 parent c9ee0b5 commit 959af34
Showing 1 changed file with 32 additions and 0 deletions.
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

0 comments on commit 959af34

Please sign in to comment.