Add support for P4_16 header unions #341
Merged
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.
There is a P4_16 proposal to add header unions to the language. This
patch adds support for them in bmv2 and defines the appropriate JSON
input format when using header unions. Having first-class support for
unions in bmv2 allows for easier debugging, with potentially better log
messages.
The most important use of header unions is when using stacks / arrays of
them. This enables writing programs able to serialize / deserialize
TLV-style protocol options (e.g. IPv4 options). Which is why this patch
adds support for stacks of header unions, which actually took the
biggest effort. Header unions and header union stacks are modeled after
header stacks.
The JSON documentation was updated to reflect this change, and the
version number was bumped up to 2.10