p4lang / p4runtime

Specification documents for the P4Runtime control-plane API
Apache License 2.0
142 stars 88 forks source link

Add APIs useful for data plane add-on-miss tables for PNA #352

Open jafingerhut opened 3 years ago

jafingerhut commented 3 years ago

In the specification of the Portable NIC Architecture (PNA - https://github.com/p4lang/pna) there is a feature to declare a table as add-on-miss, meaning that if you apply() the table in your P4 program while processing a packet, and a miss occurs, the data plane can add a new entry with the key (exact match only) that was just missed, plus an action and its parameters.

Another new option is the ability of the data plane to delete old entries after they have not been matched for a configurable length of time, similar to the existing idle timeout feature, except that the control plane need not be notified, and the data plane will delete the entries without the control plane having to do so.

It is still desirable to allow the control plane to read entries of such a table. In a programmable NIC context, some tables would be so large that pagination APIs may become more important (see separate issue https://github.com/p4lang/p4runtime/issues/360 for that topic).

I have heard that some people implementing such add-on-miss tables would prefer to implement them in such a way that the control plane CANNOT add, modify, or delete entries, i.e. only the data plane could do so. It would be good to document that some implementers might not implement these operations on such tables. Even if a device implementer DOES implement these operations, note that it is possible for sequences like the following to occur, and control plane authors and P4Runtime API implementers would need to plan for these possibilities:

Other possibly useful control plane APIs include:

There may be other control plane API capabilities that would be useful to introduce here, too. The above is an initial list to get the discussion going. I will invite some other interested parties to add more to the list, if they have thought of any.

jafingerhut commented 3 years ago

Another possibility: reading large tables via a kind of pagination API, e.g. controller reads first 10,000 entries, then sends another request to get the next 10,000 entries, etc. This of course raises questions about what kinds of guarantees the read results represent (e.g. should they represent a consistent snapshot of the entire table at one point in time, or not? If not, are there any guarantees made at all?). EDIT: I created a separate issue https://github.com/p4lang/p4runtime/issues/360 for the pagination proposal, in hopes that the extensions raised on this issue can make more rapid progress independently of the pagination ideas, which I expect will involve quite a bit of thinking and discussion.

Note that I believe all of these proposals for extensions to P4Runtime API make sense to implement even for a target device that does not implement these new P4 tables where the data plane can add new entries without the controller requesting it.

jafingerhut commented 3 years ago

AI Andy: Ask Sayan if he is interested in collaborating on writing a proposal of specific changes to the protobuf messages for all of these API additions except the pagination one.

jfingerh commented 1 year ago

@jameschoi I will ping you on several public p4runtime issues to call your attention to them. For others, sorry for the comment noise.