-
Notifications
You must be signed in to change notification settings - Fork 80
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
Alternate design of preserving metadata in PSA #757
base: main
Are you sure you want to change the base?
Alternate design of preserving metadata in PSA #757
Conversation
It is not completely different, but it does avoid many of the "extra" parameters to the parsers and deparsers for carrying metadata. Instead it introduces many extra control blcoks, each with a provided "empty" or "no op" implementation, that contains the "packing" and "unpacking" code that in PSA v1.1 are in the parsers and deparsers.
@cc10512 This is not intended to be merged any time soon (and perhaps never). It is a somewhat fleshed-out look at what several of the PSA programs would change to with the idea I had for a slightly different way of handling preserved metadata. |
p4-16/psa/psa.p4
Outdated
RecirculateUnpacker<IM, RECIRCM> rcu, | ||
NormalPacker<IH, IM, NM> np, | ||
ResubmitPacker<IH, IM, RESUBM> rsp, | ||
CloneI2EPacker<IH, IM, CI2EM> ci2ep); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the direction. The one improvement that I would suggest is to make these additional controls optional, or simply provide a default empty control implementation, such that a P4 program that does not need them, does not refer to them at all. I believe the named arguments support that we currently have in the compiler is almost there.
BTW, I assume this is what we'll discuss later today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is what I planned to talk with you about later today.
There are default "empty" packer/unpacker implementations in the propose psa.p4 include file changes, and those are used in the example programs I updated.
I did try to make these additional package variables optional, but p4c today didn't like what I tried. Either it has a bug in handling default parameter values to packages, or my experiment was wrong somehow. In writing this, I just realized that I neglected to use an @optional
annotation on them, which might be why it didn't work for me. I will try that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One aspect of this that is perhaps more minor: it should be easier to implement the compiler for this approach.
Why? Because the PSA v1.1 approach requires checking that all assignments to output parameters like recirculate_meta are inside of an if
statement with the correct condition. With this approach, everything in the RecirculatePacker is effectively inside of such an if
statement, automatically, and it is impossible inside of the RecirculatePacker control to write code that affects any other packet paths, e.g. normal, clone, or resubmit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created an issue for p4c asking if it is possible to have a package declaration with default values for its parameters, and then instantiate that package. I could not figure out how to get that to work: p4lang/p4c#1914
I would not propose _only_ showing this figure, as it is a lot of detail to handle when you first look at this. The existing similar block diagram in the PSA spec is the first thing people should see, since it emphasizes the parsers and controls that they _must_ write code for. This one shows all of the other controls that they _might_ want to write additional code for, if they want to preserve user-defined metadata on one or more of the various packet paths.
intended to be merged into PSA specification somehow, if this idea goes forward.
Notes from discussing this proposal with Calin on 2019-Apr-29:
I tried before and after the meeting to make a package that had default values of "Empty*Packer()" for some of the parameters, but could not figure out how to get |
A reasonable answer is "yes, they should be", so leave them there, but eliminate the TBD comments.
It is also run just after ingress, just like several of the new Packer controls. The intent is that now the IngressDeparser control will do nothing but emit calls on headers, header stacks, and header_union values. Digest creation, which was formerly restricted to be done within the IngressDeparser, would now be restricted to occur only in the DigestCreator control. It has a default EmptyDigestCreator implementation that never generates any digest messages.
Another thing that may as well be asked now, if we make changes like this: Should there be a VerifyChecksum control after IngressParser, before Ingress, like in v1model? And UpdateChecksum after Egress, before EgressDeparser? I don't have any strong for or against arguments there, but this seems like the right time to think about it. |
Brief summary of what I see as properties of this proposal, vs. PSA v1.1 way of doing things:
That "skeleton template" would now have about a dozen fewer parameters to both parsers and the deparsers. Depending upon how this p4c issue [1] turns out, there could be about that many more parameters to the instantiation of the Ingress and Egress pipeline packages, but hopefully not. [1] p4lang/p4c#1914
|
Picking up the baton on this, as we are making more headways on supporting psa. This design is nice and we have more resource to make it happen both on the open-source side as well as internally. Let's resume this effort and try to make it into psa spec? @jafingerhut |
Sounds like a good idea to me. This and a few other things are probably worth having a meeting or three about to discuss and finalize. |
Meeting of any form is fine with me. Can you send an email with items to discuss? |
It is not completely different, but it does avoid many of the "extra"
parameters to the parsers and deparsers for carrying metadata.
Instead it introduces many extra control blcoks, each with a provided
"empty" or "no op" implementation, that contains the "packing" and
"unpacking" code that in PSA v1.1 are in the parsers and deparsers.