Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QoS] Fix issue: the WRED profile can not be set if current min > new max or current max < new min #2379

Merged
merged 3 commits into from
Aug 8, 2022

Conversation

stephenxs
Copy link
Collaborator

@stephenxs stephenxs commented Jul 15, 2022

What I did

Fix issue:
Setting a WRED profile can fail in case

  • the current min threshold is greater than the new max threshold
  • or the current max threshold is less than the new min threshold

for any color and at any time.
Eg.

  • Current min=1M, max=2M, new min=3M, new max=4M
  • The min threshold is set first, so current max (2M) < new min (3M), which violates the condition

This is because there can be only one attribute in each SAI SET operation,
which means the vendor SAI does not understand the whole information of the new attributes and can only perform the sanity check against each SET operation.

Signed-off-by: Stephen Sun stephens@nvidia.com

Why I did it

Fix the issue

How I verified it

Manual test and mock test.

Details if related
The fix
The thresholds that have been applied to SAI will be stored in orchagent.

The original logic is to handle each attribute to be set and append it to an attribute list.
To resolve the issue, a deferred attribute list is introduced and will be appended to the original attribute list after all the attributes have been handled.

In the new logic, each threshold to be set will be checked against the stored data.
In case it violates the condition, the violating attribute will be deferred, done via putting it into the deferred attributes list.

For any color, there can be only 1 threshold violating the condition.
Otherwise, it means both new min > old max and new max > old min, which means either old max < old min or new max < new min, which means either old or new data is illegal.
This can not happen because illegal data will not be applied and stored.

By doing so, the other threshold will be applied first, which extends the threshold range and breaks the violating condition.
A logic is also introduced to guarantee the min threshold is always less than the max threshold in the new profile to be set.

For the above example,
In the new logic, the min threshold will be deferred so the new max threshold will be applied first and then the new min is applied. In this flow, there is no violation at any time.

  • min = 1M, max = 2M
  • => min = 1M, max = 4M
  • => min = 3M, max = 4M

…r current max < new min

Signed-off-by: Stephen Sun <stephens@nvidia.com>
Signed-off-by: Stephen Sun <stephens@nvidia.com>
Signed-off-by: Stephen Sun <stephens@nvidia.com>
@stephenxs stephenxs changed the title [Fix issue: the WRED profile can not be set if current min > new max or current max < new min [QoS] Fix issue: the WRED profile can not be set if current min > new max or current max < new min Jul 15, 2022
@stephenxs stephenxs marked this pull request as draft July 15, 2022 02:34
@stephenxs
Copy link
Collaborator Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@stephenxs
Copy link
Collaborator Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@stephenxs stephenxs marked this pull request as ready for review July 18, 2022 09:06
@liat-grozovik
Copy link
Collaborator

@neethajohn , @prsunny could you please help to review?

@liat-grozovik
Copy link
Collaborator

@neethajohn kindly reminder to help review this pr. this is a fix needed for 202205

@liat-grozovik
Copy link
Collaborator

/easycla

@neethajohn neethajohn merged commit 9f2e27b into sonic-net:master Aug 8, 2022
yxieca pushed a commit that referenced this pull request Aug 8, 2022
… max or current max < new min (#2379)

What I did
Fix issue:
Setting a WRED profile can fail in case
the current min threshold is greater than the new max threshold
or the current max threshold is less than the new min threshold
for any color and at any time.

Eg.
Current min=1M, max=2M, new min=3M, new max=4M
The min threshold is set first, so current max (2M) < new min (3M), which violates the condition
This is because there can be only one attribute in each SAI SET operation,
which means the vendor SAI does not understand the whole information of the new attributes and can only perform the sanity check against each SET operation.

Signed-off-by: Stephen Sun stephens@nvidia.com

Why I did it
Fix the issue

How I verified it
Manual test and mock test.

Details if related
The fix
The thresholds that have been applied to SAI will be stored in orchagent.

The original logic is to handle each attribute to be set and append it to an attribute list.
To resolve the issue, a deferred attribute list is introduced and will be appended to the original attribute list after all the attributes have been handled.

In the new logic, each threshold to be set will be checked against the stored data.
In case it violates the condition, the violating attribute will be deferred, done via putting it into the deferred attributes list.

For any color, there can be only 1 threshold violating the condition.
Otherwise, it means both new min > old max and new max > old min, which means either old max < old min or new max < new min, which means either old or new data is illegal.
This can not happen because illegal data will not be applied and stored.

By doing so, the other threshold will be applied first, which extends the threshold range and breaks the violating condition.
A logic is also introduced to guarantee the min threshold is always less than the max threshold in the new profile to be set.

For the above example,
In the new logic, the min threshold will be deferred so the new max threshold will be applied first and then the new min is applied. In this flow, there is no violation at any time.
min = 1M, max = 2M
=> min = 1M, max = 4M
=> min = 3M, max = 4M
@stephenxs stephenxs deleted the fixwred-profile branch August 8, 2022 23:16
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.

5 participants