You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The converter from P4_14 to P4_16 allows action functions to be used as functions -- e.g., one action may invoke another. It's not clear that this is always in-line with the P4_14 spec.
For example, consider the following snippet of code from testdata/p4_14_samples/action_inline.p4 (also attached to the bottom of this issue):
According to the spec, the first argument to the add_to_field primitive should be a field. However, here it is a parameter y0, which could either be a field or action data supplied by the control plane.
In this case, since a is only invoked by b, the compiler happily generates the following:
The converter from P4_14 to P4_16 allows action functions to be used as functions -- e.g., one action may invoke another. It's not clear that this is always in-line with the P4_14 spec.
For example, consider the following snippet of code from
testdata/p4_14_samples/action_inline.p4
(also attached to the bottom of this issue):According to the spec, the first argument to the
add_to_field
primitive should be a field. However, here it is a parametery0
, which could either be a field or action data supplied by the control plane.In this case, since
a
is only invoked byb
, the compiler happily generates the following:which is fine.
However, if we also use
a
in a table, then we get the following error:This error disappears if we replace the body of
a
with different code.Going a step further, if we change
b
to invokea
on another field with another width (7 bits instead of 1), we get a different error:The relevant code generated by the converter is
I'm not sure what's intended, and I'm all for abstraction, but what we currently have seems somewhat...
See here for the P4 sources:
action_inline.txt
action_inline_tweaked.txt
The text was updated successfully, but these errors were encountered: