Skip to content

Commit 695cfcf

Browse files
Update with examples and clearer motivation based on comments.
Signed-off-by: Jonathan DiLorenzo <[email protected]>
1 parent d307999 commit 695cfcf

File tree

1 file changed

+58
-4
lines changed

1 file changed

+58
-4
lines changed

docs/v1/P4Runtime-Spec.adoc

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

39913991
It is possible to include several `ActionProfileAction` messages with the same
3992-
exact `action` specification in one `ActionProfileActionSet` message. However,
3993-
when using the `sum_of_weights` group size calculation, the P4Runtime client is
3994-
encouraged not to do so, as the same can be achieved by
3995-
using the `weight` field. Note that to preserve read-write symmetry, the server
3992+
exact `action` specification in one `ActionProfileActionSet` message. For
3993+
`sum_of_members`, this allows clients to specify weights greater than the
3994+
`max_member_weight` set. E.g. modifying the example above, we can weight
3995+
nexthop 1 to be 2x100 (if `max_member_weight` is 100 as follows:
3996+
[source,protobuf]
3997+
----
3998+
table_entry {
3999+
table_id: 0x0212ab34
4000+
match { /* lpm match */ }
4001+
action {
4002+
action_profile_action_set {
4003+
action_profile_actions {
4004+
action { /* set nexthop 1 */ }
4005+
weight: 100
4006+
watch_port: "\x01"
4007+
}
4008+
action_profile_actions {
4009+
action { /* set nexthop 1 */ }
4010+
weight: 100
4011+
watch_port: "\x01"
4012+
}
4013+
action_profile_actions {
4014+
action { /* set nexthop 2 */ }
4015+
weight: 2
4016+
watch_port: "\x02"
4017+
}
4018+
}
4019+
}
4020+
}
4021+
----
4022+
4023+
For `sum_of_weights`, this is still allowed, but discouraged since it offers
4024+
no additional expressive power over combining the weights into a single member.
4025+
For example, if the example above was using `sum_of_weights` mode, it could be
4026+
rewritten without using any additional resources as:
4027+
[source,protobuf]
4028+
----
4029+
table_entry {
4030+
table_id: 0x0212ab34
4031+
match { /* lpm match */ }
4032+
action {
4033+
action_profile_action_set {
4034+
action_profile_actions {
4035+
action { /* set nexthop 1 */ }
4036+
weight: 200
4037+
watch_port: "\x01"
4038+
}
4039+
action_profile_actions {
4040+
action { /* set nexthop 2 */ }
4041+
weight: 2
4042+
watch_port: "\x02"
4043+
}
4044+
}
4045+
}
4046+
}
4047+
----
4048+
4049+
Note that to preserve read-write symmetry, the server
39964050
must not coalesce multiple `ActionProfileAction` messages with the same `action`
39974051
specification into one. Additionally, each `action` specification would count as
39984052
a separate member for the purposes of e.g. the `sum_of_members` group size

0 commit comments

Comments
 (0)