Skip to content

[Nexthop] Clear egress queue stats for all port queues, not just the configured… - #1613

Open
vvasavada-nexthop wants to merge 1 commit into
facebook:mainfrom
nexthop-ai:clear-egress-queue-stats-all-port
Open

[Nexthop] Clear egress queue stats for all port queues, not just the configured…#1613
vvasavada-nexthop wants to merge 1 commit into
facebook:mainfrom
nexthop-ai:clear-egress-queue-stats-all-port

Conversation

@vvasavada-nexthop

Copy link
Copy Markdown
Contributor

… ones

Pre-submission checklist

  • I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • pre-commit run

Summary

Root cause

clear interface counters reported success but left per-interface Output Discards unchanged, while Input Discards on the same port cleared correctly.

SaiPortManager::clearStats clears the port level counters and then the egress queue drop counters, but it only walked portHandle->configuredQueues. That list is built from the SwtichState port queue config, and BroadcomXgsAsic::getQueueStreamTypes(INTERFACE_PORT) returns {UNICAST} - so the multicast queues, which exist in HW and are present in SAI's QOS_QUEUE_LIST (and therefore in portHandle->queues), were never in it.

On XGS the port level SAI_PORT_STAT_IF_OUT_DISCARDS is derived from the sum of the per queue drop counters across every queue, so any queue left out of the clear pins HwPortStats::outDiscards_ at a non-zero value indefinitely. Drops parked on multicast queue - flooded BUM traffic, e.g. a port that is the sole member of its VLAN - therefore survived the clear.

Input Discards was unaffected before inDiscards_ is accumulated in software and explicitly zeroed in clearStats, which masks the same behavior on the ingress size.

Fix

Iterate portHandle->queues instead.

Test Plan

Before fix

  # fboss2 show interface errors
   Interface Name  Input Errors  Input Discards  Output Errors  Output Discards
  ------------------------------------------------------------------------------------
   eth1/18/1       0             1               0              24096

  # fboss2 clear interface counters
  Counters cleared.

  # sleep 15   (allow a counter refresh interval)
  # fboss2 show interface errors
   Interface Name  Input Errors  Input Discards  Output Errors  Output Discards
  ------------------------------------------------------------------------------------
   eth1/18/1       0             0               0              24096

After fix

  # fboss2 show interface errors
   Interface Name  Input Errors  Input Discards  Output Errors  Output Discards
  ------------------------------------------------------------------------------------
   eth1/18/1       0             0               0              48621

  # fboss2 clear interface counters
  Counters cleared.

  # sleep 15   (allow a counter refresh interval)
  # fboss2 show interface errors
   Interface Name  Input Errors  Input Discards  Output Errors  Output Discards
  ------------------------------------------------------------------------------------
   eth1/18/1       0             0               0              0

@vvasavada-nexthop
vvasavada-nexthop requested a review from a team as a code owner September 8, 2026 17:29
@meta-cla meta-cla Bot added the CLA Signed label Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant