Skip to content

Commit 7846ab6

Browse files
kcudnikyxieca
authored andcommitted
Don't generate asic operations when attr value is same as default (sonic-net#404)
1 parent dec9cde commit 7846ab6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

syncd/syncd_applyview.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -5452,6 +5452,30 @@ bool performObjectSetTransition(
54525452
meta->attridname,
54535453
temporaryAttr->getStrAttrValue().c_str());
54545454

5455+
/*
5456+
* There is another case here, if this attribute exists only in
5457+
* temporary view and it has default value, and SET value is the
5458+
* same as default, then there is no need for ASIC operation.
5459+
*
5460+
* NOTE: This can lead to not put attributes with default VALUE to
5461+
* redis database and could be confusing when debugging.
5462+
*/
5463+
5464+
const auto defaultValueAttr = getSaiAttrFromDefaultValue(currentView, *meta);
5465+
5466+
if (defaultValueAttr != nullptr)
5467+
{
5468+
std::string defStr = sai_serialize_attr_value(*meta, *defaultValueAttr->getSaiAttr());
5469+
5470+
if (defStr == temporaryAttr->getStrAttrValue())
5471+
{
5472+
SWSS_LOG_NOTICE("explicit %s:%s is the same as default, no need for ASIC SET action",
5473+
meta->attridname, defStr.c_str());
5474+
5475+
continue;
5476+
}
5477+
}
5478+
54555479
/*
54565480
* Generate action and update current view in second pass
54575481
* and continue for next attribute.

0 commit comments

Comments
 (0)