Skip to content

Commit

Permalink
swss: Fix Invalid port oid messages generated because of voq counters. (
Browse files Browse the repository at this point in the history
#2653)

* swss: Fix Invalid port oid messages generated because of voq counters.
* Do not add Voq oids to CounterCheckOrch since CounterCheckOrch is not
  relevant for voqs.
  • Loading branch information
skbarista authored Feb 23, 2023
1 parent baa302e commit 35a7ab0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
25 changes: 20 additions & 5 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6169,6 +6169,10 @@ void PortsOrch::generateQueueMapPerPort(const Port& port, FlexCounterQueueStates
queueVector.emplace_back(name.str(), id);
if (voq)
{
// Install a flex counter for this voq to track stats. Voq counters do
// not have buffer queue config. So it does not get enabled through the
// flexcounter orch logic. Always enabled voq counters.
addQueueFlexCountersPerPortPerQueueIndex(port, queueIndex, true);
queuePortVector.emplace_back(id, sai_serialize_object_id(port.m_system_port_oid));
}
else
Expand All @@ -6184,12 +6188,12 @@ void PortsOrch::generateQueueMapPerPort(const Port& port, FlexCounterQueueStates
else
{
m_queueTable->set("", queueVector);
CounterCheckOrch::getInstance().addPort(port);
}
m_queuePortTable->set("", queuePortVector);
m_queueIndexTable->set("", queueIndexVector);
m_queueTypeTable->set("", queueTypeVector);

CounterCheckOrch::getInstance().addPort(port);
}

void PortsOrch::addQueueFlexCounters(map<string, FlexCounterQueueStates> queuesStateVector)
Expand Down Expand Up @@ -6230,19 +6234,30 @@ void PortsOrch::addQueueFlexCountersPerPort(const Port& port, FlexCounterQueueSt
continue;
}
// Install a flex counter for this queue to track stats
addQueueFlexCountersPerPortPerQueueIndex(port, queueIndex);
addQueueFlexCountersPerPortPerQueueIndex(port, queueIndex, false);
}
}
}

void PortsOrch::addQueueFlexCountersPerPortPerQueueIndex(const Port& port, size_t queueIndex)
void PortsOrch::addQueueFlexCountersPerPortPerQueueIndex(const Port& port, size_t queueIndex, bool voq)
{
std::unordered_set<string> counter_stats;
std::vector<sai_object_id_t> queue_ids;

for (const auto& it: queue_stat_ids)
{
counter_stats.emplace(sai_serialize_queue_stat(it));
}
queue_stat_manager.setCounterIdList(port.m_queue_ids[queueIndex], CounterType::QUEUE, counter_stats);
if (voq)
{
queue_ids = m_port_voq_ids[port.m_alias];
}
else
{
queue_ids = port.m_queue_ids;
}

queue_stat_manager.setCounterIdList(queue_ids[queueIndex], CounterType::QUEUE, counter_stats);
}


Expand Down Expand Up @@ -6350,7 +6365,7 @@ void PortsOrch::createPortBufferQueueCounters(const Port &port, string queues)
if (flexCounterOrch->getQueueCountersState())
{
// Install a flex counter for this queue to track stats
addQueueFlexCountersPerPortPerQueueIndex(port, queueIndex);
addQueueFlexCountersPerPortPerQueueIndex(port, queueIndex, false);
}
if (flexCounterOrch->getQueueWatermarkCountersState())
{
Expand Down
2 changes: 1 addition & 1 deletion orchagent/portsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ class PortsOrch : public Orch, public Subject
void generateQueueMapPerPort(const Port& port, FlexCounterQueueStates& queuesState, bool voq);
bool m_isQueueFlexCountersAdded = false;
void addQueueFlexCountersPerPort(const Port& port, FlexCounterQueueStates& queuesState);
void addQueueFlexCountersPerPortPerQueueIndex(const Port& port, size_t queueIndex);
void addQueueFlexCountersPerPortPerQueueIndex(const Port& port, size_t queueIndex, bool voq);

bool m_isQueueWatermarkFlexCountersAdded = false;
void addQueueWatermarkFlexCountersPerPort(const Port& port, FlexCounterQueueStates& queuesState);
Expand Down

0 comments on commit 35a7ab0

Please sign in to comment.