-
Notifications
You must be signed in to change notification settings - Fork 100
Description
The current SAI API code generator https://github.com/Azure/DASH/blob/main/dash-pipeline/SAI/sai_api_gen.py reads the P4Info (derived from dash-pipeline.p4) and emits SAI header (.h) files. Some of the transformations are a bit involved and contain hidden assumptions, and the P4 code does not explicitly show the relationships between P4 and SAI headers, for example when is a SAI attribute mandatory. Using annotations would allow the P4 code to explicitly declare, for example, the SAI table name, or identify a mandatory SAI attribute. Using attributes would also greatly simplfy the code generator, since it would only have to do simple transformations without lots of special-case code.
This idea was originally suggested here: #240 (comment)
A sample experimental annotation is provided below. You can compile the P4 code using make p4 and read the resulting P4Info file dash-pipeline/bmv2/dash_pipeline.bmv2/dash_pipeline_bmv2_p4rt.txt in your build environment.