Skip to content

Commit 3514596

Browse files
stephenxsabdosi
authored andcommitted
Fix issue: bufferorch only pass the first attribute to sai when setting attribute (sonic-net#1442)
Signed-off-by: Stephen Sun <stephens@nvidia.com>
1 parent 1c00cda commit 3514596

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

orchagent/bufferorch.cpp

+14-8
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,14 @@ task_process_status BufferOrch::processBufferPool(Consumer &consumer)
335335
}
336336
if (SAI_NULL_OBJECT_ID != sai_object)
337337
{
338-
sai_status = sai_buffer_api->set_buffer_pool_attribute(sai_object, &attribs[0]);
339-
if (SAI_STATUS_SUCCESS != sai_status)
338+
for (auto &attribute : attribs)
340339
{
341-
SWSS_LOG_ERROR("Failed to modify buffer pool, name:%s, sai object:%" PRIx64 ", status:%d", object_name.c_str(), sai_object, sai_status);
342-
return task_process_status::task_failed;
340+
sai_status = sai_buffer_api->set_buffer_pool_attribute(sai_object, &attribute);
341+
if (SAI_STATUS_SUCCESS != sai_status)
342+
{
343+
SWSS_LOG_ERROR("Failed to modify buffer pool, name:%s, sai object:%" PRIx64 ", status:%d", object_name.c_str(), sai_object, sai_status);
344+
return task_process_status::task_failed;
345+
}
343346
}
344347
SWSS_LOG_DEBUG("Modified existing pool:%" PRIx64 ", type:%s name:%s ", sai_object, map_type_name.c_str(), object_name.c_str());
345348
}
@@ -504,11 +507,14 @@ task_process_status BufferOrch::processBufferProfile(Consumer &consumer)
504507
if (SAI_NULL_OBJECT_ID != sai_object)
505508
{
506509
SWSS_LOG_DEBUG("Modifying existing sai object:%" PRIx64, sai_object);
507-
sai_status = sai_buffer_api->set_buffer_profile_attribute(sai_object, &attribs[0]);
508-
if (SAI_STATUS_SUCCESS != sai_status)
510+
for (auto &attribute : attribs)
509511
{
510-
SWSS_LOG_ERROR("Failed to modify buffer profile, name:%s, sai object:%" PRIx64 ", status:%d", object_name.c_str(), sai_object, sai_status);
511-
return task_process_status::task_failed;
512+
sai_status = sai_buffer_api->set_buffer_profile_attribute(sai_object, &attribute);
513+
if (SAI_STATUS_SUCCESS != sai_status)
514+
{
515+
SWSS_LOG_ERROR("Failed to modify buffer profile, name:%s, sai object:%" PRIx64 ", status:%d", object_name.c_str(), sai_object, sai_status);
516+
return task_process_status::task_failed;
517+
}
512518
}
513519
}
514520
else

0 commit comments

Comments
 (0)