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

P4 2016 draft: named field lists #51

Closed
mihaibudiu opened this issue Sep 13, 2016 · 7 comments
Closed

P4 2016 draft: named field lists #51

mihaibudiu opened this issue Sep 13, 2016 · 7 comments
Assignees
Milestone

Comments

@mihaibudiu
Copy link
Contributor

The p4-16 language does not have anything equivalent to named field lists.

@chkim4142 chkim4142 assigned blp and mihaibudiu and unassigned blp Sep 26, 2016
@chkim4142
Copy link
Contributor

@mbudiu-vmw Is this a must or good-to-have?

@mihaibudiu
Copy link
Contributor Author

It's good to have. By adding tuples we have made a step forward. If we want field lists to be left-values we may need special support, otherwise this could be implemented by just having a function that returns a tuple. So we just have to add functions to the language...

@chkim4142 chkim4142 added this to the post P4_16 milestone Oct 6, 2016
@ChrisDodd
Copy link
Contributor

Another place where fields lists turn out to be really useful/necessary is for the 'clone' primitive. When cloning/mirroring a packet in P4_14, you specify (as a field list) a list of metadata fields to be preserved in the cloned packet. The data in these metadata fields (and only these fields) is copied from the cloning thread to the new thread for the cloned packet, rather than being initialized to zero.

So here the field_list is supplying a list (or tuple) of locations rather than a list of values as is the case for most other uses of field lists (hash and digest primitives, checksums)

@mihaibudiu
Copy link
Contributor Author

Field lists can be modeled to some degree with an action that takes a struct as in argument and a tuple as an out argument - the tuple is the field list. E.g.

action fl(in IPv4Header h, out tuple<bit<32>, bit<32>> fields) {
    fields = { h.srcAddr, h.destAddr };
}

@jafingerhut
Copy link
Collaborator

I believe that the PSA draft we have now has an alternate method for specifying metadata that gets carried with packets, both for cloned packets and all others that can carry metadata "next to" each packet.

I know that Vladimir has mentioned field lists, which have properties that they are like references to locations, rather than the current values of the fields at the point of the field list definition, might be useful in defining language features such as the one proposed in the issue linked below, but it isn't clear to me yet why field lists help there.

#516

@jnfoster
Copy link
Collaborator

jnfoster commented Nov 5, 2018

Discussed at 11/5/2018 LDWG. Still in hibernation.

@jnfoster
Copy link
Collaborator

jnfoster commented Oct 4, 2021

@mbudiu-vmw should this issue be closed if we take the clone3_with_field_lists proposal?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants