Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

roce-preflight

Why won't RoCE come up — and which GID index should you use?

A GID-selection diagnostic for RoCE, plus an open configuration & host-path inspector around it. It reads the real system state that decides whether RoCE will come up and names the GID index to use — the one thing in here with repeated, still-unresolved public demand (the evidence). The surrounding checks are reasonable hygiene; four of the tool's ~12 checks are backed by public failures and eight are not, and this README says which is which.

CI Python Backend Website

🌐 Project site: 0xsoftboi.github.io/roce-preflight — overview, diagrams, and a browsable sample report.

Is this your problem?

If you pasted one of these into a search box, yes:

What you're seeing What it usually is Try
Failed to modify QP to RTR / ibv_modify_qp returns EINVAL the GID index you asked for is all-zeros — the table is partitioned across SR-IOV / macvlan / netns slices and that entry belongs to someone else roce-preflight doctor --device <dev>
ibv_modify_qp failed with error Network is unreachable (ENETUNREACH) you're on an fe80:: link-local GID, which has no route once the peer is off-subnet same
ibv_create_ah(... sgid_index=0 ... dgid=fe80::...) failed: No such device same thing, one layer up — UCX/NIXL defaulted to index 0 same
read failed in ncclIbRoceGetVersionNum: Invalid argument NCCL is reading gid_attrs/types/<i> for an index that isn't populated same
No suitable GID found on an IPv6-only fabric auto-selection couldn't rank a global-unicast GID above the link-local one same
Connects fine, then transport retry counter exceeded under load a break in the PFC ↔ ECN ↔ DSCP ↔ MTU chain — note: this one is the unevidenced half of the tool, see below roce-preflight qos --device <dev>

It prints the GID index to actually use, and the NCCL_IB_GID_INDEX / MC_GID_INDEX / UCX_IB_GID_INDEX to set. If your problem isn't in this table, the gaps are written down rather than left for you to discover.

Quickstart

pip install git+https://github.com/0xSoftBoi/roce-preflight

roce-preflight doctor   --device mlx5_0   # why won't RoCE come up? (+ which GID index to use)
roce-preflight qos      --device mlx5_0   # is the PFC/ECN/DSCP/MTU chain coherent?
roce-preflight hostpath --device mlx5_0   # is the host throttling a healthy card?

The inspectors have zero Python dependencies — they read sysfs and shell out to rdma-core, so the thing you reach for at 2am installs with nothing behind it. Plotting sweep results is the one thing that needs a dependency: pip install "roce-preflight[plot] @ git+https://github.com/0xSoftBoi/roce-preflight" (or just pip install matplotlib). Running from a clone works too — python cli.py <command> is the same entry point.

No RDMA hardware to hand? Every command takes --backend simulate; doctor takes --demo-partitioned (the common real case) and --demo-broken (the soft-RoCE case), and qos takes --demo-broken. To get a genuine RDMA device on any Linux box, see docs/PROVISIONING.md.

Status: what is real, and what isn't

Read this before trusting any output.

What actually runs on your hardware: doctor, qos, hostpath and qp read real system state; hostping and preflight implement localization logic but no measurement backend; sweep, congestion and probe emit clearly labelled simulated numbers.

Command Tier On a real RDMA host you get Public cases it would have solved
doctor ▣ real inspection Real GID table / IPv6-LL / port state from sysfs, with the exact fix 7 direct, 4 partial — all on the GID checks (list)
qos ▣ real inspection Real trust-mode / dscp2prio / PFC / ECN / MTU (mlx5 only today — see below) none found
hostpath ▣ real inspection Real PCIe LnkCap-vs-LnkSta, NUMA node, ACS from lspci none found
qp ▣ real verbs RC/UC/UD driven to RTS and payload-verified — proven in CI none found (public failures are cross-node)
discover ▣ real Devices/ports/transports via pyverbs or rdma-core tools —
hostping ◐ analysis only SKIP — the loopback/R2R measurement is not implemented —
preflight ◐ analysis only SKIP — the QP bring-up driver is not implemented —
sweep, congestion, probe, qualify ○ synthetic unless perftest + 2 endpoints exist Clearly labeled SIMULATED numbers otherwise —

