-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sai-gen] Make SAI generator understand P4 IR to fetch counter refere…
…nces / callers. (#499) ## Problem Currently, the SAI attributes will be generated from table keys, action parameters and counters. Table keys and action parameters are naturally connected to the tables directly or indirectly in the P4 runtime json. However, counters are not, so we don't have enough information to find which SAI API we should add the attribute. To solve this, we have already added an annotation in SaiCounter, to specify the action names, so we can correlate the counters and its tables. However, this is tedious to do, if we have a lot of counters to add. ## What are we doing in this change This change parses the P4 IR json file to find which action this counter has been called to, so we can associate the counters and its action and tables automatically. Take an example, say we add a new counter in the metering action to calculate total bytes: ![image](https://github.com/sonic-net/DASH/assets/1533278/30762751-c5ce-4550-8151-d0d87c73da75) And without specifying the action names, like the other counters, the SAI attribute will be generated in the right place, because we now understand the program. ![image](https://github.com/sonic-net/DASH/assets/1533278/dc29db67-5bcb-4dec-9142-aaa1fbbc8a40) We choose the P4 IR as the input instead of the bmv2 json, because this approach is backend independent, and can apply to other backends too, such as dpdk, p4tc and etc, just like the p4 runtime json. So, if we decide to change our BM from BMv2 to other implementation, this program will still work. This change will help us add more counter for future scenarios, such as HA.
- Loading branch information
Showing
3 changed files
with
158 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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