From efffc7c14600fd487ab29f852600747fcec22719 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Tue, 29 Aug 2023 11:20:21 -0400 Subject: [PATCH 1/2] Update discussion of entry priorities in constant tables --- docs/v1/P4Runtime-Spec.mdk | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/docs/v1/P4Runtime-Spec.mdk b/docs/v1/P4Runtime-Spec.mdk index 49f322ce..07a29b61 100755 --- a/docs/v1/P4Runtime-Spec.mdk +++ b/docs/v1/P4Runtime-Spec.mdk @@ -3309,19 +3309,17 @@ The contents of const tables can be queried by the client through a the following fields must be set by the server: `table_id`, `match`, `action`, `is_default_action`, and `priority` (if required). This is in addition to any direct resources that are being queried. Idle timeouts are not supported for -static entries. If the table requires a priority value for entries, the server -must populate the `priority` field appropriately, starting at 1 for the lowest -priority entry and incrementing the value by 1 for each successive entry. Note -that P4~16~ does not support assigning explicit priorities to entries -declared with `const entries`[^ConstEntriesPriorities]. When a -priority value is required (⪚ for tables including `RANGE`, -`TERNARY` or `OPTIONAL` matches), it is inferred based on the order in -which entries appear in the table declaration. +static entries. -[^ConstEntriesPriorities]: This is not yet explicit in the P4~16~ - language specification, but will become so if this or a similar - clarification is added to it: - +When a priority value is required (⪚ for tables including `RANGE`, +`TERNARY` or `OPTIONAL` matches), it is inferred based on the order in +which entries appear in the table declaration. As of August 2023, the +open source `p4c` compiler always assigns entry priority values in +constant tables starting at 1 for the first entry and incrementing the +value by 1 for each successive entry. The P4~16~ language +specification does not preclude the P4 developer from explicitly +specifying priorities for entries in constant tables, but `p4c` does +not yet support this. ### Preinitialized tables { #sec-preinitialized-tables } From 8357b5f0daee245b767b8b2dd193dd17cafbe61b Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Tue, 29 Aug 2023 12:33:01 -0400 Subject: [PATCH 2/2] Correct description of entry priority for constant tables --- docs/v1/P4Runtime-Spec.mdk | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/v1/P4Runtime-Spec.mdk b/docs/v1/P4Runtime-Spec.mdk index 07a29b61..7f8dfadc 100755 --- a/docs/v1/P4Runtime-Spec.mdk +++ b/docs/v1/P4Runtime-Spec.mdk @@ -3314,12 +3314,12 @@ static entries. When a priority value is required (⪚ for tables including `RANGE`, `TERNARY` or `OPTIONAL` matches), it is inferred based on the order in which entries appear in the table declaration. As of August 2023, the -open source `p4c` compiler always assigns entry priority values in -constant tables starting at 1 for the first entry and incrementing the -value by 1 for each successive entry. The P4~16~ language -specification does not preclude the P4 developer from explicitly -specifying priorities for entries in constant tables, but `p4c` does -not yet support this. +open source `p4c` compiler always assigns entry priority values in a +constant table with `N` entries starting at `N` for the first entry +and decrementing the value by 1 for each successive entry. The P4~16~ +language specification does not preclude the P4 developer from +explicitly specifying priorities for entries in constant tables, but +`p4c` does not yet support this. ### Preinitialized tables { #sec-preinitialized-tables }