[p4, sidecar] fix underlay/external mcast counter ops - #362
Open
zeeshanlakhani wants to merge 1 commit into
Open
[p4, sidecar] fix underlay/external mcast counter ops#362zeeshanlakhani wants to merge 1 commit into
zeeshanlakhani wants to merge 1 commit into
Conversation
zeeshanlakhani
force-pushed
the
zl/mcast-p4-counters
branch
5 times, most recently
from
September 3, 2026 05:25
ee83887 to
873c3d3
Compare
A replica still carrying a Geneve header at the egress counter block is bound
for an underlay port, while external replicas are decapsulated earlier, at
ingress, for external-only groups or in `mcast_egress` for bifurcated
(external + underlay members) ones. Previously, we used a conditional:
```p4
else if (hdr.geneve.isValid()) {
```
... on Geneve hdr validity too early in the chain to determine an
external- vs underlay-destined packet, and we didn't consider using the
`is_egress_rid_mcast` check at all.
## The Fix
Now, we treat the three conditions for link-local, external mcast, and
underlay mcast independently and more explicitly given the egress rid,
which is 0 for link-local multicast packets and combines with Geneve hdr
validity to determine the count for underlay vs external.
The underlay and external arms key on `is_egress_rid_mcast` and not the
negation of `is_link_local_ipv6_mcast`: the compiler doesn't carry the
negation into the later gateways of the pipeline, which meant that a
link-local packet incremented `external_mcast_ctr` alongside its own
counter. This is now handled because link-local replicas arrive with
`egress_rid` of 0, and scope 2 is refused at group creation, so no
replicated packet ever carries a link-local outer destination.
zeeshanlakhani
force-pushed
the
zl/mcast-p4-counters
branch
from
September 3, 2026 09:21
873c3d3 to
cf6c3e5
Compare
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.
A replica still carrying a Geneve header at the egress counter block is bound for an underlay port, while external replicas are decapsulated earlier, at ingress, for external-only groups or in
mcast_egressfor bifurcated (external + underlay members) ones. Previously, we used a conditional:... on Geneve hdr validity too early in the chain to determine an external- vs underlay-destined packet, and we didn't consider using the
is_egress_rid_mcastcheck at all.The Fix
Now, we treat the three conditions for link-local, external mcast, and underlay mcast independently and more explicitly given the egress rid, which is 0 for link-local multicast packets and combines with Geneve hdr validity to determine the count for underlay vs external.
The underlay and external arms key on
is_egress_rid_mcastand not the negation ofis_link_local_ipv6_mcast: the compiler doesn't carry the negation into the later gateways of the pipeline, which meant that a link-local packet incrementedexternal_mcast_ctralongside its own counter. This is now handled because link-local replicas arrive withegress_ridof 0, and scope 2 is refused at group creation, so no replicated packet ever carries a link-local outer destination.