Skip to content

Commit 6e5ed1c

Browse files
[chassis][syncd][sai] Adjusting response timeout during syncd init (sonic-net#2159)
In VOQ based chassis where syncd uses VOQ SAI, if there are large number of front panel ports, SAI takes more than 1 minutes to complete the switch create initialization. Because of this, the switch create request sent by orchagent is not getting response within the default response wait time of 1 minute. So the orchagent declares switch create failure and crashes. To fix this, in orchagent, the syncd response time out is set to 5 minutes for line (voq) card and 10 minutes for supervisor (fabric) card before sending request for switch create and is set back to default wait time after the switch create. Signed-off-by: vedganes <[email protected]>
1 parent 0a99f54 commit 6e5ed1c

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

orchagent/main.cpp

+46
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,36 @@ int main(int argc, char **argv)
574574
attr.value.u64 = gSwitchId;
575575
attrs.push_back(attr);
576576

577+
if (gMySwitchType == "voq" || gMySwitchType == "fabric")
578+
{
579+
/* We set this long timeout in order for orchagent to wait enough time for
580+
* response from syncd. It is needed since switch create takes more time
581+
* than default time to create switch if there are lots of front panel ports
582+
* and systems ports to initialize
583+
*/
584+
585+
if (gMySwitchType == "voq")
586+
{
587+
attr.value.u64 = (5 * SAI_REDIS_DEFAULT_SYNC_OPERATION_RESPONSE_TIMEOUT);
588+
}
589+
else if (gMySwitchType == "fabric")
590+
{
591+
attr.value.u64 = (10 * SAI_REDIS_DEFAULT_SYNC_OPERATION_RESPONSE_TIMEOUT);
592+
}
593+
594+
attr.id = SAI_REDIS_SWITCH_ATTR_SYNC_OPERATION_RESPONSE_TIMEOUT;
595+
status = sai_switch_api->set_switch_attribute(gSwitchId, &attr);
596+
597+
if (status != SAI_STATUS_SUCCESS)
598+
{
599+
SWSS_LOG_WARN("Failed to set SAI REDIS response timeout");
600+
}
601+
else
602+
{
603+
SWSS_LOG_NOTICE("SAI REDIS response timeout set successfully to %" PRIu64 " ", attr.value.u64);
604+
}
605+
}
606+
577607
status = sai_switch_api->create_switch(&gSwitchId, (uint32_t)attrs.size(), attrs.data());
578608
if (status != SAI_STATUS_SUCCESS)
579609
{
@@ -582,6 +612,22 @@ int main(int argc, char **argv)
582612
}
583613
SWSS_LOG_NOTICE("Create a switch, id:%" PRIu64, gSwitchId);
584614

615+
if (gMySwitchType == "voq" || gMySwitchType == "fabric")
616+
{
617+
/* Set syncd response timeout back to the default value */
618+
attr.id = SAI_REDIS_SWITCH_ATTR_SYNC_OPERATION_RESPONSE_TIMEOUT;
619+
attr.value.u64 = SAI_REDIS_DEFAULT_SYNC_OPERATION_RESPONSE_TIMEOUT;
620+
status = sai_switch_api->set_switch_attribute(gSwitchId, &attr);
621+
622+
if (status != SAI_STATUS_SUCCESS)
623+
{
624+
SWSS_LOG_WARN("Failed to set SAI REDIS response timeout to default");
625+
}
626+
else
627+
{
628+
SWSS_LOG_NOTICE("SAI REDIS response timeout set successfully to default: %" PRIu64 " ", attr.value.u64);
629+
}
630+
}
585631

586632
if (gMySwitchType != "fabric")
587633
{

0 commit comments

Comments
 (0)