From d0419dc4b71c45d7c25178cf558d102715747fc8 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 a7a6e25548d4..7748ab4c8240 100755 --- a/orchagent/portsorch.cpp +++ b/orchagent/portsorch.cpp @@ -6123,7 +6123,9 @@ void PortsOrch::generateQueueMapPerPort(const Port& port, FlexCounterQueueStates uint8_t queueRealIndex = 0; if (getQueueTypeAndIndex(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; }