Skip to content

Conversation

matthewtlam
Copy link
Contributor

@matthewtlam matthewtlam commented Sep 11, 2025

The switch has its own hash algorithm that already exists (ex. CRC, Identity, etc.). Traditionally, these are not defined in the P4Info in any way since it doesn’t affect the program.

We wish to introduce this new field ,weights_determined_by_switch, to the P4Info to denote to the control plane that programming will have no effects on the weights. We wish to leverage the switch using its own hash algorithm to determine the weights.

cc: @jonathan-dilorenzo, @smolkaj for vis

@chrispsommers
Copy link
Collaborator

Please provide a summary description, thanks.

@matthewtlam matthewtlam changed the title Support switch determining weights Support weights_determined_by_switch field in P4Info Sep 11, 2025
Signed-off-by: Matthew Lam <[email protected]>
@matthewtlam
Copy link
Contributor Author

matthewtlam commented Sep 11, 2025

Other design considerations that we had include:

  • Expose a new type of hash algorithm in V1Model (needed for our purpose) and PSA (for standard compliance). The P4Info knob weights_determined_by_switch would then be set based on this hash algorithm.

Other questions

  • Do we care about some groups having a particular weight defined by the switch and then others groups that the switch can program?

EDIT: changed the link to reference P4C version

cc: @chrispsommers, @jafingerhut, @antoninbas

@antoninbas
Copy link
Member

@matthewtlam you shared an internal Google link

You could introduce a standard P4Runtime annotation to control whether that boolean should be set in the P4Info (similar to @max_group_size)

@jonathan-dilorenzo
Copy link
Contributor

Thanks @antoninbas! That would be our suggestion if we want to do this boolean approach. The main question, I think, would be if there is something more expressive we might want to put here instead, though I can't immediately think of other ways in which the hash algorithm might affect what the controller programs... I suppose a 'per-group' hash algorithm (including "You choose weights") would be a way to go (as we sort of discussed on Angela's PR), but I don't actually know of any switch with close to that expressive power ;).

@smolkaj
Copy link
Member

smolkaj commented Sep 12, 2025

"switch using its own hash algorithm to determine the weights"
I'm a bit confused by this part. Is it the job of the hash algorithm to determine the weights? Presumably it is the job of some sort of load balancing protocol/algorithm? And the hash algorithm is orthogonal?

}

// dictates whether the controller can specify weights for groups programmed
// in this ActionProfile. If `weights_determined_by_switch`, then all weights
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"If weights_determined_by_switch, seems like an incomplete phrase."

How about "If weights_determined_by_switch is true"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants