[multicast] Add multicast replication support for (upcoming) softnpu/a4x2#240
Open
zeeshanlakhani wants to merge 1 commit intomainfrom
Open
[multicast] Add multicast replication support for (upcoming) softnpu/a4x2#240zeeshanlakhani wants to merge 1 commit intomainfrom
zeeshanlakhani wants to merge 1 commit intomainfrom
Conversation
Introduce two-group multicast replication (mcast_grp_a / mcast_grp_b) modeled after dendrite's replication contract and P4 sidecar expectations. When egress metadata declares the multicast field triplet, the generated pipeline replicates packets to group members with per-copy attribution tags, ingress-port exclusion, and mcast-over-broadcast precedence. ## Slice codegen fix Fix a latent bug where non-byte-aligned multi-byte slices (e.g., field[11:4] on bit<32>) produced incorrect bitvec ranges after header byte-reversal. Validation moves to HLIR so these are now rejected at compile time with a diagnostic rather than silently generating wrong code. ## Multicast contract The codegen path activates when egress_metadata_t declares all three fields: mcast_grp_a, mcast_grp_b, and mcast_replication. Partial declarations of these fields are caught at codegen time. A separate softnpu_mcast.p4 test platform definition keeps multicast opt-in. ## Runtime support McastReplicationTag tracks per-copy group attribution (External / Underlay / Both) via bitwise OR, distinct from dendrite's MULTICAST_TAG_* wire encoding. Five new required methods on the Pipeline trait expose group management. ## Tests Integration tests covering varying multicast workflows. Two end-to-end HLIR tests verify slice alignment diagnostics through the full compiler pipeline.
zeeshanlakhani
added a commit
to oxidecomputer/softnpu
that referenced
this pull request
Mar 18, 2026
…protocol This extends the management message protocol with operations for multicast group lifecycle: create, destroy, add port, remove port, and list. These dispatch to the corresponding [p4rs](https://github.com/oxidecomputer/p4) Pipeline trait methods (add_mcast_group, remove_mcast_group, add_mcast_port, etc.) that were added to support bifurcated multicast replication in the p4rs codegen. Mutating operations (create, destroy, add, remove) are fire-and-forget, matching the existing TableAdd/TableRemove pattern. `MulticastGroupList` is the only round-trip operation, returning a sorted group-to-ports mapping for use by dendrite's `AsicMulticastOps` queries. The `MulticastPortAdd` struct carries rid and level1_excl_id for API parity with dendrite's AsicMulticastOps trait, though softnpu does not use them. Tofino's PRE handles per-replica identification and exclusion via these fields. softnpu handles the equivalent via `McastReplicationTag` in the codegenning. This branch depends on the related oxidecomputer/p4#240.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces two-group multicast replication (mcast_grp_a / mcast_grp_b) modeled after dendrite's replication contract and P4 sidecar expectations. When egress metadata declares the multicast field triplet, the generated pipeline replicates packets to group members with per-copy attribution tags, ingress-port exclusion, and mcast-over-broadcast precedence.
Fix a latent issue where non-byte-aligned multi-byte slices (e.g., field[11:4] on bit<32>) produced incorrect bitvec ranges after header byte-reversal. Validation moves to HLIR so these are now rejected at compile time with a diagnostic rather than silently generating wrong code.
The codegen path activates when egress_metadata_t declares all three fields: mcast_grp_a, mcast_grp_b, and mcast_replication. Partial declarations of these fields are caught at codegen time. A separate softnpu_mcast.p4 test platform definition keeps multicast opt-in.
McastReplicationTag tracks per-copy group attribution (External / Underlay / Both) via bitwise OR, distinct from dendrite's MULTICAST_TAG_* wire encoding. Five new required methods on the Pipeline trait expose group management.
Integration tests covering varying multicast workflows. Two end-to-end HLIR tests verify slice alignment diagnostics through the full compiler pipeline.