[P4-dev] expecting ACTION or CONST or TABLE

Calin Cascaval cascaval at barefootnetworks.com
Thu Oct 5 16:35:00 EDT 2017


IIRC, parameters with direction annotations (in, inout, out) are data plane parameters that do not need to be bound. Directionless parameters (control plane parameters) should always be bound. So you may want to consider that as well when you define your action.

--
Thanks, Calin

> On Oct 5, 2017, at 12:13, King, Steven R <steven.r.king at intel.com> wrote:
> 
> Thanks Guys, works for me now too.  For completeness, here's the minimal working example without dragging in all of core.p4.
> Regards,
> -steve
> 
> action NoAction() {}
> control foo() {
>    action a(in bit<8> x) {}
>    table t {
>        actions = {
>            a(5); // binding a's parameter x to 5
>        }
>    }
>    apply {}
> }
> 
> From: Han Wang [mailto:hanwang at barefootnetworks.com] 
> Sent: Thursday, October 05, 2017 11:45 AM
> To: Mihai Budiu <mbudiu at vmware.com>
> Cc: King, Steven R <steven.r.king at intel.com>; p4-dev at lists.p4.org
> Subject: Re: [P4-dev] expecting ACTION or CONST or TABLE
> 
> Sorry. 
> 
> Compiled with
> p4test --p4-16 bug-steve-king.p4
> 
> On Oct 5, 2017, at 11:43 AM, Mihai Budiu <mbudiu at vmware.com> wrote:
> 
> This looks wrong, this is not a p4-14 program.
> 
> -----Original Message-----
> From: P4-dev [mailto:p4-dev-bounces at lists.p4.org] On Behalf Of Han Wang
> Sent: Thursday, October 5, 2017 11:41 AM
> To: King, Steven R <steven.r.king at intel.com>
> Cc: p4-dev at lists.p4.org
> Subject: Re: [P4-dev] expecting ACTION or CONST or TABLE
> 
> This works for me.
> 
> #include <core.p4>
> control foo() {
>    action a(in bit<8> x) {}
>    table t {
>        actions = {
>            a(8w5); // binding a's parameter x to 5
>        }
>    }
>    apply{}
> }
> 
> Compiled with
> p4test --p4-14 bug-steve-king.p4
> 
> 
> On Oct 5, 2017, at 11:30 AM, King, Steven R <steven.r.king at intel.com> wrote:
> 
> Hello P4,
> 
> I'm trying and failing to construct a minimal error-free example of a table in a control block.
> 
> AFAICT from the p4-16 spec, this code is valid:
> 
>   $ cat dummy.p4
>   control foo() {
>       action a(inout bit<8> x) {}
>       table t {
>           actions = {
>               a(5); // binding a's parameter x to 5
>           }
>       }
>   }
> 
> 
> Building this code returns the following error:
>   $ p4c -c dummy.p4
>   dummy.p4(8):syntax error, unexpected }, expecting ACTION or CONST or TABLE
>   }
>   ^
>   error: 1 errors encountered, aborting compilation
> 
> 
> Can someone please show the fix needed to make this code compile?
> 
> Thanks,
> -steve
> 
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.p4.org_mailman_listinfo_p4-2Ddev-5Flists.p4.org&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=tGW6TKXajnoXSyy1S1P4DHGPe8sj54GGvw-b21n7aWg&m=VU4Sj8CY7Krg194Z0Nos6jNzCEru60pK4yF-t6XEi70&s=L3cRLmqYGzxEXk-xF_uvG0fuErwpsBL9Nfvbs9j6w5E&e= 
> 
> 
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.p4.org_mailman_listinfo_p4-2Ddev-5Flists.p4.org&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=tGW6TKXajnoXSyy1S1P4DHGPe8sj54GGvw-b21n7aWg&m=VU4Sj8CY7Krg194Z0Nos6jNzCEru60pK4yF-t6XEi70&s=L3cRLmqYGzxEXk-xF_uvG0fuErwpsBL9Nfvbs9j6w5E&e=
> 
> 
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20171005/50e69cde/attachment-0002.html>


More information about the P4-dev mailing list