From abc6a816e92dd320fd835e59eb5277ba690b55b3 Mon Sep 17 00:00:00 2001 From: Sambath Kumar Balasubramanian <63021927+skbarista@users.noreply.github.com> Date: Mon, 5 Dec 2022 18:56:52 -0800 Subject: [PATCH] sonic-swss: Fix orchagent crash in generateQueueMapPerPort. (#2552) * generateQueueMap uses m_portList[port].m_queue_ids.size to allocate m_queueStates in FlexCounterQueueStates. But m_portList[port].m_queue_ids.size is zero for system ports which results in isQueueCounterEnabled crash for system ports. Since we do not have support disable voq counters yet, do not check isQueueCounterEnabled for voqs. --- orchagent/portsorch.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/orchagent/portsorch.cpp b/orchagent/portsorch.cpp index 5dc373c5c6..77064775ac 100755 --- a/orchagent/portsorch.cpp +++ b/orchagent/portsorch.cpp @@ -5991,7 +5991,9 @@ void PortsOrch::generateQueueMapPerPort(const Port& port, FlexCounterQueueStates uint8_t queueRealIndex = 0; if (getQueueTypeAndIndex(port.m_queue_ids[queueIndex], queueType, queueRealIndex)) { - if (!queuesState.isQueueCounterEnabled(queueRealIndex)) + /* voq counters are always enabled. There is no mechanism to disable voq + * counters in a voq system. */ + if (!voq && !queuesState.isQueueCounterEnabled(queueRealIndex)) { continue; }