Skip to content

Commit f7b974f

Browse files
authored
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 b4938a5 commit f7b974f

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
@@ -334,11 +334,14 @@ task_process_status BufferOrch::processBufferPool(Consumer &consumer)
334334
}
335335
if (SAI_NULL_OBJECT_ID != sai_object)
336336
{
337-
sai_status = sai_buffer_api->set_buffer_pool_attribute(sai_object, &attribs[0]);
338-
if (SAI_STATUS_SUCCESS != sai_status)
337+
for (auto &attribute : attribs)
339338
{
340-
SWSS_LOG_ERROR("Failed to modify buffer pool, name:%s, sai object:%" PRIx64 ", status:%d", object_name.c_str(), sai_object, sai_status);
341-
return task_process_status::task_failed;
339+
sai_status = sai_buffer_api->set_buffer_pool_attribute(sai_object, &attribute);
340+
if (SAI_STATUS_SUCCESS != sai_status)
341+
{
342+
SWSS_LOG_ERROR("Failed to modify buffer pool, name:%s, sai object:%" PRIx64 ", status:%d", object_name.c_str(), sai_object, sai_status);
343+
return task_process_status::task_failed;
344+
}
342345
}
343346
SWSS_LOG_DEBUG("Modified existing pool:%" PRIx64 ", type:%s name:%s ", sai_object, map_type_name.c_str(), object_name.c_str());
344347
}
@@ -503,11 +506,14 @@ task_process_status BufferOrch::processBufferProfile(Consumer &consumer)
503506
if (SAI_NULL_OBJECT_ID != sai_object)
504507
{
505508
SWSS_LOG_DEBUG("Modifying existing sai object:%" PRIx64, sai_object);
506-
sai_status = sai_buffer_api->set_buffer_profile_attribute(sai_object, &attribs[0]);
507-
if (SAI_STATUS_SUCCESS != sai_status)
509+
for (auto &attribute : attribs)
508510
{
509-
SWSS_LOG_ERROR("Failed to modify buffer profile, name:%s, sai object:%" PRIx64 ", status:%d", object_name.c_str(), sai_object, sai_status);
510-
return task_process_status::task_failed;
511+
sai_status = sai_buffer_api->set_buffer_profile_attribute(sai_object, &attribute);
512+
if (SAI_STATUS_SUCCESS != sai_status)
513+
{
514+
SWSS_LOG_ERROR("Failed to modify buffer profile, name:%s, sai object:%" PRIx64 ", status:%d", object_name.c_str(), sai_object, sai_status);
515+
return task_process_status::task_failed;
516+
}
511517
}
512518
}
513519
else

0 commit comments

Comments
 (0)