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

Use P4Runtime info file for a P4 program to get tableonly and defaultonly attributes #97

Open
jafingerhut opened this issue Oct 26, 2018 · 1 comment

Comments

@jafingerhut
Copy link
Contributor

I believe that right now, the BMv2 JSON file has no representation of the defaultonly and tableonly attributes in P4 source code. These can be used to annotate the list of actions for a table. See the P4_16 language spec, but basically defaultonly means that the action cannot be used as an action for a normal table entry, only as the default action. Similarly tableonly means that the action cannot be used as the default action, only as an action for an installed table entry.

Related issue: p4lang/behavioral-model#676

This knowledge could be used by p4pktgen to avoid considering execution paths with disallowed actions. Right now I believe it has no such information available to it, and so considers all actions of a table for both normal table entries, and as a possible default action.

@jafingerhut jafingerhut changed the title Enhancement: use P4Runtime info file for a P4 program to get tableonly and defaultonly attributes Use P4Runtime info file for a P4 program to get tableonly and defaultonly attributes Oct 26, 2018
@jafingerhut
Copy link
Contributor Author

Attaching a small test program for which latest current version of p4pktgen on hybrid_packet branch generates 6 SUCCESS paths. 4 of them are correct. 2 of them should never have been considered by p4pktgen, if it had the information about the @tableonly and @defaultonly attributes of the actions on the table, and took them into account.

Probably the most straightforward way for p4pktgen to learn about these attributes is to read not only the BMv2 JSON file, but also the P4Runtime info file, perhaps the JSON one generated via a command like p4c --target bmv2 --arch v1model --p4runtime-file impossible1.p4rt.json --p4runtime-format json impossible1.p4

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

No branches or pull requests

1 participant