diff --git a/syncd/FlexCounter.cpp b/syncd/FlexCounter.cpp index 948c0b2b40..15d7d971de 100644 --- a/syncd/FlexCounter.cpp +++ b/syncd/FlexCounter.cpp @@ -990,24 +990,24 @@ class CounterContext : public BaseCounterContext auto rid = rids[i]; auto vid = vids[i]; std::vector stats(counter_ids.size()); - if (collectData(rid, counter_ids, effective_stats_mode, false, stats)) { - - auto it_vid = m_objectIdsMap.find(vid); - if (it_vid != m_objectIdsMap.end()) - { - // Remove and re-add if vid already exists - m_objectIdsMap.erase(it_vid); - } - - auto counter_data = std::make_shared>(rid, counter_ids); - m_objectIdsMap.emplace(vid, counter_data); - - SWSS_LOG_INFO("Fallback to single call for object 0x%" PRIx64, vid); - } else { - SWSS_LOG_WARN("%s RID %s can't provide the statistic", m_name.c_str(), sai_serialize_object_id(rid).c_str()); + if (!collectData(rid, counter_ids, effective_stats_mode, false, stats)) + { + // Workaround for N/A Counters on Broadcom management ports + // Adding VIDs with unsupported counters to objectIdsMap to unblock testing + // Please see https://github.com/sonic-net/sonic-sairedis/issues/1753 for details + SWSS_LOG_INFO("counter read failed on RID 0x%" PRIx64 " on intf 0x%" PRIx64 ", adding to objectIdsMap regardless", rid, vid); + } + auto it_vid = m_objectIdsMap.find(vid); + if (it_vid != m_objectIdsMap.end()) + { + // Remove and re-add if vid already exists + m_objectIdsMap.erase(it_vid); } - } + auto counter_data = std::make_shared>(rid, counter_ids); + m_objectIdsMap.emplace(vid, counter_data); + SWSS_LOG_INFO("Fallback to single call for object 0x%" PRIx64, vid); + } return; } @@ -1159,10 +1159,13 @@ class CounterContext : public BaseCounterContext kv.second->getStatsMode() == SAI_STATS_MODE_READ_AND_CLEAR) ? SAI_STATS_MODE_READ_AND_CLEAR : SAI_STATS_MODE_READ; } - std::vector stats(statIds.size()); - if (!collectData(rid, statIds, effective_stats_mode, true, stats)) + // Workaround for N/A Counters on Broadcom management ports + // Using '0' for unsupported counters to unblock testing + // Please see https://github.com/sonic-net/sonic-sairedis/issues/1753 for details + std::vector stats(statIds.size(), 0); + if (!collectData(rid, statIds, effective_stats_mode, false, stats)) { - continue; + SWSS_LOG_INFO("counter read failed on RID 0x%" PRIx64 " on intf 0x%" PRIx64 ", filling with '0' value", rid, vid); } std::vector values;