I was just thinking about the options for the new proposed annotation, which I will call @groupaction in this issue for now.
Aside: There is another PR that is being reviewed that might change the name to that, or perhaps to something else depending on how review comments proceed: #604
Before that annotation was added, the standard annotations for actions were @tableonly and @defaultonly. Here are all supported combinations of those annotations on a single action in a table's action list:
(1) no annotation: the action can be used as (a) the action of any number of table entries, or (b) as the table's default_action, or both (a) and (b) simultaneously.
(2) annotation @tableonly: the action can be used as (a), but not (b)
(3) annotation @defaultonly: the action can be used as (b), but not (a)
(4) both annotations @tableonly and @defaultonly on the same action: this does not make sense semantically, and thankfully p4c gives an error if you attempt to do so. Here is an example of the error message:
[--Werror=invalid] error: Table 'ingressImpl.ipv4_da_lpm' has an action reference ('ingressImpl.set_l2ptr') which is annotated with both '@tableonly' and '@defaultonly'
When we have the new annotation @groupaction, how should the list of possibilities be expanded? Is the proposal that things will behave as follows?
(5) no annotation: same as (1), and in particular the action cannot be configured as (c) the action of any number of the action selector's groups.
(6) same as (2), and action cannot be used for (c)
(7) same as (3), and action cannot be used for (c)
(8) same as (4)
(9) annotation @groupaction: the action can be used for (c), but not (a) or (b)
(10) annotation @groupaction and also one or both of @tableonly or @defaultonly: disallowed with an error at compile time.
If that is the proposal, note that it is then impossible to have the same named action be used as a group action of the table, and also a default action. This is easy to work around by creating a new action with a different name, of course, but I wanted to point out that this would be necessary, and perhaps worth pointing out as a consequence of the design of these annotations.
The names @defaultonly and @tableonly unfortunately do not lend themselves well to supporting all 2^3-1 combinations of enabling/disabling an action in each of the 3 kinds of uses independently.
I was just thinking about the options for the new proposed annotation, which I will call
@groupactionin this issue for now.Aside: There is another PR that is being reviewed that might change the name to that, or perhaps to something else depending on how review comments proceed: #604
Before that annotation was added, the standard annotations for actions were
@tableonlyand@defaultonly. Here are all supported combinations of those annotations on a single action in a table's action list:(1) no annotation: the action can be used as (a) the action of any number of table entries, or (b) as the table's default_action, or both (a) and (b) simultaneously.
(2) annotation
@tableonly: the action can be used as (a), but not (b)(3) annotation
@defaultonly: the action can be used as (b), but not (a)(4) both annotations
@tableonlyand@defaultonlyon the same action: this does not make sense semantically, and thankfully p4c gives an error if you attempt to do so. Here is an example of the error message:When we have the new annotation
@groupaction, how should the list of possibilities be expanded? Is the proposal that things will behave as follows?(5) no annotation: same as (1), and in particular the action cannot be configured as (c) the action of any number of the action selector's groups.
(6) same as (2), and action cannot be used for (c)
(7) same as (3), and action cannot be used for (c)
(8) same as (4)
(9) annotation
@groupaction: the action can be used for (c), but not (a) or (b)(10) annotation
@groupactionand also one or both of@tableonlyor@defaultonly: disallowed with an error at compile time.If that is the proposal, note that it is then impossible to have the same named action be used as a group action of the table, and also a default action. This is easy to work around by creating a new action with a different name, of course, but I wanted to point out that this would be necessary, and perhaps worth pointing out as a consequence of the design of these annotations.
The names
@defaultonlyand@tableonlyunfortunately do not lend themselves well to supporting all 2^3-1 combinations of enabling/disabling an action in each of the 3 kinds of uses independently.