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

[prototyping] Action parameter types and directionality annotations #7

Closed
chkim4142 opened this issue Oct 19, 2015 · 2 comments
Closed
Milestone

Comments

@chkim4142
Copy link
Contributor

Require types on action parameters
○ Parameters have directionality
■ in: May not be modified, can be a constant or other non-L-value
■ out: May be modified, implied to be uninitialized
■ inout: May be modified, already initialized with data
○ Use syntax similar to header field declaration

action foo (inout header ipv4_t ipv4, in bit<32> new_dst_addr)
{
modify_field(ipv4.dstAddr, new_dst_addr);
}

@chkim4142 chkim4142 added this to the P4-v1.1 milestone Oct 19, 2015
@ChrisDodd
Copy link
Contributor

On Mon, Oct 19, 2015 at 1:14 PM, chkim4142 notifications@github.com wrote:

action foo (inout header ipv4_t ipv4, in bit<32> new_dst_addr)
{
modify_field(ipv4.dstAddr, new_dst_addr);
}

This example hits the API problem with actions that we're trying to defer
or simplify -- when are action parameters things that need to be set in the
P4 program (in the control flow when the table is applied), and when are
they things that become part of the control plane API (parameters to the
table entry you are installing in a table.)

In v1.0 the action params are always part of the control plane API (so 'in'
only) -- anything that is related to a header or metadata field has to be
bound directly to that field's global name and not passed as a parameter.

@chkim4142 chkim4142 changed the title [prototyping] action parameter types and directionality annotations [prototyping] Action parameter types and directionality annotations Oct 20, 2015
@chkim4142
Copy link
Contributor Author

P4_16 has this.

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

2 participants