Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3971 by skipping create-only SAI attributes when modifying buffer pools or profiles in orchagent #1430

Merged
merged 2 commits into from
Sep 15, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 45 additions & 6 deletions orchagent/bufferorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@ task_process_status BufferOrch::processBufferPool(Consumer &consumer)
else if (field == buffer_pool_type_field_name)
{
string type = value;

if (SAI_NULL_OBJECT_ID != sai_object)
{
// We should skip the pool type because it's create only when setting a pool's attribute.
SWSS_LOG_INFO("Skip setting buffer pool type %s for pool %s", type.c_str(), object_name.c_str());
continue;
}

if (type == buffer_value_ingress)
{
attr.value.u32 = SAI_BUFFER_POOL_TYPE_INGRESS;
Expand All @@ -289,6 +297,14 @@ task_process_status BufferOrch::processBufferPool(Consumer &consumer)
else if (field == buffer_pool_mode_field_name)
{
string mode = value;

if (SAI_NULL_OBJECT_ID != sai_object)
{
// We should skip the pool type because it's create only when setting a pool's attribute.
yxieca marked this conversation as resolved.
Show resolved Hide resolved
SWSS_LOG_INFO("Skip setting buffer pool mode %s for pool %s", mode.c_str(), object_name.c_str());
continue;
}

if (mode == buffer_pool_mode_dynamic_value)
{
attr.value.u32 = SAI_BUFFER_POOL_THRESHOLD_MODE_DYNAMIC;
Expand Down Expand Up @@ -396,6 +412,13 @@ task_process_status BufferOrch::processBufferProfile(Consumer &consumer)
sai_attribute_t attr;
if (field == buffer_pool_field_name)
{
if (SAI_NULL_OBJECT_ID != sai_object)
{
// We should skip the profile's pool name because it's create only when setting a profile's attribute.
SWSS_LOG_INFO("Skip setting buffer profile's pool %s for profile %s", value.c_str(), object_name.c_str());
continue;
}

sai_object_id_t sai_pool;
ref_resolve_status resolve_result = resolveFieldRefValue(m_buffer_type_maps, buffer_pool_field_name, tuple, sai_pool);
if (ref_resolve_status::success != resolve_result)
Expand Down Expand Up @@ -438,19 +461,35 @@ task_process_status BufferOrch::processBufferProfile(Consumer &consumer)
}
else if (field == buffer_dynamic_th_field_name)
{
attr.id = SAI_BUFFER_PROFILE_ATTR_THRESHOLD_MODE;
attr.value.s32 = SAI_BUFFER_PROFILE_THRESHOLD_MODE_DYNAMIC;
attribs.push_back(attr);
if (SAI_NULL_OBJECT_ID != sai_object)
{
// We should skip the profile's pool name because it's create only when setting a profile's attribute.
yxieca marked this conversation as resolved.
Show resolved Hide resolved
SWSS_LOG_INFO("Skip setting buffer profile's threshold type for profile %s", object_name.c_str());
}
else
{
attr.id = SAI_BUFFER_PROFILE_ATTR_THRESHOLD_MODE;
attr.value.s32 = SAI_BUFFER_PROFILE_THRESHOLD_MODE_DYNAMIC;
attribs.push_back(attr);
}

attr.id = SAI_BUFFER_PROFILE_ATTR_SHARED_DYNAMIC_TH;
attr.value.s8 = (sai_int8_t)stol(value);
attribs.push_back(attr);
}
else if (field == buffer_static_th_field_name)
{
attr.id = SAI_BUFFER_PROFILE_ATTR_THRESHOLD_MODE;
attr.value.s32 = SAI_BUFFER_PROFILE_THRESHOLD_MODE_STATIC;
attribs.push_back(attr);
if (SAI_NULL_OBJECT_ID != sai_object)
{
// We should skip the profile's pool name because it's create only when setting a profile's attribute.
yxieca marked this conversation as resolved.
Show resolved Hide resolved
SWSS_LOG_INFO("Skip setting buffer profile's threshold type for profile %s", object_name.c_str());
}
else
{
attr.id = SAI_BUFFER_PROFILE_ATTR_THRESHOLD_MODE;
attr.value.s32 = SAI_BUFFER_PROFILE_THRESHOLD_MODE_STATIC;
attribs.push_back(attr);
}

attr.id = SAI_BUFFER_PROFILE_ATTR_SHARED_STATIC_TH;
attr.value.u64 = (uint64_t)stoul(value);
Expand Down