Skip to content

[action] [PR:1774] [master] Smart Counter Poll to allow counters to work properly on Broadcom platforms.#1995

Merged
mssonicbld merged 1 commit into
sonic-net:202605from
mssonicbld:cherry/202605/1774
Jul 19, 2026
Merged

[action] [PR:1774] [master] Smart Counter Poll to allow counters to work properly on Broadcom platforms.#1995
mssonicbld merged 1 commit into
sonic-net:202605from
mssonicbld:cherry/202605/1774

Conversation

@mssonicbld

Copy link
Copy Markdown
Collaborator

Summary

This is change is to address #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:
image

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

…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>
@mssonicbld

Copy link
Copy Markdown
Collaborator Author

Original PR: #1774

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@mssonicbld

Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator Author

This cherry pick PR has been opened for more than 3 days. The mssonicbld will attempt to retry.

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown
Collaborator Author

/azpw retry

@mssonicbld

Copy link
Copy Markdown
Collaborator Author

Retrying failed(or canceled) jobs...

@mssonicbld

Copy link
Copy Markdown
Collaborator Author

Retrying failed(or canceled) stages in build 1166288:

✅Stage BuildTrixie:

  • Job armhf: retried.

@mssonicbld
mssonicbld merged commit 16ae1ae into sonic-net:202605 Jul 19, 2026
19 checks passed
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