Skip to content

Commit 2f82eaf

Browse files
authored
Add a note about the action_calls property of a pipeline in JSON input files (#1284)
Signed-off-by: Andy Fingerhut <[email protected]>
1 parent 7ca39ed commit 2f82eaf

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

docs/JSON_format.md

+12-2
Original file line numberDiff line numberDiff line change
@@ -663,8 +663,8 @@ attributes for these objects are:
663663
- `false_next`: the name of the next control flow to execute if the condition
664664
evaluates to false, or null if this is the end of the pipeline
665665
- `action_calls`: a JSON array of JSON objects. It is used for direct action
666-
calls from a control flow which are not wrapped into a table. The attributes for
667-
these objects are:
666+
calls from a control flow which are not wrapped into a table. See Note 1 below.
667+
The attributes for these objects are:
668668
- `name`
669669
- `id`: a unique integer; note that it has to be unique with respect to *all*
670670
action calls in the JSON file, not just the ones included in this pipeline
@@ -675,6 +675,16 @@ these objects are:
675675
table, a conditional or another action call like this one), or null if this is
676676
the last node in the pipeline
677677

678+
Note 1: p4c has never created JSON files with `action_calls` in them.
679+
Instead, for any call to action `a` within the body of a control, the
680+
compiler converts that call into applying a "dummy table" that has the
681+
same effect. A dummy table is one synthesized by the compiler. A
682+
dummy table is not visible to the control plane, has no key fields,
683+
and thus can never have table entries added to it, and will always get
684+
a miss every time it is applied, and execute its default action. A
685+
dummy table has a const default action that is equal to the action `a`
686+
in the original source code that it is replacing.
687+
678688
The `match_type` for the table needs to follow the following rules:
679689
- If one match field is `range`, the table `match_type` has to be `range`
680690
- If one match field is `ternary`, the table `match_type` has to be `ternary`

0 commit comments

Comments
 (0)