Skip to content

Commit 7adb39e

Browse files
shi-suShi Su
authored andcommitted
Ignore ALREADY_EXIST error in FDB creation (sonic-net#1815)
What I did Ignore ALREADY_EXIST error in FDB creation. Fix: sonic-net/sonic-buildimage#7798 Why I did it In FDB creation, there are scenarios where the hardware learns an FDB entry before orchagent. In such cases, the FDB SAI creation would report the status of SAI_STATUS_ITEM_ALREADY_EXISTS, and orchagent should ignore the error and treat it as entry was explicitly created.
1 parent 20102f6 commit 7adb39e

1 file changed

Lines changed: 30 additions & 7 deletions

File tree

orchagent/orch.cpp

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -699,15 +699,38 @@ task_process_status Orch::handleSaiCreateStatus(sai_api_t api, sai_status_t stat
699699
* in each orch.
700700
* 3. Take the type of sai api into consideration.
701701
*/
702-
switch (status)
702+
switch (api)
703703
{
704-
case SAI_STATUS_SUCCESS:
705-
SWSS_LOG_WARN("SAI_STATUS_SUCCESS is not expected in handleSaiCreateStatus");
706-
return task_success;
704+
case SAI_API_FDB:
705+
switch (status)
706+
{
707+
case SAI_STATUS_SUCCESS:
708+
SWSS_LOG_WARN("SAI_STATUS_SUCCESS is not expected in handleSaiCreateStatus");
709+
return task_success;
710+
case SAI_STATUS_ITEM_ALREADY_EXISTS:
711+
/*
712+
* In FDB creation, there are scenarios where the hardware learns an FDB entry before orchagent.
713+
* In such cases, the FDB SAI creation would report the status of SAI_STATUS_ITEM_ALREADY_EXISTS,
714+
* and orchagent should ignore the error and treat it as entry was explicitly created.
715+
*/
716+
return task_success;
717+
default:
718+
SWSS_LOG_ERROR("Encountered failure in create operation, exiting orchagent, SAI API: %s, status: %s",
719+
sai_serialize_api(api).c_str(), sai_serialize_status(status).c_str());
720+
exit(EXIT_FAILURE);
721+
}
722+
break;
707723
default:
708-
SWSS_LOG_ERROR("Encountered failure in create operation, exiting orchagent, SAI API: %s, status: %s",
709-
sai_serialize_api(api).c_str(), sai_serialize_status(status).c_str());
710-
exit(EXIT_FAILURE);
724+
switch (status)
725+
{
726+
case SAI_STATUS_SUCCESS:
727+
SWSS_LOG_WARN("SAI_STATUS_SUCCESS is not expected in handleSaiCreateStatus");
728+
return task_success;
729+
default:
730+
SWSS_LOG_ERROR("Encountered failure in create operation, exiting orchagent, SAI API: %s, status: %s",
731+
sai_serialize_api(api).c_str(), sai_serialize_status(status).c_str());
732+
exit(EXIT_FAILURE);
733+
}
711734
}
712735
return task_need_retry;
713736
}

0 commit comments

Comments
 (0)