Closed r12f closed 8 months ago
Hi @chrispsommers , this is the change I mentioned in #489 which improves SAI API generation for counters.
Thanks a lot Chris! And Merry Christmas!
CI is passed. Happy new year, @vijasrin ! Do you have any comments on this PR? If not, I will merge the change in. :D
thanks Kamil for reviewing it as well! since no more comments, I have the PR merged now.
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.