Skip to content

Commit 03e5539

Browse files
author
Mihai Budiu
authored
Merge pull request #778 from p4lang/miss_761
Issue #761: Add support for the apply() miss field
2 parents c3820b3 + f65a9c9 commit 03e5539

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

p4-16/spec/P4-16-spec.mdk

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6049,16 +6049,21 @@ struct apply_result(T) {
60496049
~ End P4Pseudo
60506050

60516051
The evaluation of the `apply` method sets the `hit` field to `true`
6052-
if a match is found in the lookup-table. This bit can be used to drive
6053-
the execution of the control-flow in the control block that invoked
6054-
the table:
6052+
and the field `miss` to `false` if a match is found in the lookup-table;
6053+
if a match is not found `hit` is set to `false` and `miss` to `true`.
6054+
These bits can be used to drive the execution of the control-flow in the
6055+
control block that invoked the table:
60556056

60566057
~ Begin P4Example
60576058
if (ipv4_match.apply().hit) {
60586059
// there was a hit
60596060
} else {
60606061
// there was a miss
60616062
}
6063+
6064+
if (ipv4_host.apply().miss) {
6065+
ipv4_lpm.apply(); // Lookup the route only if host table missed
6066+
}
60626067
~ End P4Example
60636068

60646069
The `action_run` field indicates which kind of action was executed
@@ -7139,6 +7144,7 @@ The P4 compiler should provide:
71397144

71407145
## Summary of changes made in version 1.2.0
71417146

7147+
* Added `table.apply().miss`
71427148
* Added `string` type (Section [#sec-string].)
71437149
* Allow 1-bit signed values
71447150
* Define the type of bit slices from signed and unsigned values to be unsigned.

0 commit comments

Comments
 (0)