Add per-port counter discovery toggle argument - #2000
Conversation
Add an argument to toggle the per-port counter discovery feature in syncd_init_common.sh Signed-off-by: Justin Wong <jvwong@arista.com>
|
/azp run |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Signed-off-by: Justin Wong <jvwong@arista.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Signed-off-by: Justin Wong <jvwong@arista.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Signed-off-by: Justin Wong <jvwong@arista.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
lolyu
left a comment
There was a problem hiding this comment.
Overall this is a clean, well-scoped change and the default-false gating is the right call given #1774's platform regressions. A few comments below — the main substantive one is the removal of the exception-based fallback. Not blocking, leaving as COMMENT.
1. Removal of the try/catch fallback (main question). Previously the code tried addObjectWithCounterGroups and fell back to addObject on exception. With this change, when -G is enabled there is no longer any exception fallback — a throw from per-port discovery now propagates instead of degrading gracefully. If that's intentional (opt-in only for platforms known to work), please call it out explicitly in the PR/commit so it's clear the fallback was removed deliberately, not accidentally.
2. Repeated dynamic_pointer_cast on hot paths. addCounter/bulkAddCounter now do getOptions + dynamic_pointer_cast<VendorSaiOptions> on every invocation. Consider resolving the bool once (e.g. at FlexCounter construction) to avoid the repeated cast. Minor / non-blocking.
3. Backport / part-2 dependency. PR notes this is "part 1 of 2" and needs backport to 202605. Worth confirming part 2 (the actual per-port fix) lands before -G is flipped on in production, since this arg alone is inert.
Ack, added to PR description
Leaving it as is as adding the initialization to
Yes |
|
Reminder this needs backport to 202605. |
|
This PR has backport request label(s) for branch(es): 202605, but is missing required test information. Please make sure you tick the tested branch(es) in the Tested branch section and provide test evidence (e.g., 202605: <test result>) in the Test result section as well in your PR description. ---Powered by SONiC BuildBot
|
|
The change is not in 202605 yet. @justin-wong-ce, please manually create the cherry pick PR for branch 202605. ---Powered by SONiC BuildBot
|
Ack |
|
Cast PR created:
|
…2001) Approach What is the motivation for this PR? In #1774 , a new counter support discovery method is introduced for being able to read counter support for platforms where different ports can have different capabilities. The method worked well for some platforms, not so much for some others. This change auto-uses the new syncd arg enablePerPortCounterDiscovery (introduced in #2000) when the broadcom ASIC type is detected in syncd_init_common.sh. Work item tracking Microsoft ADO (number only): How did you do it? Add logic in syncd_init_common.sh to auto apply the syncd arg when broadcom ASIC type is detected. How did you verify/test it? syncd unit tests pass on master and on 202605. On physical hardware, an image is built with the changes cherry-picked to 202605 and tests are ran in 2 scenarios: With the change as is syncd_init_common.sh hotpatched to filter on another asic type. In both scenarios, syncd enters the expected code path. Additionally, a subset of counters-focused sonic-mgmt tests are ran. There is no test result difference compared to tests done without this change. Tests were ran on Arista-7260CX3-D108C8 and Arista-7060X6-64PE-B-C512S2. The list of sonic-mgmt tests ran: test_pretest.py dhcp_relay/test_dhcp_counter_stress.py drop_packets/test_drop_counters.py drop_packets/test_configurable_drop_counters.py gnmi/test_gnmi_countersdb.py snmp/test_snmp_queue_counters.py test_posttest.py To ensure no warm and fast reboot issues from any potential time increase from syncd, some reboot-related tests are also ran. The following sonic-mgmt tests pass with this change casted, tested on Arista-7260CX3-D108C8 and Arista-7060CX-32S-C32: platform_tests/test_advanced_reboot.py::test_warm_reboot_sad* platform_tests/test_advanced_reboot.py::test_warm_reboot_mac_jump platform_tests/test_advanced_reboot.py::test_warm_reboot platform_tests/test_advanced_reboot.py::test_fast_reboot Any platform specific information? Broadcom
Approach What is the motivation for this PR? In #1774 , a new counter support discovery method is introduced for being able to read counter support for platforms where different ports can have different capabilities. The method worked well for some platforms, not so much for some others. This change applies the new syncd arg enablePerPortCounterDiscovery (introduced in #2000) when enable_per_port_counter_discovery is populated as true in SYNCD_VARS, which is retrieved from DEVICE_METADATA in CONFIG_DB. Work item tracking Microsoft ADO (number only): How did you do it? Add logic in syncd_init_common.sh to apply the syncd arg enablePerPortCounterDiscovery when it is defined as so in SYNCD_VARS. How did you verify/test it? syncd unit tests pass on master and on 202605. On physical hardware, an image is built with the changes cherry-picked to 202605 and tests are ran in 6 scenarios: 1): ASIC check: use arg on broadcom HWSKU config: not defined Result: per-port counter discovery code path used 2): ASIC check: use arg on broadcom HWSKU config: enable_per_port_counter_discovery set to true Result: per-port counter discovery code path used 3): ASIC check: use arg on broadcom HWSKU config: enable_per_port_counter_discovery set to false Result: legacy code path used 4): ASIC check: use arg on mellanox HWSKU config: not defined Result: legacy code path used 5): ASIC check: use arg on mellanox HWSKU config: enable_per_port_counter_discovery set to true Result: per-port counter discovery code path used 6): ASIC check: use arg on mellanox HWSKU config: enable_per_port_counter_discovery set to false Result: legacy code path used In all 6 scenarios, syncd enters the expected code path. Additionally, a subset of counters-focused sonic-mgmt tests are ran. There is no test result difference compared to tests done without this change. Tests were ran on Arista-7260CX3-D108C8. The list of sonic-mgmt tests ran: test_pretest.py dhcp_relay/test_dhcp_counter_stress.py drop_packets/test_drop_counters.py drop_packets/test_configurable_drop_counters.py gnmi/test_gnmi_countersdb.py snmp/test_snmp_queue_counters.py test_posttest.py Any platform specific information? Broadcom
Description of PR
Summary:
Add an argument to
syncdto toggle between the new per-port counter discovery feature inFlexCounteror to use the legacy method.This is a part 1 of 2 fix in addressing sonic-net/sonic-buildimage#28460. There are two fix methods under consideration, this part is generic to both methods.
Fixes # (issue)
Partially Fixes sonic-net/sonic-buildimage#28460
Needs backport to 202605.
Type of change
Approach
What is the motivation for this PR?
In #1774 , a new counter support discovery method is introduced for being able to read counter support for platforms where different ports can have different capabilities.
The method worked well for some platforms, not so much for some others.
This change adds an argument to
syncdso there is the capability to toggle the per-port counter discovery. The argument will default tofalseso the legacy code path is used by default.Since there is now an option to toggle the code path on or off, there is no longer a need for a runtime fallback.
Work item tracking
How did you do it?
Add an argument to
syncdas well as the logic needed to read the argument in various files insyncd.Unit tests are also updated to account for the new argument, as well as mocking the use of this argument for unit tests that only test for per-port discovery logic.
How did you verify/test it?
Unit tests passes on both master and with the change casted to 202605.
syncdis also able to boot on physical hardware and enter the expected code path based on whether the argument was provided for launch or not.Any platform specific information?
Generic
Documentation