Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 22 additions & 19 deletions syncd/FlexCounter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -990,24 +990,24 @@ class CounterContext : public BaseCounterContext
auto rid = rids[i];
auto vid = vids[i];
std::vector<uint64_t> 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<CounterIds<StatType>>(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<CounterIds<StatType>>(rid, counter_ids);
m_objectIdsMap.emplace(vid, counter_data);
SWSS_LOG_INFO("Fallback to single call for object 0x%" PRIx64, vid);
}
return;
}

Expand Down Expand Up @@ -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<uint64_t> 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<uint64_t> 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<swss::FieldValueTuple> values;
Expand Down
Loading