Four honest caveats:

  1. "None found" means nobody filed a public issue that keyword search surfaced — not that the failure doesn't happen. Most production RoCE debugging happens where you can't read it. But it does mean those checks are currently unevidenced, and you should weight them accordingly. docs/EVIDENCE.md has the method, the case list, and the substitutes that already do parts of this better.
  2. The ◐ commands implement localization logic, not measurement. Their analysis is unit-tested — against matrices this repo also generates. That proves internal consistency, not agreement with reality. They need two endpoints, which one host cannot provide (why).
  3. qos is effectively Mellanox-only right now. mlnx_qos and the mlx5 ECN sysfs tree are both out-of-tree MLNX_OFED interfaces. On a Broadcom/Intel/ Marvell host it will find the device and then report nothing for the whole QoS chain. Moving to dcb (iproute2) is priority 2 in the plan.
  4. Soft-RoCE is not a performance reference. Any bandwidth/latency number from rxe says the code path works, not what your NIC will do.

Start with doctor — it reads real state and is the one part with confirmed, recurring demand. docs/EVIDENCE.md is the survey behind that claim (including where the tool comes up empty and what already does it better), docs/IMPROVEMENT_PLAN.md is what's next and why, PRIOR_ART.md is the literature survey behind the direction.

Verified on real hardware

Every push builds rdma_rxe from kernel source on a GitHub runner, stands up a real RDMA device, and runs the harness against it — asserting the backend is not the simulator, so the job fails loudly rather than passing on synthetic data. (soft-roce.yml)

The first time it ran, it found four defects that 197 passing unit tests never could — then caught an attempted fix that was wrong:

A two-minute CI job that builds rdma_rxe and runs the harness against a real RDMA device found four defects, all since fixed and re-verified on hardware.

$ python cli.py qp --device rxe0          # on the real device, in CI
TRANSPORT  STATUS  REACHED
RC         PASS    verify_data
UC         PASS    verify_data
UD         PASS    verify_data

That is the project's actual quality claim: not "the tests pass", but "the code has been run against a real RDMA device and the output was read."

Contents

If you're here to fix something

If you're here to judge whether to trust it

If you're here for the engineering


The problem it solves

In a GPU training cluster, the collective operations that synchronize every step — all-reduce, all-gather — are synchronous: the job runs at the speed of the slowest link. So a single NIC that is misconfigured (a GID/MTU mistake that keeps its queue pairs from reaching RTR), intermittently faulty (responder CQE errors, endless RNR retries), or badly tuned for congestion (ECN/PFC) usually doesn't fail loudly — it quietly drags a whole multi-GPU job down, and you find out days later from mysteriously bad throughput (why one straggler stalls a collective).

Qualification is how you catch that card on the bench, before it is in service — not by watching training throughput mysteriously tank. This harness automates that check, and it is grounded in failure modes that soft-RoCE and RoCE actually exhibit:

Real, documented failure mode How it shows up Caught by
QP never reaches RTR — ibv_modify_qp returns EINVAL until the interface has its EUI-64 IPv6 link-local address / the right GID index (ref) modify_rtr FAIL; the lifecycle stops exactly there Stage 2 — QP lifecycle
MTU mismatch — endpoints silently negotiate down to 1024 B, or latency jumps at the MTU boundary (ref) a flagged latency cliff / bandwidth step Stage 3 — sweep anomaly flags
Responder/requester CQE errors, RNR retries, flush-with-error on teardown (ref) non-success work-completion status + correlated dmesg Stages 2 & 5
Congestion mis-tuning — ECN not marking, or PFC pause storms under load ECN/PFC counter deltas that don't move (or spike) Stage 4 — congestion counters
One slow link / straggler dragging a collective (ref) throughput far below its peers the overall verdict

doctor — the one part with confirmed demand

