From 93562885753e47f72208b61ff33ea7f2befc77df Mon Sep 17 00:00:00 2001 From: Vishrant Vasavada Date: Tue, 8 Sep 2026 08:07:43 -0700 Subject: [PATCH] Clear egress queue stats for all port queues, not just the configured ones --- fboss/agent/hw/sai/switch/SaiPortManager.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/fboss/agent/hw/sai/switch/SaiPortManager.cpp b/fboss/agent/hw/sai/switch/SaiPortManager.cpp index b3daaff412ba1..eecda2e51ad64 100644 --- a/fboss/agent/hw/sai/switch/SaiPortManager.cpp +++ b/fboss/agent/hw/sai/switch/SaiPortManager.cpp @@ -3216,7 +3216,17 @@ void SaiPortManager::clearStats(PortID port) { }), statsToClear.end()); portHandle->port->clearStats(statsToClear); - managerTable_->queueManager().clearStats(portHandle->configuredQueues); + // Clear all queues, not just configuredQueues. Where the port level out + // discard counter is derived from the per queue drop counters, a queue left + // out keeps outDiscards_ non-zero. configuredQueues covers only the port + // queue config, which is unicast only on XGS, so the multicast queues would + // never be cleared. + std::vector allQueues; + allQueues.reserve(portHandle->queues.size()); + for (const auto& [_, queue] : portHandle->queues) { + allQueues.push_back(queue.get()); + } + managerTable_->queueManager().clearStats(allQueues); // Reset accumulated inDiscards counter in portStats_. // inDiscards_ is a software-accumulated counter (+=) that is not