Skip to content

Commit e6fbe05

Browse files
Clarify sending ActionProfile members with duplicate actions. (#559)
Specifically, clarify that P4Runtime clients are only discouraged from sending ActionProfile members with duplicate actions when using the `sum_of_weights` group size calculation, since the same may literally not be achievable using the `weight` field otherwise. Signed-off-by: Jonathan DiLorenzo <[email protected]>
1 parent a692297 commit e6fbe05

File tree

1 file changed

+58
-3
lines changed

1 file changed

+58
-3
lines changed

docs/v1/P4Runtime-Spec.adoc

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4043,9 +4043,64 @@ first, then the group needs to be created, and finally the match entry can be
40434043
inserted. Therefore, 3 distinct `WriteRequest` batches are required.
40444044

40454045
It is possible to include several `ActionProfileAction` messages with the same
4046-
exact `action` specification in one `ActionProfileActionSet` message. However,
4047-
the P4Runtime client is encouraged not to do so, as the same can be achieved by
4048-
using the `weight` field. Note that to preserve read-write symmetry, the server
4046+
exact `action` specification in one `ActionProfileActionSet` message. For
4047+
`sum_of_members`, this allows clients to specify weights greater than the
4048+
`max_member_weight` set. E.g. modifying the example above, we can weight
4049+
nexthop 1 to be 2x100 (if `max_member_weight` is 100) as follows:
4050+
[source,protobuf]
4051+
----
4052+
table_entry {
4053+
table_id: 0x0212ab34
4054+
match { /* lpm match */ }
4055+
action {
4056+
action_profile_action_set {
4057+
action_profile_actions {
4058+
action { /* set nexthop 1 */ }
4059+
weight: 100
4060+
watch_port: "\x01"
4061+
}
4062+
action_profile_actions {
4063+
action { /* set nexthop 1 */ }
4064+
weight: 100
4065+
watch_port: "\x01"
4066+
}
4067+
action_profile_actions {
4068+
action { /* set nexthop 2 */ }
4069+
weight: 2
4070+
watch_port: "\x02"
4071+
}
4072+
}
4073+
}
4074+
}
4075+
----
4076+
4077+
For `sum_of_weights`, this is still allowed, but discouraged since it offers
4078+
no additional expressive power over combining the weights into a single member.
4079+
For example, if the example above was using `sum_of_weights` mode, it could be
4080+
rewritten without using any additional resources as:
4081+
[source,protobuf]
4082+
----
4083+
table_entry {
4084+
table_id: 0x0212ab34
4085+
match { /* lpm match */ }
4086+
action {
4087+
action_profile_action_set {
4088+
action_profile_actions {
4089+
action { /* set nexthop 1 */ }
4090+
weight: 200
4091+
watch_port: "\x01"
4092+
}
4093+
action_profile_actions {
4094+
action { /* set nexthop 2 */ }
4095+
weight: 2
4096+
watch_port: "\x02"
4097+
}
4098+
}
4099+
}
4100+
}
4101+
----
4102+
4103+
Note that to preserve read-write symmetry, the server
40494104
must not coalesce multiple `ActionProfileAction` messages with the same `action`
40504105
specification into one. Additionally, each `action` specification would count as
40514106
a separate member for the purposes of e.g. the `sum_of_members` group size

0 commit comments

Comments
 (0)