[sai-gen] Add P4 counter parsing support in SAI generation script and remove mock counter attributes in DASH pipeline#492
Merged
r12f merged 6 commits intosonic-net:mainfrom Jan 3, 2024
Conversation
Collaborator
Author
|
Hi @chrispsommers , this is the change I mentioned in #489 which improves SAI API generation for counters. |
483de6b to
77c8557
Compare
chrispsommers
approved these changes
Dec 26, 2023
chrispsommers
requested changes
Dec 26, 2023
Collaborator
chrispsommers
left a comment
There was a problem hiding this comment.
Need to fix CI failures.
Collaborator
Author
|
Thanks a lot Chris! And Merry Christmas! |
Collaborator
Author
|
CI is passed. Happy new year, @vijasrin ! Do you have any comments on this PR? If not, I will merge the change in. :D |
kcudnik
approved these changes
Jan 3, 2024
Collaborator
Author
|
thanks Kamil for reviewing it as well! since no more comments, I have the PR merged now. |
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.
Problem
Today, how DASH generates SAI API for counters is via mock action parameters.
One example is shown as below, where the counters are not updated by the meter_bucket_action, however we need to generate SAI APIs for fetching these counters. Hence, 2 action parameters that is marked as readonly are added for this purpose.
However, this creates 2 problems:
Solution
This change adds counter parsing support in the SAI generation script, which,
Then we use this info to generate the correct SAI headers and libsai. Here is the P4 code after this change, the unused action parameters can be removed:
As the diff shows below, we will be able maintain the SAI header unchanged, also removing the unwanted code in libsai:
Future works
As we will be adding more counters later, for features like HA. This will become particularly helpful, since we don't have to abuse the action parameters with unused code anymore.