Skip to content

Commit dc05994

Browse files
authored
Support group_action field in ActionProfileActionSet (#594)
\Signed-off-by: Matthew Lam <matthew.lam.qwerty@gmail.com>
1 parent ed01441 commit dc05994

7 files changed

Lines changed: 963 additions & 883 deletions

File tree

docs/v1/P4Runtime-Spec.adoc

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,16 +1350,20 @@ control plane. This message contains the following fields:
13501350
actions for this table. The `ActionRef` message is used to reference an action
13511351
specified in the same P4Info message and it includes the following fields:
13521352
** `id`, the `uint32` identifier of the action.
1353-
** `scope`, an enum value which can take one of three values:
1354-
`TABLE_AND_DEFAULT`, `TABLE_ONLY` and `DEFAULT_ONLY`. The `scope` of the
1355-
action is determined by the use of the P4 standard annotations
1356-
`@tableonly` and `@defaultonly` cite:[P4ActionAnnotations]. `TABLE_ONLY`
1357-
(`@tableonly` annotation) means that the action can only appear within
1358-
the table, and never as the default action. `DEFAULT_ONLY`
1353+
** `scope`, an enum value which can take one of four values:
1354+
`TABLE_AND_DEFAULT`, `TABLE_ONLY`, `PER_GROUP_ONLY` and `DEFAULT_ONLY`. The
1355+
`scope` of the action is determined by the use of the P4 standard
1356+
annotations `@tableonly`, and `@defaultonly` cite:[P4ActionAnnotations].
1357+
`@pergrouponly` is currently not a P4 standard annotation, but planned.
1358+
`TABLE_ONLY` (`@tableonly` annotation) means that the action can only
1359+
appear within the table, and never as the default action. `PER_GROUP_ONLY`
1360+
(`@pergrouponly` annotation) means that the action can only be used as
1361+
a `group_action` in an `ActionProfileActionSet`. `DEFAULT_ONLY`
13591362
(`@defaultonly` annotation) means that the action can only be used as the
13601363
default action. `TABLE_AND_DEFAULT` is the default value for the enum and
1361-
means that neither annotation was used in P4 and that the action can be
1362-
used both within the table and as the default action.
1364+
means that no annotation was used in P4 and that the action can be
1365+
used both within the table and as the default action, but not as a
1366+
per-group action.
13631367
** `annotations`, a repeated string field, each one representing a P4
13641368
annotation associated to the action *reference* in this table.
13651369

@@ -3883,9 +3887,10 @@ does not need to keep track of group ids and member ids.
38833887

38843888
One shots are programmed by choosing the `ActionProfileActionSet` message as the
38853889
`TableAction`. The `ActionProfileActionSet` message consists of a set of
3886-
`ActionProfileAction` messages, a `ActionSelectionMode` enum, and a
3887-
`SizeSemantics` enum. The `ActionSelectionMode` and `SizeSemantics` enums
3888-
override the existing action selector settings.
3890+
`ActionProfileAction` messages, an `Action` for the per group action, a
3891+
`ActionSelectionMode` enum, and a `SizeSemantics` enum. The
3892+
`ActionSelectionMode` and `SizeSemantics` enums override the existing
3893+
action selector settings.
38893894

38903895
The `ActionProfileAction` set should have cardinality no greater than
38913896
`max_group_size` (if `max_group_size` is nonzero) if `selector_size_semantics`
@@ -4106,6 +4111,38 @@ specification into one. Additionally, each `action` specification would count as
41064111
a separate member for the purposes of e.g. the `sum_of_members` group size
41074112
calculation for Action Selectors.
41084113

4114+
The `group_action` behaves as a "base" action that is logically composed with
4115+
the selected member action. Semantically, this acts as a pre-action to the
4116+
existing member-specific logic. For example, you might use it to set metadata
4117+
for every packet that hits a particular group, irrespective of the member that
4118+
then gets selected. Note that this functionality can only be used with one
4119+
shot action selector programming.
4120+
4121+
P4Runtime-Spec.adoc
4122+
----
4123+
table_entry {
4124+
table_id: 0x0212ab34
4125+
match { /* lpm match */ }
4126+
action {
4127+
action_profile_action_set {
4128+
group_action {
4129+
/* set route metadata */
4130+
}
4131+
action_profile_actions {
4132+
action { /* set nexthop 1 */ }
4133+
weight: 200
4134+
watch_port: "\x01"
4135+
}
4136+
action_profile_actions {
4137+
action { /* set nexthop 2 */ }
4138+
weight: 2
4139+
watch_port: "\x02"
4140+
}
4141+
}
4142+
}
4143+
}
4144+
----
4145+
41094146
All the tables associated with an action selector may either be programmed
41104147
exclusively with one shots, or exclusively with `ActionProfileMember` and
41114148
`ActionProfileGroup` messages. Programming some entries with one shots, and

0 commit comments

Comments
 (0)