Reliability in XDP is a state-budget problem
Implementing IEEE 802.1CB-style replication and elimination near the Linux receive path forces every guarantee through verifier constraints, bounded state, cache locality, and explicit sequence-window semantics.
- problem
- Frame replication and elimination for reliability must reject duplicates and preserve useful traffic at line rate, but the XDP program is constrained by verifier-provable bounds, finite map state, packet reordering, sequence wraparound, and the cost of every memory access.
- scope
- A public architectural explanation of flow identity, sequence recovery windows, BPF map design, verifier-aware parsing, observability, and the relationship between 802.1CB reliability and adjacent TSN timing mechanisms.
- environment
- Linux networking with eBPF/XDP programs, Rust user-space control through Aya or libbpf-rs, custom embedded Linux images, and time-sensitive Layer 2 traffic.
Assumptions
- Frames carry or can be associated with a bounded sequence identity suitable for duplicate elimination.
- The control plane can install flow rules and inspect counters without placing policy parsing in the hot path.
- Sequence-window width and state lifetime are configured from traffic and fault assumptions rather than guessed globally.
Limitations
- This note omits proprietary topology, packet formats, deployment details, and benchmark numbers.
- It is not a complete IEEE conformance guide and does not replace the normative standards.
- The pseudocode simplifies checksum, metadata, and multi-interface redirect details to focus on state invariants.
Table of contents 5 sections
Reliability is not duplication
Replicating a frame onto disjoint paths is easy to describe and dangerous to leave underspecified. The receiver must know which copies represent the same logical frame, how long to remember that identity, how much reordering is acceptable, what happens at sequence wraparound, and when stale state may be reclaimed. Without those decisions, duplication moves loss probability while creating a new failure mode: valid traffic is discarded as a duplicate or duplicate traffic escapes into the application.
The useful abstraction is a recovery function keyed by a stable stream identity. For each stream, the data plane tracks a highest accepted sequence and a bounded bitmap of recently observed positions. A frame ahead of the window advances state. A frame inside the window is accepted only if its bit is clear. A frame behind the retained window is stale. This is not an unbounded replay cache; it is a deliberate state budget whose width encodes the maximum reordering and delay differential the system claims to tolerate.
The verifier shapes the parser
XDP runs before the normal socket stack has paid most of its costs, which is exactly why the program has to prove memory safety with packet bounds checks the verifier can follow. A production parser does not cast the packet to a tower of C structs and hope. It advances explicit offsets, validates data_end before every dereference, handles optional VLAN layers with bounded unrolling, and rejects unsupported layouts early.
The program also separates policy from mechanism. The hot path should not parse a dynamic configuration language or chase a graph of pointers. User space resolves policy into compact map entries: flow key, action, egress set, sequence mode, and recovery-window parameters. The XDP program performs the smallest bounded lookup and update needed to enforce that decision. If the verifier cannot establish the bound, the architecture is asking kernel space to do too much.
if ((void *)(eth + 1) > data_end) return XDP_ABORTED; flow_key = parse_bounded_l2_key(data, data_end);rule = bpf_map_lookup_elem(&flow_rules, &flow_key);if (!rule) return XDP_PASS; seq = read_sequence(data, data_end, rule);state = bpf_map_lookup_elem(&recovery_state, &flow_key);if (!state) return initialize_and_accept(flow_key, seq); if (!window_accept(state, seq)) { count_drop(flow_key, DROP_DUPLICATE_OR_STALE); return XDP_DROP;} return XDP_PASS;Map state is a concurrency decision
A recovery window is mutable shared state. The map type decides memory placement, eviction, lookup cost, and contention behavior. A global hash map is simple but can turn a hot stream into a cacheline fight across receive queues. Per-CPU maps remove write contention but make one logical stream visible as several local histories unless steering guarantees affinity. LRU maps bound memory but can evict active state under pressure and silently reset the replay boundary.
There is no universally correct map. The choice follows RSS steering, stream cardinality, failure tolerance, and whether the sequence state must remain coherent across CPUs. The control plane monitors allocation failures and eviction pressure, because a reliability mechanism that loses state without reporting it is worse than an explicit degraded mode. State lifetime must also follow a monotonic clock and a bounded inactivity policy so dead streams cannot pin kernel memory forever.
| choice | advantage | failure pressure | required proof |
|---|---|---|---|
| global hash | coherent stream history | lock/cacheline contention | multi-queue stress and bounded cardinality |
| per-CPU hash | cheap local updates | split history across CPUs | stable steering or explicit merge semantics |
| LRU hash | bounded memory | active-state eviction | eviction telemetry and safe reinitialization |
| array/indexed state | predictable lookup | fixed key space | validated flow indexing and provisioning |
TSN mechanisms compose; they do not substitute for one another
Frame replication and elimination addresses path or link faults by accepting the first valid copy and suppressing later replicas. It does not create synchronized time, reserve an egress slot, or preempt a large best-effort frame. IEEE 802.1AS supplies time synchronization, 802.1Qbv supplies a time-aware transmission schedule, and 802.1Qbu reduces blocking through frame preemption. Treating any one of them as the entire real-time story produces a system that is correct only in diagrams.
The implementation boundary must preserve those distinctions. The XDP path can classify and replicate or eliminate frames, but schedule conformance and egress timing may live elsewhere in the Linux traffic-control and driver stack. Observability has to correlate them: sequence duplicate rate, recovery-window movement, redirect errors, gate state, clock quality, queue occupancy, and late traffic. A packet dropped by the recovery function is different from a packet that missed a transmission window, even if both appear as application loss.
- 802.1CB: replicate and eliminate redundant copies for reliability.
- 802.1AS: establish a shared time base and expose clock-quality failure.
- 802.1Qbv: schedule traffic classes against that time base.
- 802.1Qbu: reduce blocking by allowing eligible high-priority traffic to preempt lower-priority transmission.
- Linux/XDP control plane: bind stream policy, kernel state, interface topology, and telemetry into one inspectable operating model.
Prove the fast path without perturbing it
Printing from the data plane is not observability. The hot path should emit bounded counters and compact sampled events, each carrying a reason code the control plane can resolve. Required signals include accepted-first-copy, duplicate, stale-window, parse-reject, missing-rule, state-allocation-failure, redirect-failure, and sequence-reset. Per-CPU counters can keep writes local while user space aggregates them at a cadence that does not turn monitoring into the bottleneck.
The test matrix is sequence-heavy: in-order copies, replica inversion, maximum tolerated reordering, one step beyond the window, wraparound, state expiry, CPU migration, map pressure, malformed headers, and control-plane rule replacement while traffic is active. Performance evidence is also bounded by truth: report the kernel, NIC, queue topology, packet size, CPU placement, map type, and traffic shape or do not publish a headline rate. A fast-path number without its execution environment is not evidence.
Why no throughput number appears here
The public record establishes the implementation domain, not a reproducible benchmark environment. Inventing Mpps, latency, or CPU figures would weaken the note. A valid benchmark needs source, build, hardware, topology, traffic generator, affinity, packet distribution, and loss accounting.
- implemented 802.1CB fast-path implementation
The public CV records implementation of IEEE 802.1CB Frame Replication and Elimination for Reliability with eBPF/XDP, Rust, Aya, and libbpf-rs in a real-time Layer 2 networking stack.
- sourced Linux XDP execution model
The kernel documentation establishes the early receive-path execution model, BPF maps, redirect actions, and verifier constraints used in this explanation.
inspect source ↗