From 1aa5ebfe264fa3555a3e745a350ca18f4e2daa4b Mon Sep 17 00:00:00 2001 From: Danny Allen Date: Tue, 12 Nov 2019 11:52:59 -0800 Subject: [PATCH] [flex_counter] Add sairedis support for drop counters (#520) * Adds functions to syncd_flex_counter for configuring and polling port-level debug counters Signed-off-by: Danny Allen daall@microsoft.com * Remove uneccesary includes * Add stubs for querying sai capabilities * Add support for serializing debug counter attributes * Add support for switch level debug counters * Improve vslib support for debug counters * Remove interface query stubs * Add missing swss log * Clean-up virtual switch implementation * Simplify vs debug counters * Remove unnecessary includes * Fix formatting * Respond to review comments --- meta/sai_serialize.h | 9 + meta/saiserialize.cpp | 24 ++ syncd/syncd.cpp | 29 +++ syncd/syncd_flex_counter.cpp | 341 ++++++++++++++++++++++++++- syncd/syncd_flex_counter.h | 39 +++ vslib/src/sai_vs_interfacequery.cpp | 1 + vslib/src/sai_vs_switch_BCM56850.cpp | 5 + vslib/src/sai_vs_switch_MLNX2700.cpp | 5 + 8 files changed, 450 insertions(+), 3 deletions(-) diff --git a/meta/sai_serialize.h b/meta/sai_serialize.h index eb3bfd66a768..c405127a94bf 100644 --- a/meta/sai_serialize.h +++ b/meta/sai_serialize.h @@ -84,6 +84,9 @@ std::string sai_serialize_common_api( std::string sai_serialize_port_stat( _In_ const sai_port_stat_t counter); +std::string sai_serialize_switch_stat( + _In_ const sai_switch_stat_t counter); + std::string sai_serialize_port_pool_stat( _In_ const sai_port_pool_stat_t counter); @@ -135,6 +138,12 @@ std::string sai_serialize_mac( std::string sai_serialize_port_oper_status( _In_ sai_port_oper_status_t status); +std::string sai_serialize_ingress_drop_reason( + _In_ const sai_in_drop_reason_t reason); + +std::string sai_serialize_egress_drop_reason( + _In_ const sai_out_drop_reason_t reason); + std::string sai_serialize_l2mc_entry_type( _In_ const sai_l2mc_entry_type_t type); diff --git a/meta/saiserialize.cpp b/meta/saiserialize.cpp index 95eddd86ed70..6ee1489cea32 100644 --- a/meta/saiserialize.cpp +++ b/meta/saiserialize.cpp @@ -820,6 +820,14 @@ std::string sai_serialize_port_stat( return sai_serialize_enum(counter, &sai_metadata_enum_sai_port_stat_t); } +std::string sai_serialize_switch_stat( + _In_ const sai_switch_stat_t counter) +{ + SWSS_LOG_ENTER(); + + return sai_serialize_enum(counter, &sai_metadata_enum_sai_switch_stat_t); +} + std::string sai_serialize_port_pool_stat( _In_ const sai_port_pool_stat_t counter) { @@ -898,6 +906,22 @@ std::string sai_serialize_switch_oper_status( return j.dump(); } +std::string sai_serialize_ingress_drop_reason( + _In_ const sai_in_drop_reason_t reason) +{ + SWSS_LOG_ENTER(); + + return sai_serialize_enum(reason, &sai_metadata_enum_sai_in_drop_reason_t); +} + +std::string sai_serialize_egress_drop_reason( + _In_ const sai_out_drop_reason_t reason) +{ + SWSS_LOG_ENTER(); + + return sai_serialize_enum(reason, &sai_metadata_enum_sai_out_drop_reason_t); +} + std::string sai_serialize_switch_shutdown_request( _In_ sai_object_id_t switch_id) { diff --git a/syncd/syncd.cpp b/syncd/syncd.cpp index 1892d950bf65..1f823c89b3ce 100644 --- a/syncd/syncd.cpp +++ b/syncd/syncd.cpp @@ -3376,6 +3376,7 @@ void processFlexCounterEvent( if (objectType == SAI_OBJECT_TYPE_PORT) { FlexCounter::removePort(vid, groupName); + FlexCounter::removePortDebugCounters(vid, groupName); } else if (objectType == SAI_OBJECT_TYPE_QUEUE) { @@ -3393,6 +3394,10 @@ void processFlexCounterEvent( { FlexCounter::removeBufferPool(vid, groupName); } + else if (objectType == SAI_OBJECT_TYPE_SWITCH) + { + FlexCounter::removeSwitchDebugCounters(vid, groupName); + } else { SWSS_LOG_ERROR("Object type for removal not supported, %s", objectTypeStr.c_str()); @@ -3423,6 +3428,18 @@ void processFlexCounterEvent( FlexCounter::setPortCounterList(vid, rid, groupName, portCounterIds); } + else if (objectType == SAI_OBJECT_TYPE_PORT && field == PORT_DEBUG_COUNTER_ID_LIST) + { + std::vector portDebugCounterIds; + for (const auto &str : idStrings) + { + sai_port_stat_t stat; + sai_deserialize_port_stat(str.c_str(), &stat); + portDebugCounterIds.push_back(stat); + } + + FlexCounter::setPortDebugCounterList(vid, rid, groupName, portDebugCounterIds); + } else if (objectType == SAI_OBJECT_TYPE_QUEUE && field == QUEUE_COUNTER_ID_LIST) { std::vector queueCounterIds; @@ -3483,6 +3500,18 @@ void processFlexCounterEvent( FlexCounter::setRifCounterList(vid, rid, groupName, rifCounterIds); } + else if (objectType == SAI_OBJECT_TYPE_SWITCH && field == SWITCH_DEBUG_COUNTER_ID_LIST) + { + std::vector switchCounterIds; + for (const auto &str : idStrings) + { + sai_switch_stat_t stat; + sai_deserialize_switch_stat(str.c_str(), &stat); + switchCounterIds.push_back(stat); + } + + FlexCounter::setSwitchDebugCounterList(vid, rid, groupName, switchCounterIds); + } else if (objectType == SAI_OBJECT_TYPE_BUFFER_POOL && field == BUFFER_POOL_COUNTER_ID_LIST) { counterIds = idStrings; diff --git a/syncd/syncd_flex_counter.cpp b/syncd/syncd_flex_counter.cpp index 795bc9831255..8bd467afcfe2 100644 --- a/syncd/syncd_flex_counter.cpp +++ b/syncd/syncd_flex_counter.cpp @@ -5,7 +5,7 @@ /* Global map with FlexCounter instances for different polling interval */ static std::map> g_flex_counters_map; -// List with supported counters +// List with supported counters static std::set supportedPortCounters; static std::set supportedQueueCounters; static std::set supportedPriorityGroupCounters; @@ -20,6 +20,15 @@ FlexCounter::PortCounterIds::PortCounterIds( SWSS_LOG_ENTER(); } +FlexCounter::SwitchCounterIds::SwitchCounterIds( + _In_ sai_object_id_t oid, + _In_ const std::vector &counterIds) + : switchId(oid), + switchCounterIds(counterIds) +{ + SWSS_LOG_ENTER(); +} + FlexCounter::QueueCounterIds::QueueCounterIds( _In_ sai_object_id_t queue, _In_ const std::vector &queueIds): @@ -212,6 +221,54 @@ void FlexCounter::setPortCounterList( } } +void FlexCounter::setPortDebugCounterList( + _In_ sai_object_id_t portVid, + _In_ sai_object_id_t portId, + _In_ std::string instanceId, + _In_ const std::vector &counterIds) +{ + SWSS_LOG_ENTER(); + + FlexCounter &fc = getInstance(instanceId); + + // Because debug counters can be added and removed over time, we currently + // check that the provided list of counters is valid every time. + std::vector supportedIds = fc.saiCheckSupportedPortDebugCounters(portId, counterIds); + + if (supportedIds.size() == 0) + { + SWSS_LOG_NOTICE("Port %s does not have supported debug counters", sai_serialize_object_id(portId).c_str()); + + // Remove flex counter if all counter IDs and plugins are unregistered + if (fc.isEmpty()) + { + removeInstance(instanceId); + } + + return; + } + + std::lock_guard lkMgr(fc.m_mtx); + + auto it = fc.m_portDebugCounterIdsMap.find(portVid); + if (it != fc.m_portDebugCounterIdsMap.end()) + { + it->second->portCounterIds = supportedIds; + return; + } + + auto portDebugCounterIds = std::make_shared(portId, supportedIds); + fc.m_portDebugCounterIdsMap.emplace(portVid, portDebugCounterIds); + + fc.addCollectCountersHandler(PORT_DEBUG_COUNTER_ID_LIST, &FlexCounter::collectPortDebugCounters); + + // Start flex counter thread in case it was not running due to empty counter IDs map + if (fc.m_pollInterval > 0) + { + fc.startFlexCounterThread(); + } +} + void FlexCounter::setQueueCounterList( _In_ sai_object_id_t queueVid, _In_ sai_object_id_t queueId, @@ -397,6 +454,54 @@ void FlexCounter::setPriorityGroupCounterList( } } +void FlexCounter::setSwitchDebugCounterList( + _In_ sai_object_id_t switchVid, + _In_ sai_object_id_t switchId, + _In_ std::string instanceId, + _In_ const std::vector &counterIds) +{ + SWSS_LOG_ENTER(); + + FlexCounter &fc = getInstance(instanceId); + + // Because debug counters can be added and removed over time, we currently + // check that the provided list of counters is valid every time. + std::vector supportedIds = fc.saiCheckSupportedSwitchDebugCounters(switchId, counterIds); + + if (supportedIds.size() == 0) + { + SWSS_LOG_NOTICE("Switch %s does not have supported debug counters", sai_serialize_object_id(switchId).c_str()); + + // Remove flex counter if all counter IDs and plugins are unregistered + if (fc.isEmpty()) + { + removeInstance(instanceId); + } + + return; + } + + std::lock_guard lkMgr(fc.m_mtx); + + auto it = fc.m_switchDebugCounterIdsMap.find(switchVid); + if (it != fc.m_switchDebugCounterIdsMap.end()) + { + it->second->switchCounterIds = supportedIds; + return; + } + + auto switchDebugCounterIds = std::make_shared(switchId, supportedIds); + fc.m_switchDebugCounterIdsMap.emplace(switchVid, switchDebugCounterIds); + + fc.addCollectCountersHandler(SWITCH_DEBUG_COUNTER_ID_LIST, &FlexCounter::collectSwitchDebugCounters); + + // Start flex counter thread in case it was not running due to empty counter IDs map + if (fc.m_pollInterval > 0) + { + fc.startFlexCounterThread(); + } +} + void FlexCounter::setPriorityGroupAttrList( _In_ sai_object_id_t priorityGroupVid, _In_ sai_object_id_t priorityGroupId, @@ -597,6 +702,44 @@ void FlexCounter::removePort( } } +void FlexCounter::removePortDebugCounters( + _In_ sai_object_id_t portVid, + _In_ std::string instanceId) +{ + SWSS_LOG_ENTER(); + + FlexCounter &fc = getInstance(instanceId); + + std::unique_lock lkMgr(fc.m_mtx); + + auto it = fc.m_portDebugCounterIdsMap.find(portVid); + if (it == fc.m_portDebugCounterIdsMap.end()) + { + SWSS_LOG_NOTICE("Trying to remove nonexisting port debug counter Ids 0x%" PRIx64, portVid); + + // Remove flex counter if all counter IDs and plugins are unregistered + if (fc.isEmpty()) + { + lkMgr.unlock(); + removeInstance(instanceId); + } + return; + } + + fc.m_portDebugCounterIdsMap.erase(it); + if (fc.m_portDebugCounterIdsMap.empty()) + { + fc.removeCollectCountersHandler(PORT_DEBUG_COUNTER_ID_LIST); + } + + // Remove flex counter if all counter IDs and plugins are unregistered + if (fc.isEmpty()) + { + lkMgr.unlock(); + removeInstance(instanceId); + } +} + void FlexCounter::removeQueue( _In_ sai_object_id_t queueVid, _In_ std::string instanceId) @@ -765,6 +908,44 @@ void FlexCounter::removeBufferPool( } } +void FlexCounter::removeSwitchDebugCounters( + _In_ sai_object_id_t switchVid, + _In_ std::string instanceId) +{ + SWSS_LOG_ENTER(); + + FlexCounter &fc = getInstance(instanceId); + + std::unique_lock lkMgr(fc.m_mtx); + + auto it = fc.m_switchDebugCounterIdsMap.find(switchVid); + if (it == fc.m_switchDebugCounterIdsMap.end()) + { + SWSS_LOG_NOTICE("Trying to remove nonexisting switch debug counter Ids 0x%" PRIx64, switchVid); + + // Remove flex counter if all counter IDs and plugins are unregistered + if (fc.isEmpty()) + { + lkMgr.unlock(); + removeInstance(instanceId); + } + return; + } + + fc.m_switchDebugCounterIdsMap.erase(it); + if (fc.m_switchDebugCounterIdsMap.empty()) + { + fc.removeCollectCountersHandler(SWITCH_DEBUG_COUNTER_ID_LIST); + } + + // Remove flex counter if all counter IDs and plugins are unregistered + if (fc.isEmpty()) + { + lkMgr.unlock(); + removeInstance(instanceId); + } +} + void FlexCounter::addPortCounterPlugin( _In_ std::string sha, _In_ std::string instanceId) @@ -923,8 +1104,10 @@ bool FlexCounter::allIdsEmpty() m_queueCounterIdsMap.empty() && m_queueAttrIdsMap.empty() && m_portCounterIdsMap.empty() && + m_portDebugCounterIdsMap.empty() && m_rifCounterIdsMap.empty() && - m_bufferPoolCounterIdsMap.empty(); + m_bufferPoolCounterIdsMap.empty() && + m_switchDebugCounterIdsMap.empty(); } bool FlexCounter::allPluginsEmpty() @@ -1051,6 +1234,48 @@ void FlexCounter::collectPortCounters(_In_ swss::Table &countersTable) } } +void FlexCounter::collectPortDebugCounters(_In_ swss::Table &countersTable) +{ + SWSS_LOG_ENTER(); + + // Collect stats for every registered port + for (const auto &kv: m_portDebugCounterIdsMap) + { + const auto &portVid = kv.first; + const auto &portId = kv.second->portId; + const auto &portCounterIds = kv.second->portCounterIds; + + std::vector portStats(portCounterIds.size()); + + // Get port stats + sai_status_t status = sai_metadata_sai_port_api->get_port_stats_ext( + portId, + static_cast(portCounterIds.size()), + (const sai_stat_id_t *)portCounterIds.data(), + SAI_STATS_MODE_READ, + portStats.data()); + if (status != SAI_STATUS_SUCCESS) + { + SWSS_LOG_ERROR("Failed to get stats of port 0x%" PRIx64 ": %d", portId, status); + continue; + } + + // Push all counter values to a single vector + std::vector values; + + for (size_t i = 0; i != portCounterIds.size(); i++) + { + const std::string &counterName = sai_serialize_port_stat(portCounterIds[i]); + values.emplace_back(counterName, std::to_string(portStats[i])); + } + + // Write counters to DB + std::string portVidStr = sai_serialize_object_id(portVid); + + countersTable.set(portVidStr, values, ""); + } +} + void FlexCounter::collectQueueCounters(_In_ swss::Table &countersTable) { SWSS_LOG_ENTER(); @@ -1213,6 +1438,48 @@ void FlexCounter::collectPriorityGroupCounters(_In_ swss::Table &countersTable) } } +void FlexCounter::collectSwitchDebugCounters(_In_ swss::Table &countersTable) +{ + SWSS_LOG_ENTER(); + + // Collect stats for every registered port + for (const auto &kv: m_switchDebugCounterIdsMap) + { + const auto &switchVid = kv.first; + const auto &switchId = kv.second->switchId; + const auto &switchCounterIds = kv.second->switchCounterIds; + + std::vector switchStats(switchCounterIds.size()); + + // Get port stats + sai_status_t status = sai_metadata_sai_switch_api->get_switch_stats_ext( + switchId, + static_cast(switchCounterIds.size()), + (const sai_stat_id_t *)switchCounterIds.data(), + SAI_STATS_MODE_READ, + switchStats.data()); + if (status != SAI_STATUS_SUCCESS) + { + SWSS_LOG_ERROR("Failed to get stats of port 0x%" PRIx64 ": %d", switchId, status); + continue; + } + + // Push all counter values to a single vector + std::vector values; + + for (size_t i = 0; i != switchCounterIds.size(); i++) + { + const std::string &counterName = sai_serialize_switch_stat(switchCounterIds[i]); + values.emplace_back(counterName, std::to_string(switchStats[i])); + } + + // Write counters to DB + std::string switchVidStr = sai_serialize_object_id(switchVid); + + countersTable.set(switchVidStr, values, ""); + } +} + void FlexCounter::collectPriorityGroupAttrs(_In_ swss::Table &countersTable) { SWSS_LOG_ENTER(); @@ -1367,7 +1634,7 @@ void FlexCounter::runPlugins( { SWSS_LOG_ENTER(); - const std::vector argv = + const std::vector argv = { std::to_string(COUNTERS_DB), COUNTERS_TABLE, @@ -1532,6 +1799,40 @@ void FlexCounter::saiUpdateSupportedPortCounters(sai_object_id_t portId) } } +std::vector FlexCounter::saiCheckSupportedPortDebugCounters( + _In_ sai_object_id_t portId, + _In_ const std::vector &counterIds) +{ + SWSS_LOG_ENTER(); + + std::vector supportedPortDebugCounters; + uint64_t value; + for (auto counter: counterIds) + { + if (counter < SAI_PORT_STAT_IN_DROP_REASON_RANGE_BASE || counter >= SAI_PORT_STAT_OUT_DROP_REASON_RANGE_END) + { + SWSS_LOG_NOTICE("Debug counter %s out of bounds", sai_serialize_port_stat(counter).c_str()); + continue; + } + + sai_status_t status = sai_metadata_sai_port_api->get_port_stats_ext(portId, 1, (const sai_stat_id_t *)&counter, SAI_STATS_MODE_READ, &value); + + if (status != SAI_STATUS_SUCCESS) + { + SWSS_LOG_NOTICE("Debug counter %s is not supported on port RID %s: %s", + sai_serialize_port_stat(counter).c_str(), + sai_serialize_object_id(portId).c_str(), + sai_serialize_status(status).c_str()); + + continue; + } + + supportedPortDebugCounters.push_back(counter); + } + + return supportedPortDebugCounters; +} + void FlexCounter::saiUpdateSupportedQueueCounters( _In_ sai_object_id_t queueId, _In_ const std::vector &counterIds) @@ -1685,3 +1986,37 @@ void FlexCounter::saiUpdateSupportedBufferPoolCounters( supportedBufferPoolCounters.insert(counterId); } } + +std::vector FlexCounter::saiCheckSupportedSwitchDebugCounters( + _In_ sai_object_id_t switchId, + _In_ const std::vector &counterIds) +{ + SWSS_LOG_ENTER(); + + std::vector supportedSwitchDebugCounters; + uint64_t value; + for (auto counter: counterIds) + { + if (counter < SAI_SWITCH_STAT_IN_DROP_REASON_RANGE_BASE || counter >= SAI_SWITCH_STAT_OUT_DROP_REASON_RANGE_END) + { + SWSS_LOG_NOTICE("Debug counter %s out of bounds", sai_serialize_switch_stat(counter).c_str()); + continue; + } + + sai_status_t status = sai_metadata_sai_switch_api->get_switch_stats_ext(switchId, 1, (const sai_stat_id_t *)&counter, SAI_STATS_MODE_READ, &value); + + if (status != SAI_STATUS_SUCCESS) + { + SWSS_LOG_NOTICE("Debug counter %s is not supported on switch RID %s: %s", + sai_serialize_switch_stat(counter).c_str(), + sai_serialize_object_id(switchId).c_str(), + sai_serialize_status(status).c_str()); + + continue; + } + + supportedSwitchDebugCounters.push_back(counter); + } + + return supportedSwitchDebugCounters; +} diff --git a/syncd/syncd_flex_counter.h b/syncd/syncd_flex_counter.h index 89b6fe4e87cf..a656473b1f04 100644 --- a/syncd/syncd_flex_counter.h +++ b/syncd/syncd_flex_counter.h @@ -11,6 +11,7 @@ extern "C" { #include #include #include "swss/table.h" +#include "swss/logger.h" class FlexCounter { @@ -23,6 +24,11 @@ class FlexCounter _In_ sai_object_id_t portId, _In_ std::string instanceId, _In_ const std::vector &counterIds); + static void setPortDebugCounterList( + _In_ sai_object_id_t portVid, + _In_ sai_object_id_t portId, + _In_ std::string instanceId, + _In_ const std::vector &counterIds); static void setQueueCounterList( _In_ sai_object_id_t queueVid, _In_ sai_object_id_t queueId, @@ -44,6 +50,11 @@ class FlexCounter _In_ const std::string &instanceId, _In_ const std::vector &counterIds, _In_ const std::string &statsMode = ""); + static void setSwitchDebugCounterList( + _In_ sai_object_id_t switchVid, + _In_ sai_object_id_t switchId, + _In_ std::string instanceId, + _In_ const std::vector &counterIds); static void setQueueAttrList( _In_ sai_object_id_t queueVid, _In_ sai_object_id_t queueId, @@ -64,6 +75,9 @@ class FlexCounter static void removePort( _In_ sai_object_id_t portVid, _In_ std::string instanceId); + static void removePortDebugCounters( + _In_ sai_object_id_t portVid, + _In_ std::string instanceId); static void removeQueue( _In_ sai_object_id_t queueVid, _In_ std::string instanceId); @@ -76,6 +90,9 @@ class FlexCounter static void removeBufferPool( _In_ sai_object_id_t bufferPoolVid, _In_ std::string instanceId); + static void removeSwitchDebugCounters( + _In_ sai_object_id_t switchVid, + _In_ std::string instanceId); static void addPortCounterPlugin( _In_ std::string sha, @@ -163,6 +180,16 @@ class FlexCounter std::vector portCounterIds; }; + struct SwitchCounterIds + { + SwitchCounterIds( + _In_ sai_object_id_t oid, + _In_ const std::vector &counterIds); + + sai_object_id_t switchId; + std::vector switchCounterIds; + }; + struct RifCounterIds { RifCounterIds( @@ -190,6 +217,14 @@ class FlexCounter void saiUpdateSupportedBufferPoolCounters(sai_object_id_t bufferPoolId, const std::vector &counterIds, sai_stats_mode_t statsMode = SAI_STATS_MODE_READ_AND_CLEAR); + + std::vector saiCheckSupportedPortDebugCounters( + _In_ sai_object_id_t portId, + _In_ const std::vector &counterIds); + std::vector saiCheckSupportedSwitchDebugCounters( + _In_ sai_object_id_t switchId, + _In_ const std::vector &counterIds); + bool isPortCounterSupported(sai_port_stat_t counter) const; bool isQueueCounterSupported(sai_queue_stat_t counter) const; bool isPriorityGroupCounterSupported(sai_ingress_priority_group_stat_t counter) const; @@ -203,24 +238,28 @@ class FlexCounter typedef std::unordered_map collect_counters_handler_unordered_map_t; void collectPortCounters(_In_ swss::Table &countersTable); + void collectPortDebugCounters(_In_ swss::Table &countersTable); void collectQueueCounters(_In_ swss::Table &countersTable); void collectQueueAttrs(_In_ swss::Table &countersTable); void collectPriorityGroupCounters(_In_ swss::Table &countersTable); void collectPriorityGroupAttrs(_In_ swss::Table &countersTable); void collectRifCounters(_In_ swss::Table &countersTable); void collectBufferPoolCounters(_In_ swss::Table &countersTable); + void collectSwitchDebugCounters(_In_ swss::Table &countersTable); void addCollectCountersHandler(const std::string &key, const collect_counters_handler_t &handler); void removeCollectCountersHandler(const std::string &key); // Key is a Virtual ID std::map> m_portCounterIdsMap; + std::map> m_portDebugCounterIdsMap; std::map> m_queueCounterIdsMap; std::map> m_queueAttrIdsMap; std::map> m_priorityGroupCounterIdsMap; std::map> m_priorityGroupAttrIdsMap; std::map> m_rifCounterIdsMap; std::map> m_bufferPoolCounterIdsMap; + std::map> m_switchDebugCounterIdsMap; // Plugins std::set m_queuePlugins; diff --git a/vslib/src/sai_vs_interfacequery.cpp b/vslib/src/sai_vs_interfacequery.cpp index eb3b0968dcf6..cea17dfca23f 100644 --- a/vslib/src/sai_vs_interfacequery.cpp +++ b/vslib/src/sai_vs_interfacequery.cpp @@ -915,6 +915,7 @@ sai_status_t sai_api_query( API_CASE(VIRTUAL_ROUTER,virtual_router); API_CASE(VLAN,vlan); API_CASE(WRED,wred); + API_CASE(DEBUG_COUNTER,debug_counter); default: SWSS_LOG_ERROR("Invalid API type %d", sai_api_id); diff --git a/vslib/src/sai_vs_switch_BCM56850.cpp b/vslib/src/sai_vs_switch_BCM56850.cpp index 922a9936089a..ba9106dcfd05 100644 --- a/vslib/src/sai_vs_switch_BCM56850.cpp +++ b/vslib/src/sai_vs_switch_BCM56850.cpp @@ -1383,6 +1383,11 @@ sai_status_t refresh_read_only_BCM56850( return refresh_vlan_member_list(meta, object_id, switch_id); } + if (meta->objecttype == SAI_OBJECT_TYPE_DEBUG_COUNTER && meta->attrid == SAI_DEBUG_COUNTER_ATTR_INDEX) + { + return SAI_STATUS_SUCCESS; + } + if (meta_unittests_enabled()) { SWSS_LOG_NOTICE("unittests enabled, SET could be performed on %s, not recalculating", meta->attridname); diff --git a/vslib/src/sai_vs_switch_MLNX2700.cpp b/vslib/src/sai_vs_switch_MLNX2700.cpp index 8a710097f61c..58d8aeb980ed 100644 --- a/vslib/src/sai_vs_switch_MLNX2700.cpp +++ b/vslib/src/sai_vs_switch_MLNX2700.cpp @@ -1241,6 +1241,11 @@ sai_status_t refresh_read_only_MLNX2700( return refresh_vlan_member_list(meta, object_id, switch_id); } + if (meta->objecttype == SAI_OBJECT_TYPE_DEBUG_COUNTER && meta->attrid == SAI_DEBUG_COUNTER_ATTR_INDEX) + { + return SAI_STATUS_SUCCESS; + } + if (meta_unittests_enabled()) { SWSS_LOG_NOTICE("unittests enabled, SET could be performed on %s, not recalculating", meta->attridname);