Limit PFC WD Detection time to maximum value of 1000ms#4306
Open
tirupatihemanth wants to merge 3 commits intosonic-net:masterfrom
Open
Limit PFC WD Detection time to maximum value of 1000ms#4306tirupatihemanth wants to merge 3 commits intosonic-net:masterfrom
tirupatihemanth wants to merge 3 commits intosonic-net:masterfrom
Conversation
Signed-off-by: dprital <drorp@nvidia.com>
Signed-off-by: dprital <drorp@nvidia.com>
Signed-off-by: Hemanth Kumar Tirupati <htirupati@nvidia.com>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates SONiC’s PFC watchdog CLI behavior to cap the configured polling interval at 1000ms (including start_default computation and CLI validation), and extends unit tests to cover scaling behavior across different port counts.
Changes:
- Add
MAX_POLL_INTERVAL_TIME = 1000and use it forpfcwd intervalClick validation. - Cap the
PFC_WD|GLOBAL|POLL_INTERVALvalue produced bystart_defaultto 1000ms. - Add/extend unit tests and expected outputs for 32-port and 512-port scenarios.
- Update
config pfcwd intervalargument validation to a 1000ms max.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
pfcwd/main.py |
Introduces max poll-interval constant, caps start_default poll interval, updates Click range validation. |
config/main.py |
Narrows config pfcwd interval argument range to max 1000ms and documents sync expectations. |
tests/pfcwd_test.py |
Adds new tests to validate start_default behavior for 32-port and 512-port systems. |
tests/pfcwd_input/pfcwd_test_vectors.py |
Adds expected outputs corresponding to the new tests (including poll interval cap). |
Comments suppressed due to low confidence (1)
pfcwd/main.py:430
- The PR title/description talk about capping detection time to 1000ms, but this change only caps the GLOBAL
POLL_INTERVAL.detection_time/restoration_timestill scale withmultiplyand can exceed 1000ms (and even 3000ms on large systems). If the intent is truly to cap detection/restoration times, apply the same cap there; otherwise update the PR title/description (and related comments/tests) to reflect that only the polling interval is capped.
pfc_wd_poll_interval_time = DEFAULT_POLL_INTERVAL * multiply
if pfc_wd_poll_interval_time > MAX_POLL_INTERVAL_TIME:
pfc_wd_poll_interval_time = MAX_POLL_INTERVAL_TIME
pfcwd_info = {
'detection_time': DEFAULT_DETECTION_TIME * multiply,
'restoration_time': DEFAULT_RESTORATION_TIME * multiply,
'action': DEFAULT_ACTION,
8 tasks
dgsudharsan
approved these changes
Feb 26, 2026
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.
Fixing: sonic-net/sonic-buildimage#25033
Should be merged before: sonic-net/sonic-buildimage#25034
What I did
PFC WD Detection time is defined by the following calculation:
DEFAULT_POLL_INTERVAL * multiply
where:
multiply = max(1, (port_num-1)//DEFAULT_PORT_NUM+1)
port_num = len(list(self.config_db.get_table('PORT').keys()))
DEFAULT_POLL_INTERVAL = 200
DEFAULT_PORT_NUM = 32
There is an allowed range for this value which is between 100..3000 [ms].
For system with more than 448 ports, we will violate this range.
In addition, there is no meaning to have detection time of more than 1000[ms], hence, this change limit the maximum detection time for PFC WD to 1000[ms]
How I did it
Calculate PFC WD Detection time, if it become bigger than 1000[ms], set it to 1000[ms]
How to verify it
Run PFC WD Tests on several platforms