Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for P4_16 header unions #341

Merged
merged 1 commit into from
Apr 27, 2017
Merged

Conversation

antoninbas
Copy link
Member

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

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
@codecov-io
Copy link

codecov-io commented Apr 27, 2017

Codecov Report

Merging #341 into master will increase coverage by 0.64%.
The diff coverage is 85.46%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #341      +/-   ##
==========================================
+ Coverage    75.8%   76.44%   +0.64%     
==========================================
  Files         105      108       +3     
  Lines        8271     8607     +336     
==========================================
+ Hits         6270     6580     +310     
- Misses       2001     2027      +26
Impacted Files Coverage Δ
include/bm/bm_sim/core/primitives.h 50% <ø> (ø) ⬆️
include/bm/bm_sim/parser.h 100% <ø> (ø) ⬆️
include/bm/bm_sim/actions.h 29.5% <ø> (ø) ⬆️
include/bm/bm_sim/headers.h 85.18% <ø> (ø) ⬆️
include/bm/bm_sim/expressions.h 100% <ø> (ø) ⬆️
include/bm/bm_sim/P4Objects.h 87.09% <ø> (ø) ⬆️
include/bm/bm_sim/phv.h 100% <100%> (ø) ⬆️
include/bm/bm_sim/stacks.h 100% <100%> (ø)
src/bm_sim/header_unions.cpp 100% <100%> (ø)
src/bm_sim/headers.cpp 100% <100%> (ø) ⬆️
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 55b2b04...d561c38. Read the comment docs.

@antoninbas antoninbas merged commit 593026c into master Apr 27, 2017
@antoninbas antoninbas deleted the header-unions-support branch April 27, 2017 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants