Skip to content

[sidecar/pipeline] P4 cleanup and a return to 18 stages#208

Open
zeeshanlakhani wants to merge 1 commit intomainfrom
zl/p4-stages-18-cleanup
Open

[sidecar/pipeline] P4 cleanup and a return to 18 stages#208
zeeshanlakhani wants to merge 1 commit intomainfrom
zl/p4-stages-18-cleanup

Conversation

@zeeshanlakhani
Copy link
Copy Markdown
Contributor

@zeeshanlakhani zeeshanlakhani commented Feb 3, 2026

P4/sidecar pipeline changes:

  • Unify route_result_t struct for Router4/Router6 to prevent PHV liverange divergence
  • Unify nexthop: replace separate nexthop_ipv4/nexthop_ipv6 with single nexthop (ipv6_addr_t) plus nexthop_is_v6 flag
  • Add TTL compound key (idx, route_ttl_is_1) to route tables for TTL offload
    • This includes Rust updates and a larger routing table for the compound key
  • Add @pa_no_init pragmas for metadata fields to guard against compiler init bugs
  • Add @pa_container_type("normal") pragmas for all ingress booleans and wider metadata fields to prevent mocha container corruption (whole-container writes clobbering neighboring fields)
  • Extend @pa_container_type to egress bridge header fields and drop_reason
  • Zero sc_pad at every sc_code write site (was uninitialized before)
  • Bridge header now includes is_mcast_routed for CPU copy detection

EgressFilter:

  • Moves EgressFilter from ingress to egress pipeline to free one ingress stage for NatEgressFilter
  • Adds nat_egress_hit to bridge header to carry NAT state across TM boundary
  • Control Plane: updates table path and match key (egress_port instead of ucast_egress_port)

Egress MacRewrite:

  • Creates separate unicast_mac_rewrite and mcast_mac_rewrite instances of MacRewrite
  • Unicast instance: rewrites src_mac only (dst_mac already correct from ARP/NDP)
  • Multicast instance: derives dst_mac from group address per RFC 1112/2464

Multicast Egress changes:

  • Checks egress_rid != 0 first to identify PRE-replicated packets
  • Validates is_mcast_routed for CPU copies (egress_rid == 0 but routed to multicast)
  • Drops any CPU copies with DROP_MULTICAST_CPU_COPY reason

Counters:

  • Moves Unicast, MulticastLL, EgressDropPort, EgressDropReason counters from multicast to base
  • Adds a Forwarded counter (for every packet copy that egresses the pipeline)
  • Removes Egress counter (from ingress pipe, replaced by per-port counters)
  • Removes MulticastDrop from MULTICAST_COUNTERS, as it's covered in general drop w/ reason
  • Handles link-local multicast counting in both MULTICAST and non-MULTICAST paths

Build:

  • Configures TOFINO_STAGES where there's 15 for base, 18 for multicast (the win!)

@zeeshanlakhani zeeshanlakhani force-pushed the zl/p4-stages-18-cleanup branch 2 times, most recently from ed6d7d9 to a75a02e Compare February 4, 2026 01:53
@zeeshanlakhani zeeshanlakhani self-assigned this Feb 9, 2026
@zeeshanlakhani zeeshanlakhani force-pushed the zl/p4-stages-18-cleanup branch from 0d3cbfc to 4367608 Compare February 9, 2026 21:08
@zeeshanlakhani zeeshanlakhani marked this pull request as ready for review February 10, 2026 23:39
@zeeshanlakhani zeeshanlakhani changed the base branch from main to multicast-e2e February 19, 2026 14:21
@zeeshanlakhani zeeshanlakhani force-pushed the multicast-e2e branch 2 times, most recently from 580af39 to 499f3c7 Compare February 20, 2026 11:47
@zeeshanlakhani zeeshanlakhani force-pushed the zl/p4-stages-18-cleanup branch 2 times, most recently from 52ac6a8 to c951d18 Compare February 24, 2026 06:24
@zeeshanlakhani zeeshanlakhani force-pushed the multicast-e2e branch 4 times, most recently from ab643d8 to 0b8a5d7 Compare March 2, 2026 04:25
@zeeshanlakhani zeeshanlakhani force-pushed the zl/p4-stages-18-cleanup branch 2 times, most recently from dbe4e51 to 2116f9b Compare March 5, 2026 22:12
@zeeshanlakhani zeeshanlakhani force-pushed the zl/p4-stages-18-cleanup branch 3 times, most recently from 6bf36ea to 3254541 Compare March 16, 2026 18:37
@zeeshanlakhani zeeshanlakhani force-pushed the zl/p4-stages-18-cleanup branch 2 times, most recently from ce88768 to 079b582 Compare April 6, 2026 18:39
*P4/sidecar pipeline changes*:

  * Unify route_result_t struct for Router4/Router6 to prevent PHV liverange divergence
  * Unify nexthop: replace separate nexthop_ipv4/nexthop_ipv6 with single nexthop (ipv6_addr_t) plus nexthop_is_v6 flag
  * Add TTL compound key (idx, route_ttl_is_1) to route tables for TTL offload
    - This includes Rust updates and a larger routing table for the compound key
  * Add @pa_no_init pragmas for metadata fields to guard against compiler init bugs
  * Add @pa_container_type("normal") pragmas for all ingress booleans and wider metadata fields to prevent mocha container corruption (whole-container writes clobbering neighboring fields)
  * Extend @pa_container_type to egress bridge header fields and drop_reason
  * Zero sc_pad at every sc_code write site (was uninitialized before)
  * Bridge header now includes is_mcast_routed for CPU copy detection

*EgressFilter*:

  * Moves EgressFilter from ingress to egress pipeline to free one ingress stage for NatEgressFilter
  * Adds nat_egress_hit to bridge header to carry NAT state across TM boundary
  * Control Plane: updates table path and match key (egress_port instead of ucast_egress_port)

*Egress MacRewrite*:

  * Creates separate unicast_mac_rewrite and mcast_mac_rewrite instances of MacRewrite
  * Unicast instance: rewrites src_mac only (dst_mac already correct from ARP/NDP)
  * Multicast instance: derives dst_mac from group address per RFC 1112/2464

*Multicast Egress changes*:

  * Checks egress_rid != 0 first to identify PRE-replicated packets
  * Validates is_mcast_routed for CPU copies (egress_rid == 0 but routed to multicast)
  * Drops any CPU copies with DROP_MULTICAST_CPU_COPY reason

*Counters*:

  * Moves Unicast, MulticastLL, EgressDropPort, EgressDropReason counters from multicast to base
  * Adds a Forwarded counter (for every packet copy that egresses the pipeline)
  * Removes Egress counter (from ingress pipe, replaced by per-port counters)
  * Removes MulticastDrop from MULTICAST_COUNTERS, as it's covered in general drop w/ reason
  * Handles link-local multicast counting in both MULTICAST and non-MULTICAST paths

*Build*:

  * Configures TOFINO_STAGES where there's 15 for base, 18 for multicast (the win!)
@zeeshanlakhani zeeshanlakhani force-pushed the zl/p4-stages-18-cleanup branch from 079b582 to 808e4dd Compare April 6, 2026 19:04
@zeeshanlakhani
Copy link
Copy Markdown
Contributor Author

Decided to target main as we're gated throughout for mcast's 18 stages.

@zeeshanlakhani zeeshanlakhani changed the base branch from multicast-e2e to main April 6, 2026 19:31
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