Skip to content

[multicast] Add multicast replication support for (upcoming) softnpu/a4x2#240

Open
zeeshanlakhani wants to merge 1 commit intomainfrom
zl/multicast
Open

[multicast] Add multicast replication support for (upcoming) softnpu/a4x2#240
zeeshanlakhani wants to merge 1 commit intomainfrom
zl/multicast

Conversation

@zeeshanlakhani
Copy link
Contributor

@zeeshanlakhani zeeshanlakhani commented Mar 17, 2026

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.

  • Slice codegen fix

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.

  • Multicast

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.

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 zeeshanlakhani marked this pull request as ready for review March 18, 2026 05:32
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.
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.

1 participant