-
Notifications
You must be signed in to change notification settings - Fork 88
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
Document what to do about type bit<0>
values in several situations
#428
Comments
Here is a small P4 program and the P4Info file output by a recent version of the open source p4 compiler to examine, related to this issue: https://github.com/jafingerhut/p4-guide/tree/master/p4runtime/issues/p4runtime-issue-428 |
@jafingerhut re: your two questions, I'd be curious what the answers are for the p4-16 language itself, i.e. why is it allowed and what is the use? |
I have never used a type I have created this issue on the p4-spec repo to see if anyone responds: p4lang/p4-spec#1252 |
I'll try to summarize the conclusions so far:
To repeat the questions posed by Andy:
My vote:
If there is something inherently problematic about formatting such a message, we should reconsider. |
I have not tried it yet, but if someone wants to create a small P4 program with at least one action having a |
@jafingerhut This might be a good example of "micro-projects" which folks in the P4 community might enjoy helping on. I wonder if there is a way to crowdsource such things? |
@smolkaj As discussed in the 2023-Jul-14 meeting, a table with a single key with type |
Thanks Andy for documenting this here -- I agree these are good first things to check. @kheradmandG FYI, these questions could be relevant to you in the context of VLAN modeling. |
This issue should be closed exactly when the bullet item “Added support for 0-width bitstrings and varbits” in Section 1.1 "P4 Language Version Applicability" is addressed and removed.
This issue is a spinoff of issue #389 that focuses on only one new feature in Version 1.2.2 of the P4_16 language spec, the one that allows values with type
bit<0>
to be defined. Open source p4c allows values with that type to be included as fields in structs, headers, be keys of tables, and be parameters of actions, and probably other uses as well.As of 2023-May-06 latest version of p4c:
If you use a field with type
bit<0>
as a key field in a table, the P4Info file has amatch_fields
sub-message for thetables
message for that table, with nobitwidth
field inside, probably because it has value 0 and thus is not printed when showing the text format of the proto message. I did not try to send a P4Runtime table add to such a table to see what happened.Questions:
bit<0>
? I cannot think of any practical benefit to allowing it.If you use a field with type
bit<0>
as a directionless action parameter, the P4Info file hasparams
sub-message of theactions
message for that action with nobitwidth
field, again probably because it has value 0 and is thus not shown in the protobuf message. I did not try to add a table entry with such an action to see what happened.Questions:
bit<0>
? I cannot think of any practical benefit to allowing it.The text was updated successfully, but these errors were encountered: