Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Should p4-hlir give semantic error if a table directly uses a primitive action? #20

Open
jafingerhut opened this issue Nov 22, 2016 · 0 comments

Comments

@jafingerhut
Copy link

jafingerhut commented Nov 22, 2016

The mtag-edge example in both P4 v1.0.2 and v1.1 specs shows examples where no_op is used as one possible action in several table definitions. For example, this one:

table strip_mtag {
    reads {
        mtag     : valid; // Was mtag parsed?
    }
    actions {
        _strip_mtag;
        no_op;
    }
}

When I attempt to run p4-graphs or p4-1.1-graphs on such a p4 program, I get a semantic error like this:

Semantic error: Invalid reference to no_op in file /home/andy/p4/andy-tests/mtag-v1.0.2/mtag-edge.p4 at line 52: invalid type for object, expected one of {action} but got primitive action

If I define an action, e.g. named _no_op, that does nothing but the primitive no_op action, I get no such error after changing the table action to _no_op..

Is directly using primitive actions in tables supposed to be allowed in P4, as the example mtag-edge program demonstrates? If so, it seems this parser is giving an incorrect error message, albeit one that is easy to work around.

If tables are not allowed to have primitive actions, then it would be nice to update the example p4 program not to use them.

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

No branches or pull requests

1 participant