[YANG] Fix QoS scheduler validation for PIR-only configurations - #29314
Open
yizhenzha wants to merge 1 commit into
Open
[YANG] Fix QoS scheduler validation for PIR-only configurations#29314yizhenzha wants to merge 1 commit into
yizhenzha wants to merge 1 commit into
Conversation
Remove the rule that rejects PIR when CIR is absent, and make the PIR >= CIR comparison conditional on CIR being configured. CIR and PIR map to independent SAI scheduler attributes (minimum and maximum bandwidth rate respectively) and are not required to be configured together; requiring a dummy CIR for a PIR-only profile (e.g. a port egress shaper) is not appropriate, and some SAI implementations reject a minimum bandwidth rate on a port-bound scheduler. Update SCHEDULER_PIR_NO_CIR to expect success now that pir no longer requires cir. Add SCHEDULER_PIR_ONLY_PORT_SHAPER covering the port-shaper use case (STRICT scheduler with pir only), and SCHEDULER_PIR_EQUAL_CIR covering the pir == cir boundary when both are configured. Signed-off-by: Yizhen Zhang <evazha@nvidia.com>
yizhenzha
requested review from
dgsudharsan,
praveen-li,
qiluo-msft and
venkatmahalingam
as code owners
September 2, 2026 21:27
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
dgsudharsan
approved these changes
Sep 2, 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.
Why I did it
The current
sonic-scheduler.yangmodel requires CIR whenever PIR is configured. This incorrectly prevents valid PIR-only scheduler profiles, including profiles used for port egress shaping. CIR and PIR should only come in pair in a theoretical two rate policer model, which is not exactly how SONiC QoS scheduler is implemented at runtime.At runtime, SONiC maps CIR and PIR to separate SAI scheduler attributes:
These rates can be configured independently. CIR-only provides a minimum bandwidth allocation without a local maximum, while PIR-only provides a maximum shaping rate without a minimum bandwidth guarantee.
Requiring a dummy CIR for a PIR-only profile is not an appropriate workaround. Some SAI implementations do not support a minimum bandwidth rate on a port-bound scheduler and reject such a configuration.
The YANG model should therefore allow CIR and PIR to be absent or configured independently. When both values are present, PIR must still be greater than or equal to CIR.
How I did it
PIR >= CIRvalidation conditional on CIR being present.PIR < CIR.The resulting behavior is:
PIR >= CIRPIR < CIRHow to verify it
Which release branch to backport (provide reason below if selected)
Tested branch
Description for the changelog
Allow CIR and PIR to be configured independently in SONiC scheduler profiles.
Link to config_db schema for YANG module changes
https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md#scheduler