Skip to content

Commit

Permalink
[BufferOrch] Don't call SAI API for BUFFER_POOL/PROFILE handling in c…
Browse files Browse the repository at this point in the history
…ase the op is DEL and the SAI OID is NULL (#1786)

- What I did
Don't call SAI API for BUFFER_POOL/PROFILE handling in case the op is DEL and the SAI OID is NULL in order to avoid orchagent from exiting.
We need it only in 202106 or above. In 202012 the orchagent won't exit in such case.

- Why I did it
Handle rare cases which cause SAI error eventually makes orchagent to exit.

- How I verified it
Manually test.

Signed-off-by: Stephen Sun <stephens@nvidia.com>
  • Loading branch information
stephenxs authored Jun 29, 2021
1 parent 6c88e47 commit 3226163
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions orchagent/bufferorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,14 +452,17 @@ task_process_status BufferOrch::processBufferPool(KeyOpFieldsValuesTuple &tuple)
return task_process_status::task_need_retry;
}

sai_status = sai_buffer_api->remove_buffer_pool(sai_object);
if (SAI_STATUS_SUCCESS != sai_status)
if (SAI_NULL_OBJECT_ID != sai_object)
{
SWSS_LOG_ERROR("Failed to remove buffer pool %s with type %s, rv:%d", object_name.c_str(), map_type_name.c_str(), sai_status);
task_process_status handle_status = handleSaiRemoveStatus(SAI_API_BUFFER, sai_status);
if (handle_status != task_process_status::task_success)
sai_status = sai_buffer_api->remove_buffer_pool(sai_object);
if (SAI_STATUS_SUCCESS != sai_status)
{
return handle_status;
SWSS_LOG_ERROR("Failed to remove buffer pool %s with type %s, rv:%d", object_name.c_str(), map_type_name.c_str(), sai_status);
task_process_status handle_status = handleSaiRemoveStatus(SAI_API_BUFFER, sai_status);
if (handle_status != task_process_status::task_success)
{
return handle_status;
}
}
}
SWSS_LOG_NOTICE("Removed buffer pool %s with type %s", object_name.c_str(), map_type_name.c_str());
Expand Down Expand Up @@ -651,14 +654,17 @@ task_process_status BufferOrch::processBufferProfile(KeyOpFieldsValuesTuple &tup
return task_process_status::task_need_retry;
}

sai_status = sai_buffer_api->remove_buffer_profile(sai_object);
if (SAI_STATUS_SUCCESS != sai_status)
if (SAI_NULL_OBJECT_ID != sai_object)
{
SWSS_LOG_ERROR("Failed to remove buffer profile %s with type %s, rv:%d", object_name.c_str(), map_type_name.c_str(), sai_status);
task_process_status handle_status = handleSaiRemoveStatus(SAI_API_BUFFER, sai_status);
if (handle_status != task_process_status::task_success)
sai_status = sai_buffer_api->remove_buffer_profile(sai_object);
if (SAI_STATUS_SUCCESS != sai_status)
{
return handle_status;
SWSS_LOG_ERROR("Failed to remove buffer profile %s with type %s, rv:%d", object_name.c_str(), map_type_name.c_str(), sai_status);
task_process_status handle_status = handleSaiRemoveStatus(SAI_API_BUFFER, sai_status);
if (handle_status != task_process_status::task_success)
{
return handle_status;
}
}
}

Expand Down

0 comments on commit 3226163

Please sign in to comment.