Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic Table First draft #435

Merged
merged 45 commits into from
Feb 22, 2024
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
e553d88
Initial changes for generic tables
saynb Apr 13, 2023
1d8eff5
second changes
saynb Apr 13, 2023
4690968
3rd changes
saynb Apr 14, 2023
55bf9be
4th changes
saynb Apr 14, 2023
f775ddc
5th changes
saynb Apr 14, 2023
07b2da6
Adding p4types and p4info changes for GenericData (#4)
saynb May 12, 2023
e4a5309
Adding varbits and a readme writeup (#5)
saynb May 12, 2023
fd132e7
Adding proto changes
saynb May 12, 2023
2a5eae6
Adding genericTable for direct resources. Adding P4datatypespec to ge…
saynb May 19, 2023
35dc65a
* Adding more container types
saynb May 26, 2023
6e7c5f1
* Add Table categories introduction
saynb May 26, 2023
d6e042b
* Adding 3-level property details (Table, Entry, field)
saynb Jun 2, 2023
53b105f
* Adding Read RPC details in table categories
saynb Jun 9, 2023
b0c29d2
Expanding combinations
saynb Jun 16, 2023
4ab7546
review comments
saynb Jun 23, 2023
88a0dd1
* Explain more on indexed tables. How are duplicates handled
saynb Jun 29, 2023
74c1661
Update Go dependencies (#438)
antoninbas Jul 6, 2023
d76a364
Fixes https://github.com/p4lang/p4runtime/issues/439 (#440)
chrispsommers Jul 6, 2023
be046f3
* Adding categories and properties in p4info
saynb Jul 7, 2023
cd271fd
* Removed GenericTable category from the p4info
saynb Jul 13, 2023
1131a75
Adding space for dummy commit
saynb Jul 21, 2023
eef4daf
Correcting typo
saynb Aug 3, 2023
0e2fb58
Adding dev branches to workflows (#443)
saynb Aug 4, 2023
119bdd6
Merge branch 'main' into generic_table_2
saynb Aug 8, 2023
5797394
Merge branch 'generic-table-dev' of https://github.com/saynb/p4runtim…
saynb Aug 8, 2023
e9e996e
Correcting linter errors
saynb Aug 8, 2023
3a5f4e4
Generating go and py files
saynb Aug 8, 2023
29aab4e
Adding text regarding direct resources as GenericTables in TableEntry
saynb Aug 11, 2023
185fa08
some review comment changes
saynb Aug 19, 2023
090aa0a
Andy review comments
saynb Aug 25, 2023
48f04d9
remove whitespace
saynb Aug 25, 2023
b101dab
* Correcting GenericTable.md according to the p4info
saynb Sep 7, 2023
4d4d9f7
* Removing float from p4info and spec
saynb Sep 7, 2023
89f11d9
* Adding section to P4DataTypeSpec to indicate adding to
saynb Sep 7, 2023
371d184
Moving GenericTable.md to docs
saynb Sep 7, 2023
b4dfa73
Correcting spec for removal of p4_type in generic_type. Adding genera…
saynb Sep 7, 2023
a8ec796
* Shortening the field names in `GenericTable` to remove "genric_table_"
saynb Sep 7, 2023
1c026e4
* Making default_value as bytes
saynb Sep 7, 2023
727bab2
Adding default string value
saynb Sep 7, 2023
7f1a54a
review comments
saynb Sep 7, 2023
2cbd34c
linter error
saynb Sep 7, 2023
9ff6e4e
Review comments
saynb Sep 22, 2023
0fcf0c4
Correcting whitespace errors
saynb Dec 7, 2023
71eef58
Resolving conflicts in spec and proto only
saynb Feb 22, 2024
8bbd503
Updating generated code
saynb Feb 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions docs/v1/P4Runtime-Spec.mdk
Original file line number Diff line number Diff line change
Expand Up @@ -6287,7 +6287,7 @@ properties, but we may include on in future versions of the API.
specific "fixed" features to their implementation in a generic way. The same can be achieved
via `Extern`, but GenericTable provides a structured way in which every feature is
represented as a set of match-fields and data-fields. The data consists of unions
wihch are similar to actions. One use of GenericTable in a server backend is
which are similar to actions. One use of GenericTable in a server backend is
with TDI [Table Driven Interface](https://github.com/p4lang/tdi), but targets
can use Generic table to map to their own specific feature implementations as
well.
Expand All @@ -6297,7 +6297,7 @@ It defines the following fields
generic_table_type in the context of the architecture.
saynb marked this conversation as resolved.
Show resolved Hide resolved
This value is in the range of `[0x00, 0xff]`.
The ID in the preamble is created as `0x18` `generic_table_type_id` `16 bits of
genereted ID`.
generated ID`.
jafingerhut marked this conversation as resolved.
Show resolved Hide resolved
Note that this value does not need
to be unique across all architectures from all organizations, since at any
given time every device managed by a P4Runtime server maps to a single P4Info
Expand Down Expand Up @@ -6347,10 +6347,13 @@ It defines the following fields

`GenericData` is an addition to p4data.proto- which aims at adding support for
saynb marked this conversation as resolved.
Show resolved Hide resolved
data types which aren't covered by P4Data. This incorporates all the data types
saynb marked this conversation as resolved.
Show resolved Hide resolved
used as primitive data types like bytes, float, strings. It contains P
used as primitive data types like bytes, float, strings. It contains p4type as
well. P4type is to be used for any data type present in P4. If there is a
conflict, like bool, then the P4 data type should be used.
saynb marked this conversation as resolved.
Show resolved Hide resolved

* bitstring : Bytes type used for simple unsigned integers or bytes
* float : Floating type values
* float : Floating type values. Target might return a lower-precision
ceiled value even if field is non-volatile.
saynb marked this conversation as resolved.
Show resolved Hide resolved
* bool : Boolean type values
* generic_struct : Used to define a structure that can contain
one or more of the other members as named. One structure can contain
saynb marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -6386,9 +6389,9 @@ that every state can be representated as a table or multiple tables. A table her
data structure with one or more entries and each entry can be represented as a set of
key fields and data fields.
Actions in P4 tables behave like unions and that has been borrowed here in GenericTable.
This can be potentially used targets to map to either TDI based backends, or even non-TDI
based backends. If using TDI, then potentially, for every new feature to be added, only
TDI backend support and remote client code will be required to make use of that function.
This can be potentially used targets to map to either TDI based targets, or even non-TDI
based targets. If using TDI, then potentially, for every new feature to be added, only
TDI target support and remote client code will be required to make use of that function.
All other middle layers should theoretically remain unchanged.

P4Runtime supports inserting, modifying, deleting and reading GenericTable entries with
Expand Down Expand Up @@ -6456,9 +6459,10 @@ applicable on the table and the APIs.

* Regular tables: Read, INSERT, MODIFY, DELETE work as intended. Entries in
a table can be inserted, modified and deleted.
* `INSERT` : The union field must be set for every `INSERT` update. If
another entry with same match key exists, then `ALREADY_EXISTS` is
returned.
* `INSERT` : If another entry with same match key exists, then
`ALREADY_EXISTS` is returned. If no union has been defined, then the
union from the default entry of the table is used. Some tables might
saynb marked this conversation as resolved.
Show resolved Hide resolved
not have a default entry, then the union is required to be set.
If `default_entry` is true, then it is treated as a MODIFY. Const
default union rules apply. Match fields and priority should not be set.
* `MODIFY` : Union field must be set since all data fields are under a
Expand Down Expand Up @@ -6506,7 +6510,8 @@ applicable on the table and the APIs.
fields should not be set in this case.
Wildcard read does NOT return default entry.

* Read-only tables: Entries can only be read. Write RPC doesn't work.
* Read-only tables: Entries can only be read. Write RPC doesn't work and
`NOT_SUPPORTED` is returned.
* `READ` : The Read RPC. All entries can be read. If no entities are
provided in request, then all entries are read, AKA wildcard read.
If `default_entry` is true, then the default entry is returned. Match
Expand Down Expand Up @@ -6537,8 +6542,10 @@ applicable on the table and the APIs.
the possible range of matchfields can be immense. For example, hash
calculation tables where matchfields are the field values and the union
data contains the hash value. There is no default_entry for such tables.
Write RPC returns `NOT_SUPPORTED`.
* `READ` : The Read RPC. Wildcard read doesn't exist for this table.
Match fields should always be set
`NOT_SUPPORTED` is returned if wildcard read is attempted.
If match fields aren't set, then default values for the fields are used.

* Indexed tables : Entries are ordered.

Expand Down Expand Up @@ -6594,9 +6601,11 @@ table category. By default, if absent, they are all always false
* Read-only
* Modify-only
* Reset-only
* Mandatory
* Mandatory : Whether user is required to provide value
during `INSERT`. Can be skipped on `MODIFY`.
* Volatile : Data plane volatile. Example counter bytes.


# Known Limitations of Current P4Runtime Version

* `FieldMatch`, action `Param`, and controller packet metadata fields only
Expand Down