Skip to content

feat(network): standard CQF synthesis baseline (REQ-TSN-SYNTH-CQF-BASE-001)#291

Merged
avrabe merged 1 commit into
mainfrom
feat/v0.20.0-cqf-synth
Jun 15, 2026
Merged

feat(network): standard CQF synthesis baseline (REQ-TSN-SYNTH-CQF-BASE-001)#291
avrabe merged 1 commit into
mainfrom
feat/v0.20.0-cqf-synth

Conversation

@avrabe

@avrabe avrabe commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

What

Standard 802.1Qch CQF (Cyclic Queuing and Forwarding) synthesis — the second TSN synthesizer, complementing the Qbv GCL baseline (#290). synthesize_cqf takes a set of reserved flows (each with a per-cycle reservation in bits, a path, and an end-to-end deadline) and produces a CqfSchedule: a global cycle time T plus per-link admission.

This implements REQ-TSN-SYNTH-CQF-BASE-001 (standard two-buffer, single-cycle-T baseline), a deliberate precursor split from REQ-TSN-SYNTH-CQF-001 — mirroring the REQ-TSN-SYNTH-QBV-BASE-001 → REQ-TSN-SYNTH-QBV-001 split.

Why CQF is the clean next synthesis target

CQF's worst-case end-to-end delay is structurally decoupled from per-link load: a frame received in cycle c is forwarded in c+1, so for H hops at cycle time T:

(H − 1)·T  ≤  D  ≤  (H + 1)·T

independent of topology and load, given no cycle is oversubscribed (IETF draft-eckert-detnet-tcqf-05, IEEE 802.1Qch). So feasibility factors into two small, local checks — no network-calculus curve composition:

  1. structural delay(H+1)·T ≤ deadline for every flow;
  2. per-cycle admission — every link's aggregate reservation ≤ csize = T·link_rate.

That is exactly why CQF routes around the network-wide NC-composition bridge that an MILP frame-scheduler needs to be both necessary and checkable. Synthesis: pick the largest whole-ns T meeting every deadline (looser T → more bandwidth, so the deadline-limited T maximizes admission headroom), then admit iff every link fits csize.

The oracle is anchored to external ground truth

Unlike the Qbv baseline (whose oracle was self-consistent against its own checker), the CQF checker's delay formula is pinned to a published worked example in draft-eckert-detnet-tcqf-05:

*"if the number of hops is 24, when cycle interval is set to 10us, the end-to-end latency bound can be around (24+1)10 = 250 us."

delay_bound_matches_published_tcqf_example asserts cqf_delay_max_ps(24, 10µs) == 250µs and cqf_delay_min_ps == 230µs (jitter exactly 2T). So if the delay model were subtly wrong (e.g. H·T instead of (H+1)·T), the pin fails against the literature — something a self-consistent synth↔checker loop would miss. The synthesizer self-certifies against this same checker before returning.

Falsification statement

If synthesize_cqf returns a CqfSchedule with cycle time T, then (a) for every input flow, (hops+1)·T ≤ deadline_ps, and (b) for every link, the aggregate per-cycle reservation ≤ T·link_rate — where the delay formula matches the IETF TCQF published bound. Otherwise it returns a typed CqfSynthError. A returned schedule in which any flow misses its deadline, or any link exceeds csize, or whose delay formula disagrees with the 250µs/230µs TCQF example, falsifies this.

Scope notes (honest to the primitive)

  • Standard two-buffer CQF, one global cycle time, homogeneous link rate, reservation-based admission. Multi-CQF/TCQF (3–7 tagged buffers, heterogeneous cycles, per-flow injection-time planning across a hyperperiod, metaheuristic scale numbers) is REQ-TSN-SYNTH-CQF-001, deferred to v0.21.0.
  • synthesize_cqf is a library primitive with a unit oracle; there is no AADL→synth→export path yet (the DEC-TSN-OSS-001 wedge is demonstrated once the bridge exists).
  • No solver, no new dependency — pure integer arithmetic; builds with --no-default-features.

Gates (local)

  • cargo test -p spar-network — 134 lib pass (7 new CQF) + integration green
  • cargo clippy -p spar-network --all-targets -- -D warnings — clean
  • cargo fmt -p spar-network -- --check — clean
  • cargo build -p spar-network --no-default-features — OK

🤖 Generated with Claude Code

…E-001)

Synthesize a standard two-buffer 802.1Qch CQF configuration from a set of
reserved flows: pick the largest whole-nanosecond global cycle time T meeting
every flow's structural deadline (H+1)*T, then admit iff every link's
aggregate per-cycle reservation fits the cycle budget csize = T*link_rate.

CQF's bounded delay depends only on (hops, T), not on per-link load, so the
oracle factors into two small LOCAL checks with no network-calculus curve
composition — which is exactly why CQF routes around the NC-composition bridge
an MILP frame-scheduler needs. The CQF delay checker is PINNED to the published
worked example in IETF draft-eckert-detnet-tcqf-05 (24 hops, 10us cycle =>
(24+1)*10 = 250us; D_min 230us; jitter 2T), so the synth<->checker duality
anchors to external ground truth, not the synthesizer's own assumptions.
Self-certifying: synthesize_cqf re-derives every flow's delay and every link's
budget through the independent checker before returning.

Precursor to REQ-TSN-SYNTH-CQF-001 (Multi-CQF/TCQF: 3-7 tagged buffers,
heterogeneous cycles, injection planning), now re-scoped to v0.21.0 — mirroring
the REQ-TSN-SYNTH-QBV-BASE-001 -> REQ-TSN-SYNTH-QBV-001 split. Pure arithmetic,
NO solver, NO new dependency; builds with --no-default-features.

TEST-TSN-SYNTH-CQF-BASE: 7 unit tests (literature delay pin, multiflow
admission, monotone cycle-vs-deadline, DeadlineTooTight/Oversubscribed/shared-
link/input-validation negatives). cargo test -p spar-network 134 lib pass;
clippy -D warnings clean; fmt clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Rivet verification gate

20/20 passed

count
Passed 20
Failed 0
Skipped (no steps) 0

Filter: (and (= type "feature") (or (has-tag "v093") (has-tag "v0100")))

Failed artifacts

(none)

Updated automatically by tools/post_verification_comment.py. Source of truth: artifacts/verification.yaml.

@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.73585% with 26 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/spar-network/src/cqf.rs 87.73% 26 Missing ⚠️

📢 Thoughts on this report? Let us know!

@avrabe avrabe merged commit 5cf80ba into main Jun 15, 2026
17 of 18 checks passed
@avrabe avrabe deleted the feat/v0.20.0-cqf-synth branch June 15, 2026 07:43
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