The most-reported RoCE bring-up failure is ibv_modify_qp to RTR failing — EINVAL ("Failed to modify QP to RTR"), ENETUNREACH ("Network is unreachable"), or a bare timeout — and the error tells you nothing about why. Reading the trackers, the cause is nearly always the wrong GID index, in one of two flavours:

  • The table is partitioned. SR-IOV VFs, macvlan/IPVLAN sub-interfaces and network namespaces each own a slice of the port's shared GID table, so the indices belonging to other slices read back as all-zeros. Your GIDs are at index 4, you asked for 0 (nccl #1573, uccl #301).
  • The index you got is link-local. GID 0 is fe80::, which has no route off the subnet, so the address handle fails the moment the peer is elsewhere. The routable RoCEv2 entry is further down the table (Mooncake #2747 — still open, ROCm/ATOM #1748 — still open, nccl-tests #185 — open with zero replies since 2023).

python cli.py doctor --device mlx5_0 reads the real GID table, port state, link layer, netdev IPv6 state and MTU from sysfs, and prints the cause plus the index to actually use:

$ python cli.py doctor --device mlx5_0     # --demo-partitioned shows this without hardware

[OK  ] port_state: port 1 is 4: ACTIVE
[OK  ] link_layer: link_layer=Ethernet
[FAIL] gid: GID index 0 is all-zeros — this is the concrete reason `ibv_modify_qp`
       to RTR returns EINVAL. The table is NOT empty — indices [4, 5] are
       populated, so nothing is wrong with the netdev's addressing; index 0
       simply isn't yours. A port's GID table is shared and partitioned across
       SR-IOV VFs, macvlan/IPVLAN sub-interfaces and network namespaces [...]
       Fix: select a populated index instead — `--gid-index 5`
       (GID[5]=::ffff:10.102.9.101 type=RoCE v2 ndev=eth0), or set
       `NCCL_IB_GID_INDEX=5` / `MLX5_GID_INDEX=5`.
[OK  ] ipv6_link_local: eth0 has an IPv6 link-local address

--demo-broken shows the other flavour — a fully empty table on soft-RoCE, where the netdev genuinely has no IPv6 link-local address and the fix is a sysctl (rdma-core's rxe docs, the linux-rdma list, Mooncake #1766). Telling those two apart matters: the survey found the tool was giving the soft-RoCE advice for the partitioned case, which would have renumbered a working interface. That's fixed and regression-tested.

Nothing here is a benchmark or a simulation — the --demo-* flags just let you see a diagnosis without a NIC. What doctor does not do is in the gaps table; a green run means bring-up preconditions hold, which is necessary and nowhere near sufficient.

qos — the RoCE config linter nobody open-sourced (but nobody has asked for either)

Read the caveat first: the issue-tracker survey found zero public cases this module would have closed (why that's weak but real evidence), and on Mellanox hardware mlnx_qos -i already prints the trust mode, dscp2prio and PFC vector that this reads. It is here because the papers say the problem is real, not because the trackers do. The genuinely unfilled niche is vendor neutrality — and qos doesn't fill it yet, because it is hardcoded to mlnx_qos and the mlx5 ECN tree.

Bring-up succeeding isn't the same as RoCEv2 being lossless. Once a QP connects, the failure that bites under real load is transport retry counter exceeded — packets left the NIC and no ACK came back — and on RoCE that is almost always an incoherence in the PFC ↔ ECN ↔ DSCP ↔ MTU chain, not a bad cable. Every scale paper (RDMA over Commodity Ethernet at Scale, Azure NSDI '23, Alibaba NSDI '21) names this as a top operational pain and each solved it with internal tooling that was never released (see PRIOR_ART.md); the congestion-control papers (DCQCN, HPCC, ACC) tune those knobs but don't validate they cohere.

python cli.py qos --device mlx5_0 is that validator — read-only and walking the packet's whole life. Each break prints the concrete cause and the exact command to fix it:

The RoCEv2 losslessness chain: DSCP marking, NIC trust mode, dscp2prio, PFC, ECN and MTU. A break at PFC surfaces under load as transport retry counter exceeded.

$ python cli.py qos --device mlx5_0 --demo-broken   # --demo-broken shows it without hardware

[FAIL] trust_mode: eth0 trust state is 'pcp', not 'dscp' — the NIC ignores your
       DSCP and keys off VLAN PCP, so the whole DSCP→prio→PFC chain is bypassed.
       Fix: `sudo mlnx_qos -i eth0 --trust dscp`.
[FAIL] pfc: RoCE priority 3 has PFC DISABLED on eth0 (PFC is on for [0]). That
       priority is lossy, so RoCEv2 drops under load → 'transport retry counter
       exceeded'. Fix: `sudo mlnx_qos -i eth0 --pfc 0,0,0,1,0,0,0,0`.

It reads mlnx_qos, the mlx5 ECN sysfs tree, and the netdev MTU where they exist; on soft-RoCE (no QoS tree) it runs in --demo-broken / simulate so the logic is exercised everywhere. Two things it cannot do: it never sees the switch side of the chain (and a PFC mismatch needs both), and it cannot discover what DSCP your traffic actually carries — pass --dscp, or it warns rather than guessing, because NCCL's documented NCCL_IB_TC default is 0, not the conventional 26. Pairs with the multi-NIC GID guide.


The other half: a qualification harness

An automated qualification test suite for RDMA-capable NICs. It behaves like the kind of harness a hardware/platform team runs against new network cards before they are allowed into a production cluster: enumerate the device, prove the verbs layer works, sweep latency/bandwidth, stress it with competing flows, correlate kernel logs, and emit a single pass/fail qualification report per device.

It is built to run on soft-RoCE (rdma_rxe) so it works on any Linux host with no special hardware, while remaining structured so the exact same tests can target real hardware (mlx5, etc.) purely through configuration.

Latency and bandwidth vs message size (simulated sample output)
Example output: latency and bandwidth vs. message size, produced by cli.py sweep. (Watermarked SIMULATED — see the honesty note.)

Why this exists, and what it isn't. I built this to actually understand how RDMA NICs get qualified — the verbs API, the QP state machine, how congestion and the counters behind it really behave — by building the thing a qualification pipeline is, rather than reading about it. It is a serious learning-by-building effort, not a production tool. Soft-RoCE is a software RoCE implementation: it is correct at the verbs level but its latency/bandwidth numbers are not representative of real hardware (no NIC offload, everything runs on the host CPU). Every number this harness reports on soft-RoCE should be read as "the pipeline works and the transport is functional", never as a performance claim. See What's simulated vs. real hardware.

What it does

One command, python cli.py qualify --device rxe0, runs eight stages against a device and writes a per-device pass/fail report. Each stage answers one of the questions above, and every stage degrades cleanly when a tool or the RDMA stack is missing (reported as SKIP, never a crash).


Architecture

The CLI resolves a backend, then runs the eight stages in order; each stage is wrapped in a kernel-log capture so any RDMA/NIC dmesg lines emitted during that stage are attached to it. Results aggregate into one report.

flowchart TB
    CLI["cli.py qualify --device rxe0"] --> DET{"detect_backend()"}

    DET -->|pyverbs present| PV["pyverbs<br/>(raw verbs API)"]
    DET -->|rdma-core tools present| TL["tools<br/>(ibv_devinfo, rdma, perftest)"]
    DET -->|nothing available| SM["simulate<br/>(labeled synthetic data)"]

    PV --> PIPE
    TL --> PIPE
    SM --> PIPE

    subgraph PIPE["Qualification pipeline (per device)"]
      direction TB
      S1["1 · Discovery<br/>devices, ports, transports"]
      S2["2 · QP lifecycle<br/>RC / UC / UD state machine"]
      S3["3 · Latency & bandwidth sweep<br/>2 B → 8 MB, anomaly flagging"]
      S4["4 · Congestion<br/>competing flows, ECN/PFC counters"]
      S5["5 · Gray-failure probe<br/>fail-slow localization"]
      S6["6 · Intra-host path<br/>PCIe / NUMA"]
      S7["7 · Kernel-log correlation<br/>dmesg captured per stage"]
      S1 --> S2 --> S3 --> S4 --> S5 --> S6 --> S7
    end

    PIPE --> REP["8 · Report<br/>Markdown + HTML + plots<br/>pass / fail verdict"]
Loading

Backend resolution (--backend auto, the default) picks the most capable option present, so the same code path runs on a workstation, a soft-RoCE VM, or a real NIC — only the backend changes.


Why each test exists

Each stage answers a concrete question you have to answer before you can trust a card in a cluster — the same questions that make this problem worth building for:

Stage Module The question it answers
1. Discovery harness/discovery.py Does the host see the card, are its ports up, what link layer/MTU/transports are available? The first sanity sweep (ibv_devinfo/ibstat) before trusting a NIC.
2. QP lifecycle harness/qp_lifecycle.py Does the verbs layer actually work? Programmatically build PD/MR/CQ/QP, drive the QP state machine, post send/recv, poll completions — across RC, UC, UD. Proves the driver/firmware honor the verbs contract, not just that a benchmark binary runs.
3. Latency/bandwidth sweep harness/bandwidth_latency.py Does it perform sanely across message sizes? Automated ib_write_bw / ib_read_lat-style sweep (2 B → 8 MB, log scale), time-series CSV/JSON, plots, and automatic flagging of latency cliffs / bandwidth that fails to scale.
4. Congestion scenario harness/congestion.py How does it behave when the fabric is contended? Run competing flows concurrently, measure fairness and throughput/latency degradation, and pull NIC counters (ethtool -S, RDMA stats, ECN/PFC where exposed) before/during/after — this is where congestion-control and switch configuration actually show up.
5. Gray-failure / fail-slow probe harness/gray_failure.py Is this NIC a silent straggler, and if so, is it the card or the fabric? A mesh of QP-level RTT probes that separates local RNIC/host processing delay from network delay, flags an endpoint whose latency tail is an outlier or whose probes disproportionately time out (R-Pingmesh's primary fail-slow signal), and localizes the cause. Given a ToR topology it also runs binary network tomography (R-Pingmesh §4.3) to vote the single shared link the anomalous probes implicate — telling a bad card access link apart from a bad ToR uplink (fabric), where the per-endpoint view would over-blame every card behind that uplink. An open take on R-Pingmesh (SIGCOMM 2024), which is described but not open-sourced. See below.
6. Intra-host path (PCIe/NUMA) harness/intrahost.py (static) · harness/hostping.py (measured) Is a healthy card being throttled by its own host? Static (hostpath): compares the PCIe link's capable vs trained speed/width (lspci LnkCap/LnkSta) — a Gen4 x16 card stuck at Gen3 x8 is a straggler no NIC tuning can fix — and WARNs on PCIe ACS left enabled (P2P/GDR detoured through the root complex) and a NUMA-remote attach. Measured (hostping): Hostping's own method — loopback DMA bandwidth per (RNIC × NUMA node) and RNIC-to-RNIC probing — catching bottlenecks below the NIC that LnkSta can't see (a saturated PCIe switch, a BIOS cap), the measured NUMA penalty, and, via tomography-lite, localizing a bottleneck to a card's own path (slow in loopback and against every R2R peer) vs the fabric. A full open take on Hostping (NSDI 2023), which is described but not open-sourced.
7. Log correlation harness/log_correlation.py What did the kernel say while we hit it? Capture dmesg around each test and attach any RDMA/NIC-related lines to that test's report — a red test cell next to the driver message that explains it.
8. Qualification report harness/report.py Ship / no-ship. One command runs everything and emits a per-device pass/fail report: device info, transport support matrix, latency/bandwidth plots, congestion summary, the fail-slow + host-path verdicts, anomalies, and flagged log excerpts.

The QP lifecycle test in detail

Stage 2 is the part that demonstrates real verbs-level understanding rather than wrapping a benchmark binary. For each transport it allocates a Protection Domain, registers a Memory Region, creates a Completion Queue and Queue Pair(s), then drives the QP through the verbs state machine and does a loopback send/recv with a payload check:

stateDiagram-v2
    direction LR
    [*] --> RESET: create_qp
    RESET --> INIT: modify to INIT (pkey, port, access flags)
    INIT --> RTR: modify to RTR (path MTU, dest QPN, GID / AH)
    RTR --> RTS: modify to RTS (PSN, timeout, retry)
    RTS --> RTS: post_recv / post_send, poll CQ, verify payload
    RTS --> [*]: destroy
Loading

The harness records exactly which step each transport reached, so a failure at, say, the RTR transition points a qualification engineer straight at the offending stage instead of a generic "it didn't work". UC correctly omits RDMA-Read from its access flags; UD adds an Address Handle and accounts for the 40-byte GRH on receive. The same lifecycle is also implemented in C on libibverbs under harness/verbs_native/ to show the mechanics at the C level.

Example (simulated) transport support matrix:

QP lifecycle - device=rxe0 backend=simulate
overall: PASS

TRANSPORT  STATUS  REACHED      NOTE
---------  ------  -----------  ---------
RC         PASS    verify_data  SIMULATED
UC         PASS    verify_data  SIMULATED
UD         PASS    verify_data  SIMULATED

Going past the papers: diagnostics the literature leaves unshipped

The two stages below (5 and 6) are the part of this project that goes past replicating known qualification practice: each implements a diagnostic the recent literature proposes but leaves without an open, pre-deployment implementation.

This claim is backed by a literature survey: PRIOR_ART.md. It reads the RDMA/RoCE diagnosis papers (Collie, Husky, Hostping, R-Pingmesh, MegaScale, ByteRobust, C4, …) and checks each for released code. The finding: the perf-fuzzing and isolation-stress niches already have good open tools (Collie, Husky) — so this project doesn't rebuild them — while the config-validation, intra-host PCIe/NUMA/ACS, and QP-bringup-preflight niches are described in papers but never open-sourced. That's the lane this harness is in.

5 · The gray-failure / fail-slow probe

The problem section ends with the failure mode that hurts most and hides best: a fail-slow ("straggler") NIC that doesn't error, it just quietly runs a little behind — and since collectives are synchronous, one slow card taxes every step of a whole training job.

The recent literature is full of ways to detect this in production (R-Pingmesh, SIGCOMM 2024; Minder, NSDI 2025; Hostping, NSDI 2023). Two things stood out while reading it:

  1. the flagship system, R-Pingmesh, is described but not open-sourced, and
  2. they all detect the straggler after it is already in a running job — there is no open, pre-deployment tool that reproduces the failure and catches the card on the bench.

Stage 5 is a small, open take on that. It runs a mesh of QP-level RTT probes and does the one thing that makes the result actionable — it separates the local RNIC/host processing delay from the network delay (using a loopback self-probe as the processing baseline, the technique Hostping uses; R-Pingmesh instead derives it from RNIC CQE timestamps), then flags an endpoint whose latency tail is a statistical outlier — or whose probes disproportionately time out and says whether the fault is the card or the fabric:

$ python cli.py probe --backend simulate --inject-failslow

ENDPOINT  PROC[us]  NET_p99[us]  STATUS  DIAGNOSIS
--------  --------  -----------  ------  ------------------------------------------------------------
ep0       4.0       11.4         PASS    healthy
ep2       4.3       11.4         PASS    healthy
ep3       14.4      11.4         FAIL    fail-slow: local RNIC/host processing slow (not the network)
ep5       4.8       11.4         PASS    healthy

ep3's end-to-end latency is high, but its network component is normal — so the probe correctly blames the host/RNIC path, not the switch. That attribution is the difference between "swap the card" and "check the fabric".

Honesty. A true multi-node fail-slow mesh needs ≥2 real nodes; on one host the tools backend runs a star probe from this host to each configured peer (probe_peers), and the full mesh above is the simulate backend demonstrating the separation + localization logic (clearly labeled). The structure is the same on real hardware — it's a config change, not a rewrite.

6 · The intra-host path check

Hostping (NSDI 2023) makes a point qualification usually misses: an RNIC can be perfectly healthy and still deliver a fraction of its line rate because the host path to it is degraded — most often a PCIe link that trained below its capability (a Gen4 x16 card that a slot or riser only brought up as Gen3 x8), or the card being NUMA-remote. Hostping notes these "can hardly be noticed in time due to the lack of an efficient monitoring system"; there is little open tooling.

Stage 6 adds that check. It reads the device's PCIe address and NUMA node from sysfs and parses lspci for what the link is capable of (LnkCap) versus what it actually trained to (LnkSta):

$ python cli.py hostpath --backend simulate --inject-bottleneck

PCIe capable: 16GT/s x16 (~31.5 GB/s)
PCIe trained: 8GT/s x8  (~7.9 GB/s)

FAIL: PCIe link trained below capability — the slot/riser is throttling an
      otherwise-healthy card (~7.9 vs ~31.5 GB/s usable); NUMA node 0

A card capped at a quarter of its usable PCIe bandwidth will read as a straggler in the sweep and the probe — this stage says why, and points at the slot, not the silicon.

Proving the detectors actually work

A detector you can't trust is worse than none. The papers propose detection methods but rarely show, openly, that the detector catches an injected fault and doesn't fire on a healthy baseline. python cli.py validate does exactly that: it injects a known fault for every detector in the harness, runs the real detection code, and reports recall + false positives. It runs in CI on every push.

$ python cli.py validate

SCENARIO                    CATEGORY      RESULT
--------------------------  ------------  ------
fail-slow (local RNIC)      gray_failure  PASS
fail-slow (network path)    gray_failure  PASS
PCIe downgrade              intrahost     PASS
latency cliff               sweep         PASS
bandwidth regression        sweep         PASS
unfair congestion           congestion    PASS
healthy baseline (control)  control       PASS

recall: 6/6 injected faults caught (100%); 0 false positive(s) on the healthy baseline

How the three backends work

The harness resolves --backend auto (the default) to the best option present:

  1. pyverbs — the Python bindings shipped with rdma-core. Preferred, because the QP-lifecycle test drives the raw verbs API directly through it.
  2. tools — the rdma-core userspace tools (ibv_devinfo, rdma) plus perftest (ib_write_bw, ib_read_lat, ...). Used when pyverbs is absent. The harness parses their output.
  3. simulate — no RDMA stack present at all. Produces clearly-labeled, illustrative synthetic results so you can see the full report and so CI can exercise the whole pipeline on a plain host. Simulated output is stamped SIMULATED everywhere it appears.

Check what your host resolves to:

$ python cli.py capabilities
{
  "pyverbs": false,
  "core_tools": {"ibv_devinfo": false, "rdma": false},
  "perftest": {"ib_write_bw": false, "ib_read_lat": false, "ib_write_lat": false},
  "resolved_auto_backend": "simulate"
}

Repository layout

cli.py                      # single entrypoint: also installed as `roce-preflight`
pyproject.toml              # packaging; base install has zero dependencies
LICENSE                     # MIT
PRIOR_ART.md                # what the papers built, and what was never released
docs/
  EVIDENCE.md               # the issue-tracker survey: which checks are backed, which aren't
  IMPROVEMENT_PLAN.md       # what's next, prioritised, and why
  PROVISIONING.md           # how to get a real RDMA device to test against
  index.html, posts/        # the project site (published by .github/workflows/pages.yml)
contrib/                    # patches prepared for upstream projects, not applied here
harness/
  config.py                 # HarnessConfig dataclass (device, backend, sweep params)
  backends.py               # pyverbs / rdma-core tools / simulate detection
  util.py                   # subprocess helpers, Status enum, table renderer
  doctor.py                 # RoCE bring-up diagnostic (why QP->RTR fails) + fixes
  roce_config.py            # RoCE QoS/config linter (PFC/ECN/DSCP/MTU coherence)
  discovery.py              # device/port/transport enumeration
  qp_lifecycle.py           # RC/UC/UD QP lifecycle exercises (raw verbs)
  bandwidth_latency.py      # message-size sweeps + anomaly flagging + plots
  congestion.py             # competing-flow scenarios + counter collection
  gray_failure.py           # fail-slow localization probe (RNIC vs network)
  intrahost.py              # intra-host path check, static (PCIe LnkCap/Sta + NUMA + ACS)
  hostping.py               # intra-host loopback + RNIC-to-RNIC probe (Hostping-style)
  preflight.py              # all-pairs QP-bringup connectivity gate (below NCCL) + localization
  log_correlation.py        # dmesg capture correlated to each test
  validation.py             # fault-injection self-test of the detectors
  report.py                 # aggregate -> markdown/HTML qualification report
  verbs_native/             # small C libibverbs component (QP/CQ/MR mechanics)
tests/                      # 217 unit tests for parsing/diagnosis logic (no hardware)
  fixtures/                 # captured tool output used by the parser tests
sample_reports/             # example generated report(s) for reviewers
.github/workflows/
  ci.yml                    # unit tests on 3.9 / 3.11 / 3.12
  soft-roce.yml             # builds rdma_rxe and runs the harness on a REAL device
  pages.yml                 # publishes docs/ to the project site

Setup: soft-RoCE (rdma_rxe) on a single host

Soft-RoCE lets you run the entire suite over loopback with no RDMA NIC. On a Debian/Ubuntu host:

# 1. Userspace tooling
sudo apt-get update
sudo apt-get install -y rdma-core ibverbs-utils perftest python3-pyverbs

# 2. Load the soft-RoCE kernel module
sudo modprobe rdma_rxe

# 3. Bind a soft-RoCE device onto an existing netdev (use your real iface name)
sudo rdma link add rxe0 type rxe netdev eth0

# 4. Verify the device is present and its port is ACTIVE
rdma link show
ibv_devinfo -d rxe0

You should see rxe0 with a port in state ACTIVE and link_layer: Ethernet. Then:

python cli.py discover                 # confirm the harness sees rxe0
python cli.py qualify --device rxe0    # full run -> reports/

On older distros without rdma link add, use the legacy helper: sudo rxe_cfg start && sudo rxe_cfg add eth0.

Loopback vs. two-node

  • Loopback (default): client and server run on the same host over rxe0. Zero extra setup; good for functional qualification and pipeline validation.
  • Two VMs / two hosts: load rdma_rxe and bind rxe0 on both, put them on the same L2 network, and point the client at the server's GID/IP. This exercises a real path and is closer to what you'd see qualifying a card in a rack. The perftest tools take a server address as their last argument.

No RDMA stack at all?

Everything still runs in simulation, and the unit tests (which validate the parsers and report logic against captured fixtures) run anywhere:

pip install -r requirements.txt
pip install pytest
python -m pytest -q
python cli.py qualify --backend simulate      # writes an example report

Usage & example output

python cli.py capabilities             # what tooling does this host have?
python cli.py discover [--json]        # enumerate devices/ports/transports
python cli.py qp --device rxe0         # QP lifecycle across RC/UC/UD
python cli.py sweep --device rxe0      # latency/bandwidth sweep + plot
python cli.py congestion --device rxe0 # competing-flow congestion scenario
python cli.py probe --device rxe0       # gray-failure / fail-slow localization probe
python cli.py hostpath --device rxe0    # intra-host path check (PCIe / NUMA)
python cli.py doctor --device rxe0     # diagnose why QP->RTR bring-up fails, with fixes
python cli.py qos --device mlx5_0      # validate PFC/ECN/DSCP/MTU config coherence
python cli.py hostping --backend simulate --inject-bottleneck   # loopback + R2R localization
python cli.py preflight --backend simulate --inject-dead-endpoint  # all-pairs QP-bringup gate
python cli.py validate                 # self-test: prove the detectors catch injected faults
python cli.py qualify --device rxe0    # full suite -> markdown + HTML report
python cli.py compare --baseline good.json --current now.json  # cross-run regression check

Cross-run regression — the sweep flags anomalies within one curve; compare catches drift between runs, the other half of qualification. Point it at a known-good sweep JSON (written by sweep/qualify) and a fresh one; it flags any message size whose bandwidth dropped past --bw-drop (FAIL) or whose p99 latency rose past --lat-rise (WARN) — e.g. a card that quietly lost 20% of its line rate after a firmware bump, which no single run would reveal. Exit code 2 on a FAIL, so it drops straight into CI.

Add --backend simulate to any command to force simulation. Add --config myrun.json to load a saved HarnessConfig (device, sweep sizes, thresholds, congestion flow count, ...). Every command also accepts --json for machine-readable output.

discover — device/port/transport table (or JSON with --json):

$ python cli.py discover --backend simulate
# backend: simulate

DEVICE  PORT  STATE        LINK      MTU       NETDEV  TRANSPORTS
------  ----  -----------  --------  --------  ------  ----------
rxe0    1     PORT_ACTIVE  Ethernet  1024 (3)  eth0    RC,UC,UD

congestion — competing flows, fairness, and the NIC counters that reveal congestion-control behavior:

$ python cli.py congestion --backend simulate
single-flow baseline : 3200.0 MB/s
aggregate (2 flows): 3200.0 MB/s
fairness index       : 0.9990 (1.0 = perfectly fair)
vs baseline          : +0.0% throughput change

per-flow throughput:
  flow 0: 1550.5 MB/s
  flow 1: 1649.5 MB/s

congestion-relevant counter deltas:
  np_ecn_marked_roce_packets: +3000
  rx_prio0_pause: +24
  ...

flags:
  - ECN-marked packets increased by 3000 during the run
  - PFC pause frames increased by 24 during the run

The qualification report

qualify writes a self-contained report per device (Markdown and HTML) plus the sweep artifacts (CSV, JSON, PNG). The report opens with an overall verdict and a per-stage summary, then details each stage:

Stage Result
1. Discovery ✅ PASS
2. QP lifecycle (RC/UC/UD) ✅ PASS
3. Latency/bandwidth sweep ✅ PASS
4. Congestion scenario ✅ PASS
5. Kernel-log correlation ✅ PASS

A full example is checked in under sample_reports/ so you can evaluate the output without setting up soft-RoCE yourself:

  • 📄 sample_reports/rxe0_qualification.md — the report (start here)
  • 🌐 sample_reports/rxe0_qualification.html — same report, self-contained HTML
  • 📈 sample_reports/sweep_rxe0.png — the plot shown at the top of this page
  • 🧾 sample_reports/sweep_rxe0.csv / .json — the full sweep time series

It is generated in simulate mode and labeled accordingly:

python cli.py qualify --backend simulate --output-dir sample_reports

Native verbs component

harness/verbs_native/ contains a small C program built on libibverbs directly (QP/CQ/memory-registration mechanics). It exists to demonstrate the verbs API at the C level; the Python qp_lifecycle module uses pyverbs when available and can also shell out to this binary. See harness/verbs_native/README.md.


What's simulated vs. real hardware

Aspect Soft-RoCE (rxe) Simulate backend Real NIC (mlx5, ...)
Verbs API correctness Real Not exercised Real
QP RC/UC/UD lifecycle Real (runs in kernel rxe) Synthetic matrix Real
Latency numbers Real but CPU-bound, ~µs–ms, not representative Illustrative synthetic Real, sub-µs to low-µs
Bandwidth numbers Real but CPU-bound, not representative Illustrative synthetic Real, line-rate
Hardware counters (ECN/PFC) Mostly absent (no NIC) Synthetic Real, the interesting part
Kernel log lines Real rdma_rxe messages Synthetic examples Real driver/firmware messages

The harness never hides which backend produced a result — the report header and every table state the backend, and simulated data is labeled SIMULATED.


Tests

python -m pytest -q

The unit tests cover the hardware-independent logic — tool-output parsing, anomaly detection, congestion fairness math, log filtering, and report rendering — using captured fixtures under tests/fixtures/. They do not require an RDMA stack and are the right place to validate changes to parsing/report code. CI runs them across Python 3.9 / 3.11 / 3.12 plus a full simulate-backend pipeline smoke test.


Project website

A static showcase lives in docs/ and is served via GitHub Pages at https://0xsoftboi.github.io/roce-preflight/. It is fully self-contained (inline, pre-rendered SVG diagrams — no CDN or JavaScript) and includes:

  • the landing page (docs/index.html) — overview, diagrams, example output;
  • a technical write-up (docs/blog.html) — the design decisions, the interesting verbs-level details, and an honest account of what soft-RoCE can and can't prove;
  • the browsable sample report (docs/report.html).

To enable it once: Settings → Pages → Build and deployment → Source: Deploy from a branch, then select main / /docs and save.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages