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

Improve P4Runtime Value Set support #156

Closed

Conversation

antoninbas
Copy link
Member

The objectives of this change is to:

  • cover more cases supported by the P4_16 spec
  • provide more intuitive runtime programming
  • be more future-proof to reduce the potential changes in future
    P4Runtime versions

In particular, we now support structs with bit members as the type
parameter for value_set. The members of the struct may have different
match types.

Fixes #135
Fixes #134

The objectives of this change is to:
 * cover more cases supported by the P4_16 spec
 * provide more intuitive runtime programming
 * be more future-proof to reduce the potential changes in future
   P4Runtime versions

In particular, we now support structs with bit<W> members as the type
parameter for value_set. The members of the struct may have different
match types.

Fixes p4lang#135
Fixes p4lang#134
@antoninbas antoninbas requested a review from jafingerhut January 8, 2019 02:35
@antoninbas
Copy link
Member Author

@jafingerhut please take a look, if it passes your review I'll add more people :)

match {
id: 1
bitwidth: 8
match_type: EXACT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the match_type message be nested inside of a match message, that is itself inside of the match message of line 1472?

match {
id: 1
bitwidth: <ETH_TYPE_BITWIDTH>
match_type: EXACT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above on match_type being inside of another match message

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other match message here is a oneof. It doesn't actually create a level of nesting, which is why the field numbering doesn't get a new scope. It is not exactly like a C union. What it means is that when serializing the message, at most one of the fields will be present.

@antoninbas
Copy link
Member Author

@jafingerhut Thanks for the comments. Do you see any logical issue with the new approach?

@jafingerhut
Copy link
Contributor

@antoninbas I see no logical problems with any of this. Only the small issues I've already raised. Everything else looks good, and I will approve it. Definitely good to review with others, too, of course.

Copy link
Contributor

@jafingerhut jafingerhut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@antoninbas
Copy link
Member Author

Thanks. I'll move this to a new PR (I mistakenly created this one from my fork) and invite others to comment.

@antoninbas
Copy link
Member Author

Replaced by #157

@antoninbas antoninbas closed this Jan 8, 2019
@antoninbas antoninbas deleted the antonin/improve-value-set-support branch January 8, 2019 21:43
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