From 1918744c8bc56e9f08e255a76ccca05e8018c2a6 Mon Sep 17 00:00:00 2001 From: Deepak Singhal <115033986+deepak-singhal0408@users.noreply.github.com> Date: Mon, 11 Nov 2024 13:00:16 -0800 Subject: [PATCH] VOQ: Set the ECMP group size to 128. (#3351) 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 --- orchagent/routeorch.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/orchagent/routeorch.cpp b/orchagent/routeorch.cpp index b1508656b3a..803f71bb1e0 100644 --- a/orchagent/routeorch.cpp +++ b/orchagent/routeorch.cpp @@ -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 @@ -88,6 +89,37 @@ RouteOrch::RouteOrch(DBConnector *db, vector &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(new DBConnector("STATE_DB", 0)); m_stateDefaultRouteTb = unique_ptr(new Table(m_stateDb.get(), STATE_ROUTE_TABLE_NAME));