p4lang / p4runtime

Specification documents for the P4Runtime control-plane API
Apache License 2.0
140 stars 86 forks source link

Add a notion of max_member_weight for action profiles that use the SUM_OF_MEMBERS semantics. #396

Closed jonathan-dilorenzo closed 1 year ago

jonathan-dilorenzo commented 1 year ago

With the SUM_OF_MEMBERS semantics, the maximum weight of individual members is no longer implied by the maximum weight of a group. However, probably most switches can't faithfully support arbitrary weights (or even up to the int32 type that we use to represent weights). I propose to change the SelectorSizeSemantics in action profiles to be a oneof where sum_of_members can contain its max_member_weight.

Ideally, sooner rather than later, since we just finished adding these semantics, so hopefully no one is using them yet.

jonathan-dilorenzo commented 1 year ago

@antoninbas and @smolkaj, any thoughts on how to include this additional semantics in the annotation? Just @selector_size_semantics(SUM_OF_MEMBERS, )? Then we'd presumably want the same for SUM_OF_WEIGHTS? @selector_size_semantics(SUM_OF_WEIGHTS, <ignore this value?>)

antoninbas commented 1 year ago

can't it be a different annotation that would be ignored if @selector_size_semantics is no SUM_OF_MEMBERS?

jonathan-dilorenzo commented 1 year ago

Yupp, that sounds good too. I guess if no such annotation is provided, the field can be unset, which we would think of as allowing any 32-bit int?

smolkaj commented 1 year ago

Seems reasonable to me