-
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
Enhancements to P4Runtime API for P4 table "initial entries" proposal #426
Comments
Updated status, this PR has now been merged into the language spec, and it seems likely that version 1.2.4 of the spec will be released within a week or so from now: p4lang/p4-spec#1180 |
Background information on This comment describes p4c output when a table has Here is a test program for p4c that was first added 2017-Mar-15: https://github.com/p4lang/p4c/blob/main/testdata/p4_16_samples/table-entries-ternary-bmv2.p4#L64-L70 When you run
Note: The The command above writes not only a P4Info file to tmp/p4info.txt, but it also writes a file named tmp/entries.txt containing a sequence of P4Info WriteRequest messages that, if the table was NOT declared with Here are already checked-in versions of these output files for quick reference, used in the automated p4c CI tests to compare p4test's actual output files against these expected contents: P4Info file: https://github.com/p4lang/p4c/blob/main/testdata/p4_16_samples_outputs/table-entries-ternary-bmv2.p4.p4info.txt Note that for this test P4 program, the table with Note also that the P4Info file has the attribute Reference in P4Info protobuf definition file: https://github.com/p4lang/p4runtime/blob/main/proto/p4/config/v1/p4info.proto#L220-L221 |
Some comments and questions about how to implement the new support for Today tables with It does seem reasonable to introduce a new way to "mark" that such a table has been declared with The contents of the entries file written today as described in this comment #426 (comment) seems like a perfectly good format for tables with non-const One way to specify the presence or absence of that For the contents of the entries file, that is a very simple generalization to make, and the meaning seems like it should be clear. Such a new TableEntry attribute is also useful when reading entries of a table, because when reading a table declared with That does raise the question of what the server should do if the client attempts to INSERT/MODIFY/DELETE a TableEntry with It should always be an error to attempt to modify or delete an entry that has It should be supported to insert new entries into a table with the Except for priority values (discussed in a later comment below), I think these two changes in P4Runtime proto files would enable implementing this new feature. |
There are two ways to specify numeric priority values described by this new feature. The default is The other is if the P4 developer explicitly chooses to write One way to implement this is: for an entry in the P4 source code determine to have priority value P, write to the entries file the priority value (M-P), where M is some maximum supported priority value (perhaps M=2^32 or M=2^32-1 ?) |
+1 for this
@jafingerhut This is a reasonable proposal, although this is a rather longish name. +1 for all the other verbiage describing usage, error-handling, etc. |
Yeah, a shorter name would be good. |
I was thinking the same, and the existing
The third row is interesting and corresponds to the current standard: a true value of
Thoughts? |
My intended meaning of this new attribute is that your second table would list all of the valid combinations. That has the best backwards compatibility, in that I think a table like that in the P4Runtime spec would make it clear, regardless of the name of the new table property. |
Question raised by Sayan: What if a table declares In addition to the questions above:
|
Whenever this issue is resolved, this issue for p4c should be addressed: p4lang/p4c#4016 |
2023-Aug-08 status of this issue: #432 has several approvals from key people involved, and I hope that it can be merged in during or very soon after the next P4 API work group meeting on 2023-Aug-11.
As of version 1.2.4 of the P4_16 language spec, this PR was merged, enabling P4 programs to specify a list of initial entries in a table, but the runtime is still able to add new entries later during runtime, or to modify or delete any individual entries not marked
const
: p4lang/p4-spec#1180On 2023-Jun-07, a partial implementation of this feature has been merged into the open source p4c compiler here: p4lang/p4c@b80b2cb
I say that it is a partial implementation, because for tables with initial entries, it does not mark those tables in P4Info in any way to distinguish them as having initial entries, which is probably desirable to do in some way, and it does not distinguish in the "entries" output file between const vs. non-const entries yet. How to do those things are part of the subject of this issue. When those are decided upon by the P4 API work group, then this p4c issue should be resolved with appropriate changes to the P4Runtime generation code in p4c: p4lang/p4c#4016
This proposed PR on the P4Runtime spec has several TODO items in it that should be discussed and agreed upon in the P4 API work group, in order for it to proceed forward: #432. (alternately, some other PR that addresses this issue in some other way should be created and merged in)
Today,
const entries
descriptions of table entries are written by p4c front/mid end to a file of entries. None of those contain a priority, nor do they contain a per-entryconst
qualifier. The 'initial entries' approach will likely need extra properties on each entry for those.There may be interesting questions of what the various SetForwardingPipelineConfig options should do with initial entries, that never arose with
const entries
, because the answer forconst entries
was "they are always there, no matter what". Initial entries are defined to be there when you initially load the P4 program, but what if the same program is reloaded? Should the entries of that table be reinitialized back to what the source code says? Or should they be left as they currently are? Or should there be multiple options that let the controller choose?The text was updated successfully, but these errors were encountered: