Repository navigation
feat(usid): Count VRF traffic in both directions - #846
Merged
Merged
Conversation
privateip
force-pushed
the
feat/usid-vrf-direction-metrics
branch
from
October 12, 2026 17:13
c5dbf5f to
2d178be
Compare
The uSID datapath counted per-VRF traffic only inbound, at the vrf_table
match and including packets dropped afterwards, and never exported its
per-VRF drop count. Outbound tenant traffic was not counted per VRF.
Add vrf_traffic_counters, a per-CPU hash keyed like vrf_table, holding
forwarded packets, tenant bytes and claimed drops for each direction:
- ingress at usid_ingress's warm and cold-neighbor redirects
- egress at usid_egress's encapsulating and VIP-reply redirects, which
covers egress shards, and at the service path's redirects
- same-node traffic, which never reaches usid_ingress, once in each
direction at the receiver's local pass-through entry, except traffic
to the sender's own gateway
- drops at every count_claimed_drop site, split by direction
Bytes are the tenant packet alone in both directions. The map is
additive; no existing map changes layout. The datapath only looks rows
up. VRFTable creates a row with BPF_NOEXIST on Register, removes it on
Unregister and reconciles both maps on every GC pass, so every
vrf_table writer keeps them in step, and galactic-cni syncs them once
at load so an upgraded node counts from its first packet.
Export galactic_usid_vrf_forwarded_packets_total,
galactic_usid_vrf_forwarded_bytes_total and
galactic_usid_vrf_dropped_packets_total, each with a direction label.
The existing galactic_usid_vrf_{packets,bytes}_total are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
privateip
force-pushed
the
feat/usid-vrf-direction-metrics
branch
from
October 12, 2026 17:14
2d178be to
d48b138
Compare
Contributor
Author
|
Lab results from the containerlab lab running this branch's CNI image: 20 ICMPv6 echoes of 148 bytes each. Site A to site B in VPC 10 crosses the fabric, and the two VPC 30 pods share one node, so each echo and each reply counts once in each direction there. Every series that stayed at zero is left out. Merge order. #596 and #598 change the same datapath source, its metrics and the installer, #613 changes the installer, and #597 changes the CNI architecture doc. Each one that merges after this needs a rebase, and #596 and #598 also need a fresh verifier cost check. Which lands first is open. |
privateip
marked this pull request as ready for review
October 12, 2026 18:04
scotwells
approved these changes
Oct 12, 2026
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.
Summary
Operators could see a VPC's traffic only inbound, counted before drops and including tunnel headers, and nothing counted a VPC's outbound traffic or its datapath drops per VPC.
The datapath now counts forwarded packets, tenant bytes and drops for each VPC on each node, inbound and outbound, including traffic between two pods on the same node, which never crosses the fabric.
The counts live in a new per-CPU map that userspace keeps in step with the VRF map, so no existing map changes layout and no attachment loses its rows on upgrade.
Maps and metrics
The names say "forwarded" because they count a packet once the datapath commits to forwarding it, unlike the existing per-VRF packet and byte counters, which count every claimed inbound packet, drops included, and stay as they are.
Lab results and the merge order with four overlapping PRs are in the first comment.
Test plan
Related to #589