Skip to content

Commit 1a72547

Browse files
authored
Support weights_disallowed field in P4Info (#563)
Signed-off-by: Matthew Lam <[email protected]>
1 parent 5fd7c80 commit 1a72547

File tree

5 files changed

+253
-206
lines changed

5 files changed

+253
-206
lines changed

docs/v1/P4Runtime-Spec.adoc

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,13 +1506,22 @@ The `ActionProfile` message includes the following fields:
15061506

15071507

15081508
PSA programs can use the `@selector_size_semantics` annotation with one of
1509-
`sum_of_weights` or `sum_of_members` to specify this value for Action Selectors. In the `sum_of_members` case, the `@max_member_weight` annotation
1509+
`sum_of_weights` or `sum_of_members` to specify this value for Action Selectors.
1510+
In the `sum_of_members` case, the `@max_member_weight` annotation
15101511
can be used to specify `max_member_weight`. Unless otherwise specified, the
15111512
value of `selector_size_semantics` should default to `sum_of_weights`.
15121513
However, an unset `selector_size_semantics` should also be treated as
15131514
`sum_of_weights` for backwards compatibility in Action Selectors. In Action
15141515
Profiles, this value must be unset.
15151516

1517+
* `weights_disallowed`, a boolean flag indicating whether the controller
1518+
programs the weights (false) or the switch determines them through some other
1519+
mechanism (true). One such mechanism is dynamic load balancing or adaptive
1520+
routing (See e.g. link:https://sonic.software/sai/group__SAIARS.html[SAI API]).
1521+
The `@weights_disallowed` annotation can be added to action selectors in P4
1522+
programs to set this value to true. In Action Profiles, this value must be unset
1523+
(i.e. false).
1524+
15161525
==== `Counter` & `DirectCounter`
15171526

15181527
`Counter` and `DirectCounter` messages are used to specify all possible
@@ -3777,9 +3786,11 @@ An `ActionProfileGroup` entity update message has the following fields:
37773786
group. For each member in a group, the controller must define the following
37783787
fields:
37793788
** `member_id` for looking up the member table in the selector.
3780-
** `weight` specifying the probability of the member's selection at
3781-
runtime. 0 is not a valid `weight` value and the server must return
3782-
`INVALID_ARGUMENT` if the client attempts to use it.
3789+
** `weight` specifying the probability of the member's selection at runtime.
3790+
If `weights_disallowed` is set to true, then 0 (unset) is the only valid
3791+
`weight`. If `weights_disallowed` is false, then 0 is not a valid
3792+
`weight`. The server must return `INVALID_ARGUMENT` if the client attempts
3793+
to use invalid `weight`s.
37833794
** `watch_port` is the controller-defined port that the member's
37843795
liveness depends on. At runtime, the member must be excluded from
37853796
selection if the watch port is down. See <<#action-selector-constraints>> for notes on the behavior if all members in
@@ -3884,16 +3895,18 @@ Each `ActionProfileAction` message has the following fields:
38843895
* `action` is one of the actions specified by the table that is being
38853896
programmed.
38863897

3887-
* `weight` specifying the probability of the action's selection at runtime. 0 is
3888-
not a valid `weight` value and the server must return `INVALID_ARGUMENT` if
3889-
the client attempts to use it. If `selector_size_semantics` is
3890-
`sum_of_weights`, then the sum of all weights across all `ActionProfileAction`
3891-
messages for that `ActionProfileActionSet` message must not exceed the
3892-
`max_group_size` specified in the P4Info (if greater than 0), or the server
3893-
must return `INVALID_ARGUMENT`. If `selector_size_semantics` is
3894-
`sum_of_members`, the individual weight of each member must not exceed
3895-
`max_member_weight` (if greater than 0), or the server must return
3896-
`INVALID_ARGUMENT`.
3898+
* `weight` specifying the probability of the action's selection at runtime.
3899+
If `weights_disallowed` is set to true, then 0 (unset) is the only valid
3900+
`weight`. If `weights_disallowed` is false, then 0 is not a valid `weight`.
3901+
The server must return `INVALID_ARGUMENT` if the client attempts to use invalid
3902+
`weight`s.
3903+
If `selector_size_semantics` is `sum_of_weights`, then the sum of all weights
3904+
across all `ActionProfileAction` messages for that `ActionProfileActionSet`
3905+
message must not exceed the `max_group_size` specified in the P4Info
3906+
(if greater than 0), or the server must return `INVALID_ARGUMENT`.
3907+
If `selector_size_semantics` is `sum_of_members`, the individual weight of
3908+
each member must not exceed `max_member_weight` (if greater than 0), or the
3909+
server must return `INVALID_ARGUMENT`.
38973910

38983911
* `watch_port` is the controller-defined port that the action's liveness depends
38993912
on. At runtime, the action must be excluded from selection if the watch port

0 commit comments

Comments
 (0)