Skip to content

skip pfcwd if disabled in golden_config#3880

Merged
r12f merged 2 commits intosonic-net:masterfrom
sdszhang:disable_pfcwd_th5
May 14, 2025
Merged

skip pfcwd if disabled in golden_config#3880
r12f merged 2 commits intosonic-net:masterfrom
sdszhang:disable_pfcwd_th5

Conversation

@sdszhang
Copy link
Contributor

@sdszhang sdszhang commented May 12, 2025

Skip pfcwd config if it's disabled in golden config

In sudo config load_minigraph --override_config -y, it will call pfcwd start_default by default.

Running command: /usr/local/bin/sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --write-to-db
......
Running command: pfcwd start_default
Running command: config override-config-table /etc/sonic/golden_config_db.json

When golden_config_db.json has "default_pfcwd_status": disable, pfcwd should not be generated in the config.
However, in current code, when pfcwd start_default is called, the default_pfcwd_status is still using the value in init_cfg.json which is enable. So, pfcwd configuration is still generated even though it's not needed.

What I did

Disable default_pfcwd_status for all lossy platform.

How I did it

Check default_pfcwd_status in golden_config_db.json and skip pfcwd start_default if it's disabled.

How to verify it

Run deploy-mg on all lossy platform

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@sdszhang sdszhang changed the title skip pfcwd start_default if disabled in golden_config skip pfcwd if disabled in golden_config May 12, 2025
r12f
r12f previously approved these changes May 13, 2025
config/main.py Outdated
# If pfcwd is disabled in the golden config, skip starting pfcwd
# This is needed for platform which doesn't support lossless traffic.
device_metadata = config_to_check.get('DEVICE_METADATA', {})
default_pfcwd_status = device_metadata.get('localhost', {}).get('default_pfcwd_status')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if 'default_pfcwd_status' is None, next step will still start pfcwd

Copy link
Contributor Author

@sdszhang sdszhang May 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If default_pfcwd_status is not defined in golden config, it falls back to current default behavior.

Current behavior is to run 'pfcwd start_default' directly without any check. so it will be called even if default_pfcwd_status is None. Although, it's unlikely to happen. This PR prefers to keep the behavior unchanged. We can change this behavior in the future if we see some issue or use cases.

With this PR, the only behavior change is when default_pfcwd_status in 'init_cfg.json' is enable or None, but golden config is disable. In this case, old behavior was to do pfcwd start_default, new behavior is to skip it.

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@sdszhang
Copy link
Contributor Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@r12f r12f merged commit 5db13c2 into sonic-net:master May 14, 2025
7 checks passed
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to msft-202412: Azure/sonic-utilities.msft#178

r12f pushed a commit to Azure/sonic-mgmt.msft that referenced this pull request May 15, 2025
<!--
Please make sure you've read and understood our contributing guidelines;
https://github.com/sonic-net/SONiC/blob/gh-pages/CONTRIBUTING.md

Please provide following information to help code review process a bit
easier:
-->
### Description of PR
<!--
- Please include a summary of the change and which issue is fixed.
- Please also include relevant motivation and context. Where should
reviewer start? background context?
- List any dependencies that are required for this change.
-->

Summary:
Update default_pfcwd_status to disable for some platform which only have
lossy traffic.

Note: This PR needs the image fix
sonic-net/sonic-utilities#3880 for it to work.

### Type of change

<!--
- Fill x for your type of change.
- e.g.
- [x] Bug fix
-->

- [ ] Bug fix
- [ ] Testbed and Framework(new/improvement)
- [ ] New Test case
    - [ ] Skipped for non-supported platforms
- [ ] Test case improvement


### Back port request
- [ ] 202012
- [ ] 202205
- [ ] 202305
- [ ] 202311
- [ ] 202405
- [x] 202412

### Approach
#### What is the motivation for this PR?
Update the default pfcwd status in golden_config for lossy platform

#### How did you do it?
Update the default pfcwd status in golden_config for lossy platform

#### How did you verify/test it?
Verified on physical platform. 

#### Any platform specific information?

#### Supported testbed topology if it's a new test case?

### Documentation
<!--
(If it's a new feature, new test case)
Did you update documentation/Wiki relevant to your implementation?
Link to the wiki page?
-->
nmoray pushed a commit to nmoray/sonic-utilities that referenced this pull request Jun 25, 2025
## Skip pfcwd config if it's disabled in golden config

In `sudo config load_minigraph --override_config -y`,  it will call `pfcwd start_default` by default.
```
Running command: /usr/local/bin/sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --write-to-db
......
Running command: pfcwd start_default
Running command: config override-config-table /etc/sonic/golden_config_db.json
```

When golden_config_db.json has `"default_pfcwd_status": disable`, pfcwd should not be generated in the config.
However, in current code, when `pfcwd start_default` is called, the `default_pfcwd_status` is still using the value in `init_cfg.json` which is `enable`.  So, pfcwd configuration is still generated even though it's not needed.

#### What I did
Disable default_pfcwd_status for all lossy platform.

#### How I did it
Check `default_pfcwd_status` in `golden_config_db.json` and skip `pfcwd start_default` if it's disabled.

#### How to verify it

Run deploy-mg on all lossy platform

#### Previous command output (if the output of a command-line utility has changed)

#### New command output (if the output of a command-line utility has changed)
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.

4 participants