Skip to content

Commit

Permalink
Don't generate asic operations when attr value is same as default (so…
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik authored and yxieca committed Dec 20, 2018
1 parent dec9cde commit 7846ab6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions syncd/syncd_applyview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5452,6 +5452,30 @@ bool performObjectSetTransition(
meta->attridname,
temporaryAttr->getStrAttrValue().c_str());

/*
* There is another case here, if this attribute exists only in
* temporary view and it has default value, and SET value is the
* same as default, then there is no need for ASIC operation.
*
* NOTE: This can lead to not put attributes with default VALUE to
* redis database and could be confusing when debugging.
*/

const auto defaultValueAttr = getSaiAttrFromDefaultValue(currentView, *meta);

if (defaultValueAttr != nullptr)
{
std::string defStr = sai_serialize_attr_value(*meta, *defaultValueAttr->getSaiAttr());

if (defStr == temporaryAttr->getStrAttrValue())
{
SWSS_LOG_NOTICE("explicit %s:%s is the same as default, no need for ASIC SET action",
meta->attridname, defStr.c_str());

continue;
}
}

/*
* Generate action and update current view in second pass
* and continue for next attribute.
Expand Down

0 comments on commit 7846ab6

Please sign in to comment.