Skip to content

Commit 7a215d0

Browse files
authored
Fix egress queue counters in voq systems. (sonic-net#2706)
* swss: Fix egress queue counters in voq systems. * In voq systems, the buffer profiles are defined on sysports.So the phy ports do not have buffer queue config and queuesStateVector built by getQueueConfigurations in flexcounterorch never has phy ports in voq systems. So in voq systems, always enable egress queue counters.
1 parent c5fa616 commit 7a215d0

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

orchagent/portsorch.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6158,7 +6158,7 @@ void PortsOrch::generateQueueMapPerPort(const Port& port, FlexCounterQueueStates
61586158
{
61596159
/* voq counters are always enabled. There is no mechanism to disable voq
61606160
* counters in a voq system. */
6161-
if (!voq && !queuesState.isQueueCounterEnabled(queueRealIndex))
6161+
if ((gMySwitchType != "voq") && !queuesState.isQueueCounterEnabled(queueRealIndex))
61626162
{
61636163
continue;
61646164
}
@@ -6177,6 +6177,16 @@ void PortsOrch::generateQueueMapPerPort(const Port& port, FlexCounterQueueStates
61776177
}
61786178
else
61796179
{
6180+
// In voq systems, always install a flex counter for this egress queue
6181+
// to track stats. In voq systems, the buffer profiles are defined on
6182+
// sysports. So the phy ports do not have buffer queue config. Hence
6183+
// queuesStateVector built by getQueueConfigurations in flexcounterorch
6184+
// never has phy ports in voq systems. So always enabled egress queue
6185+
// counter on voq systems.
6186+
if (gMySwitchType == "voq")
6187+
{
6188+
addQueueFlexCountersPerPortPerQueueIndex(port, queueIndex, false);
6189+
}
61806190
queuePortVector.emplace_back(id, sai_serialize_object_id(port.m_port_id));
61816191
}
61826192
}

tests/test_virtual_chassis.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,33 @@ def test_chassis_add_remove_ports(self, vct):
913913

914914
buffer_model.disable_dynamic_buffer(dvs.get_config_db(), dvs.runcmd)
915915

916+
def test_voq_egress_queue_counter(self, vct):
917+
if vct is None:
918+
return
919+
dvss = vct.dvss
920+
dvs = None
921+
for name in dvss.keys():
922+
if "supervisor" in name:
923+
continue
924+
dvs = dvss[name]
925+
break
926+
assert dvs
927+
_, _ = dvs.runcmd("counterpoll queue enable")
928+
929+
num_voqs_per_port = 8
930+
# vs-switch creates 20 queues per port.
931+
num_queues_per_local_port = 20
932+
num_ports_per_linecard = 32
933+
num_local_ports = 32
934+
num_linecards = 3
935+
num_sysports = num_ports_per_linecard * num_linecards
936+
num_egress_queues = num_local_ports * num_queues_per_local_port
937+
num_voqs = ( num_ports_per_linecard * num_voqs_per_port * num_linecards )
938+
num_queues_to_be_polled = num_voqs + num_egress_queues
939+
940+
flex_db = dvs.get_flex_db()
941+
flex_db.wait_for_n_keys("FLEX_COUNTER_TABLE:QUEUE_STAT_COUNTER", num_queues_to_be_polled)
942+
916943
# Add Dummy always-pass test at end as workaroud
917944
# for issue when Flaky fail on final test it invokes module tear-down before retrying
918945
def test_nonflaky_dummy():

0 commit comments

Comments
 (0)