in syncd/FlexCounter.cpp [2597:2738]
void FlexCounter::removeCounter(
_In_ sai_object_id_t vid)
{
MUTEX;
SWSS_LOG_ENTER();
auto objectType = VidManager::objectTypeQuery(vid);
if (objectType == SAI_OBJECT_TYPE_PORT)
{
if (hasCounterContext(COUNTER_TYPE_PORT))
{
getCounterContext(COUNTER_TYPE_PORT)->removeObject(vid);
}
if (hasCounterContext(COUNTER_TYPE_PORT_DEBUG))
{
getCounterContext(COUNTER_TYPE_PORT_DEBUG)->removeObject(vid);
}
if (hasCounterContext(COUNTER_TYPE_WRED_ECN_PORT))
{
getCounterContext(COUNTER_TYPE_WRED_ECN_PORT)->removeObject(vid);
}
}
else if (objectType == SAI_OBJECT_TYPE_QUEUE)
{
if (hasCounterContext(COUNTER_TYPE_QUEUE))
{
getCounterContext(COUNTER_TYPE_QUEUE)->removeObject(vid);
}
if (hasCounterContext(COUNTER_TYPE_WRED_ECN_QUEUE))
{
getCounterContext(COUNTER_TYPE_WRED_ECN_QUEUE)->removeObject(vid);
}
if (hasCounterContext(ATTR_TYPE_QUEUE))
{
getCounterContext(ATTR_TYPE_QUEUE)->removeObject(vid);
}
}
else if (objectType == SAI_OBJECT_TYPE_INGRESS_PRIORITY_GROUP)
{
if (hasCounterContext(COUNTER_TYPE_PG))
{
getCounterContext(COUNTER_TYPE_PG)->removeObject(vid);
}
if (hasCounterContext(ATTR_TYPE_PG))
{
getCounterContext(ATTR_TYPE_PG)->removeObject(vid);
}
}
else if (objectType == SAI_OBJECT_TYPE_ROUTER_INTERFACE)
{
if (hasCounterContext(COUNTER_TYPE_RIF))
{
removeDataFromCountersDB(vid, ":RIF");
getCounterContext(COUNTER_TYPE_RIF)->removeObject(vid);
}
}
else if (objectType == SAI_OBJECT_TYPE_BUFFER_POOL)
{
if (hasCounterContext(COUNTER_TYPE_BUFFER_POOL))
{
getCounterContext(COUNTER_TYPE_BUFFER_POOL)->removeObject(vid);
}
}
else if (objectType == SAI_OBJECT_TYPE_SWITCH)
{
if (hasCounterContext(COUNTER_TYPE_SWITCH_DEBUG))
{
getCounterContext(COUNTER_TYPE_SWITCH_DEBUG)->removeObject(vid);
}
}
else if (objectType == SAI_OBJECT_TYPE_MACSEC_FLOW)
{
if (hasCounterContext(COUNTER_TYPE_MACSEC_FLOW))
{
getCounterContext(COUNTER_TYPE_MACSEC_FLOW)->removeObject(vid);
}
}
else if (objectType == SAI_OBJECT_TYPE_MACSEC_SA)
{
if (hasCounterContext(COUNTER_TYPE_MACSEC_SA))
{
getCounterContext(COUNTER_TYPE_MACSEC_SA)->removeObject(vid);
}
if (hasCounterContext(ATTR_TYPE_MACSEC_SA))
{
getCounterContext(ATTR_TYPE_MACSEC_SA)->removeObject(vid);
}
}
else if (objectType == SAI_OBJECT_TYPE_ACL_COUNTER)
{
if (hasCounterContext(ATTR_TYPE_ACL_COUNTER))
{
getCounterContext(ATTR_TYPE_ACL_COUNTER)->removeObject(vid);
}
}
else if (objectType == SAI_OBJECT_TYPE_TUNNEL)
{
if (hasCounterContext(COUNTER_TYPE_TUNNEL))
{
getCounterContext(COUNTER_TYPE_TUNNEL)->removeObject(vid);
}
}
else if (objectType == (sai_object_type_t)SAI_OBJECT_TYPE_ENI)
{
if (hasCounterContext(COUNTER_TYPE_ENI))
{
getCounterContext(COUNTER_TYPE_ENI)->removeObject(vid);
}
if (hasCounterContext(COUNTER_TYPE_METER_BUCKET))
{
getCounterContext(COUNTER_TYPE_METER_BUCKET)->removeObject(vid);
}
}
else if (objectType == SAI_OBJECT_TYPE_COUNTER)
{
if (hasCounterContext(COUNTER_TYPE_FLOW))
{
getCounterContext(COUNTER_TYPE_FLOW)->removeObject(vid);
removeDataFromCountersDB(vid, ":TRAP");
}
if (hasCounterContext(COUNTER_TYPE_SRV6))
{
getCounterContext(COUNTER_TYPE_SRV6)->removeObject(vid);
}
}
else if (objectType == SAI_OBJECT_TYPE_POLICER)
{
if (hasCounterContext(COUNTER_TYPE_POLICER))
{
getCounterContext(COUNTER_TYPE_POLICER)->removeObject(vid);
}
}
else
{
SWSS_LOG_ERROR("Object type for removal not supported, %s",
sai_serialize_object_type(objectType).c_str());
}
}