[action] [PR:1774] [master] Smart Counter Poll to allow counters to work properly on Broadcom platforms.#1995
Merged
Conversation
…adcom platforms. #### Summary This is change is to address sonic-net#1753 and the master implementation of the HLD added in sonic-net/SONiC#2190. `FlexCounter.cpp` assumes all ports support the same counter capabilities. This causes issues on most Broadcom platform switches as there are different types of ports on a switch that does not support the same set of counters. Fix by dynamically discovering what each interface is capable of during initialization of `syncd`. For more detials please refer to the above issue and HLD. #### Testing Master testing is also done, but due to frequent changes in master tests fail on other issues depending which commit is used for testing. However, none of the issues seem related to this change. More comprehensive testing is done on the 202511 stable branch: Testing is done on both a `Arista-7060X6-16PE-384C-B-O128S2` and `Arista-7260CX3-D108C8` on 202511 with the tests: ``` sonic-mgmt/tests/dhcp_relay/test_dhcp_counter_stress.py sonic-mgmt/tests/drop_packets/test_drop_counters.py sonic-mgmt/tests/drop_packets/test_configurable_drop_counters.py sonic-mgmt/tests/gnmi/test_gnmi_countersdb.py sonic-mgmt/tests/snmp/test_snmp_queue_counters.py ``` A full `sonic-mgmt` test suite run has also been ran (202511). There are no notable fallout compared to `sonic-mgmt` runs without this change. This is ran on both XGS and DNX Broadcom platforms. **EDIT: Jul 13, 2026** **202605 Testing** Additional 202605 testing has been done. Comparing full 202605 `sonic-mgmt` test results on TH5 (using `Arista-7060X6-64PE`) with and without these changes, there is no difference in the test results. #### Performance Impact: All logic change is only done in the counter initialisation stage of FlexCounters.cpp - there is no polling logic change at all. **Therefore, any performance impact is limited to any new execution of `syncd` - i.e. reboot / `config reload` / `systemctl restart`.** Tested on several topologies: <img width="2949" height="643" alt="image" src="https://github.com/user-attachments/assets/54e34bbc-8d8d-4a24-91e4-b9dbb14562ab" /> This impact seems reasonable for what this offers. The fastest operation that would cause a `syncd` restart is a `systemctl restart swss`, that is a operation that spans minutes. The worst real life scenario on a HwSKU with older CPU and many interfaces takes additional ~17 seconds. New, high interface-count HwSKUs only takes an extra ~2 seconds. As for memory usage - the impact is on the order of kilobytes, the impact is negligible as the system has GBs of RAM. Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
Collaborator
Author
|
Original PR: #1774 |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Collaborator
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Collaborator
Author
|
This cherry pick PR has been opened for more than 3 days. The mssonicbld will attempt to retry. ---Powered by SONiC BuildBot
|
Collaborator
Author
|
/azpw retry |
Collaborator
Author
|
Retrying failed(or canceled) jobs... |
Collaborator
Author
|
Retrying failed(or canceled) stages in build 1166288: ✅Stage BuildTrixie:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is change is to address #1753 and the master implementation of the HLD added in sonic-net/SONiC#2190.
FlexCounter.cppassumes all ports support the same counter capabilities. This causes issues on most Broadcom platform switches as there are different types of ports on a switch that does not support the same set of counters.Fix by dynamically discovering what each interface is capable of during initialization of
syncd.For more detials please refer to the above issue and HLD.
Testing
Master testing is also done, but due to frequent changes in master tests fail on other issues depending which commit is used for testing. However, none of the issues seem related to this change.
More comprehensive testing is done on the 202511 stable branch:
Testing is done on both a
Arista-7060X6-16PE-384C-B-O128S2andArista-7260CX3-D108C8on 202511 with the tests:A full
sonic-mgmttest suite run has also been ran (202511). There are no notable fallout compared tosonic-mgmtruns without this change. This is ran on both XGS and DNX Broadcom platforms.EDIT: Jul 13, 2026
202605 Testing
Additional 202605 testing has been done.
Comparing full 202605
sonic-mgmttest results on TH5 (usingArista-7060X6-64PE) with and without these changes, there is no difference in the test results.Performance Impact:
All logic change is only done in the counter initialisation stage of FlexCounters.cpp - there is no polling logic change at all.
Therefore, any performance impact is limited to any new execution of
syncd- i.e. reboot /config reload/systemctl restart.Tested on several topologies:

This impact seems reasonable for what this offers.
The fastest operation that would cause a
syncdrestart is asystemctl restart swss, that is a operation that spans minutes. The worst real life scenario on a HwSKU with older CPU and many interfaces takes additional ~17 seconds. New, high interface-count HwSKUs only takes an extra ~2 seconds.As for memory usage - the impact is on the order of kilobytes, the impact is negligible as the system has GBs of RAM.
Signed-off-by: Sonic Build Admin sonicbld@microsoft.com