Skip to content

Commit

Permalink
Generic Table First draft (#435)
Browse files Browse the repository at this point in the history
* Initial changes for generic tables

* second changes

* 3rd changes

* 4th changes

* 5th changes

* Adding p4types and p4info changes for GenericData (#4)

Adding another enum alongside P4IDs for generic tables as well

* Adding varbits and a readme writeup (#5)

* Adding varbit and a writeup

* Adding proto changes

* Adding genericTable for direct resources. Adding P4datatypespec to genericdatatype in p4types

* * Adding more container types
** list
** bag
** set
** ordered_set

* Moving GenericTable spec update to one big section to keep it
organized

* * Add Table categories introduction

* * Adding 3-level property details (Table, Entry, field)
* Adding more text on the data types in the spec
* Adding Details on Operations in the Table categories

* * Adding Read RPC details in table categories
* Adding a table to show valid combinations of table properties
* Adding default entry rules

* Expanding combinations

* review comments

* * Explain more on indexed tables. How are duplicates handled
* Add regular tables in the truth table
* Calculation table can be volatile
* Add column to lay out some examples for the table categories
* Mention that the entry properties do not go in p4info
* Flow chart to show INSERT decision flow. Added PNG file
* Add in float more verbiage regarding volatile
* Renamed generic_set to generic_unordered_set
* Removed bag and ordered_set
* Add p4type for string with min/max size

* Update Go dependencies (#438)

* Fixes #439 (#440)

Change CI  workflow to skip publishing if PR spawned by dependabot

* * Adding categories and properties in p4info
* Adding example changes for above in GenericTables.md
* Add default values to p4info.

* * Removed GenericTable category from the p4info
* Added more text about generic table type
* Corrected typos and reference links
* Replaced png file with svg file
* Removed is_const_table since table properties are present

* Adding space for dummy commit

* Correcting typo

* Adding dev branches to workflows (#443)

* Correcting linter errors

* Generating go and py files

* Adding text regarding direct resources as GenericTables in TableEntry

* some review comment changes

* Andy review comments

* remove whitespace

* * Correcting GenericTable.md according to the p4info
* Removing repeated file dfrom Param and Match top level

* * Removing float from p4info and spec
* Adding default value text to spec
* Adding UnorderedSet to runtime

* * Adding section to P4DataTypeSpec to indicate adding to
GenericDataTypeSpec for any new additions
* Removing P4DataTypeSpec from GenericDataTypeSpec
* Adding default value to bool in GenericData

* Moving GenericTable.md to docs

* Correcting spec for removal of p4_type in generic_type. Adding generated code

* * Shortening the field names in `GenericTable` to remove "genric_table_"
prefixes
* Correcting the text for type_name

* * Making default_value as bytes
* Adding "scope" to the union example

* Adding default string value

* review comments

* linter error

* Review comments

Signed-off-by: Sayan Bandyopadhyay <sayan.bandyopadhyay@intel.com>

* Correcting whitespace errors

Signed-off-by: Sayan Bandyopadhyay <sayan.bandyopadhyay@intel.com>

* Updating generated code

Signed-off-by: Sayan Bandyopadhyay <sayan.bandyopadhyay@intel.com>

---------

Signed-off-by: Sayan Bandyopadhyay <sayan.bandyopadhyay@intel.com>
Signed-off-by: Bandyopadhyay, Sayan <sayan.bandyopadhyay@intel.com>
Co-authored-by: Antonin Bas <antonin.bas@gmail.com>
Co-authored-by: Chris Sommers <31145757+chrispsommers@users.noreply.github.com>
  • Loading branch information
3 people committed Feb 22, 2024
1 parent 626f5c1 commit cc1e04e
Show file tree
Hide file tree
Showing 15 changed files with 10,349 additions and 1,550 deletions.
138 changes: 138 additions & 0 deletions docs/v1/GenericTable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# GenericTable example p4info

Below is an example for realizing MulticastGroupEntry as a GenericTable.
The key (MatchFields) comprise of only the group_id. 2 different ways of
defining the data fields has been presented. Only 1 of them is required.

```
generic_tables {
type_id : 145
type_name : "MulticastGroup"
properties : {
"indexed"
}
instances {
preamble {
id: 45332650
name: "MulticastGroup"
alias: "multicast_group"
}
generic_match_fields {
id: 1
name: "multicast_group_id"
match_type: EXACT
type_spec {
bitstring {
bit {
bitwidth : 32
}
}
}
}
union_refs {
id: 23557840
scope: TABLE_AND_DEFAULT
}
size: 1024
}
}
```

In the below one, both `instance` and `port` are separate
repeated fields. So the check on `len(instance_array) == len(port_array)`
needs to be a runtime check. This however keeps implementation simpler
and faster since we avoid further recursive nesting.

`port` is a varbytes of max size 64 bits each. The field is a list so
it is defined as list of varbits through p4info.

```
unions {
preamble {
id: 23557840
name: "multicast_group_member_add"
alias: "multicast_group_member_add"
}
params {
id: 1
name: "instance"
type_spec {
list {
element_type_spec {
bitstring {
bit {
bitwidth : 32
}
}
}
max_size : 10
}
}
}
params {
id: 2
name: "port"
type_spec {
list {
type_spec {
bitstring {
varbit {
max_bitwidth : 64
}
}
}
max_size : 10
}
}
}
}
```

The below one is similar to the above but both `instance` and `port` have
been converted to a list of structs.

```
unions {
preamble {
id: 23557841
name: "multicast_group_member_add_2"
alias: "multicast_group_member_add_2"
}
params {
id: 1
name: "replica"
type_spec {
list {
element_type_spec {
struct {
members {
id : 1
name : "instance"
type_spec {
bitstring {
bit {
bitwidth : 32
}
}
}
}
members {
id : 2
name : "port"
type_spec {
bitstring {
varbit {
max_bitwidth : 64
}
}
}
}
}
}
max_size : 10
}
}
}
}
```
Loading

0 comments on commit cc1e04e

Please sign in to comment.