Repository navigation
feat(ernic): emulator frame counts as an oracle for xtcp2; egress follows the lowest metric - #347
Merged
Merged
Conversation
The emulator's fault counts as an exact witness for the guest counters and xtcp2's TCP segment counters, the egress-by-metric fix, the two capture flakes and the uplink corner cases, each with its test table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TestLookupEgressMetric: two default routes; the kernel lists same-prefix routes in ascending metric order and its lookup takes the first, but the snapshot keeps the last one listed, so the egress names the highest metric. Fails: lowest_wins_dump_order, equal_prio_first, multipath_lower. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
routeEntry keeps the route metric, and insertRoute replaces a same-prefix entry only with a strictly lower metric. With two default routes the egress interface was the highest-metric one (the last the kernel lists); it is now the one the kernel uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TestDefaultUplinksMetric: kernel metric order, IPv4 before IPv6, lines out of metric order kept as listed, equal metrics, the no-default fallback and a NIC with both defaults. The route fixtures take a metric. These pass on main by design: they record that DefaultUplinks trusts the kernel's listing order, which its comment now says, along with being evaluated once at startup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fake server now shuts down like rocm-ernic: TERM, a short wait, then the fault report. clean_stop fails: run-many SIGKILLs the group as soon as the fabric leader exits, before either report is written. pcap_unknown and pcap_no_fabric fail: there is no --pcap yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fabric's TERM trap now waits for every server, so each finishes its clean shutdown and prints its fault report before the caller's deadline SIGKILLs the group. --pcap IFNAME runs tcpdump on a fabric bridge or TAP, writing DIR/IFNAME.pcap; any other name is refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The emulator's fault report (eligible, fired) against the guest's NIC counters from the console: matches, a disagreeing drop count, a missing report or counters line, a site with no frames, everything dropped, other sites in the same log, journal prefixes, u64 and non-numbers. Red: nix/ernic/oracle.nix does not exist yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Parses each server's clean-shutdown fault report and the guest's GOLDEN_ERNIC_COUNTERS console line: for an eth_tx drop fault, eligible == tx + tx_dropped and fired == tx_dropped; for an eth_rx drop fault, eligible == rx + fired. Counts compare exactly with bc. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Flag rows (off, not a duration, zero) and socket rows: the dialer's and the listener's accepted connections have SO_KEEPALIVE on by Go's default, set by a positive value and off for any negative one. Red: there is no -keepalive, dialerFor or listenConfig yet. The golden capture needs this: Go's 15 s keepalive probes on the idle ionic connections reach the emulator after xtcp2's last poll, so its frame counts and xtcp2's segment counts differ by 2 per connection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dialer's and the listener's KeepAlive: 0 keeps Go's default (on, 15 s idle), a negative value turns it off. dialerFor and listenConfig build them from the parsed flags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he capture - The guest prints its final ionic counters (GOLDEN_ERNIC_COUNTERS) and takes both ionic links down, so nothing more reaches the emulator. - The runner powers the VM off and waits for ernic-run-many, keeps the server logs next to the transcript, prints every ROW line, and runs ernic-oracle: ionic0's eth_tx and ionic1's eth_rx counts against the guest's. Its EXIT trap no longer deletes the logs before the servers stop. - ERNIC_PCAP=<bridge or TAP> records that interface's frames. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
golden-metric-a reaches 192.0.2.80 only through two default routes, m1 at metric 100 and m2 at 200 (the higher added first). Row egress_metric expects m1. With the localnet fix it passes (capture 1); before it, the snapshot kept the last route listed, m2 (TestLookupEgressMetric red). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ric bridge (red) ernic-oracle rows: the emulator's tx frames equal the senders' tcp_info_segs_out, the frames delivered to the receiving NIC equal the receivers' tcp_info_segs_in, and either falling short fails. Red: no --segs-out / --segs-in yet. ernic-run-many row bridge_no_snooping: a capture's pcap showed the fabric bridge's one IGMPv3 report (group 224.0.0.106, all-snoopers), flooded to both TAPs; the bridge joins that group on open when snooping is on (net/bridge/br_device.c, br_dev_open). Red: bridges are created with snooping on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ernic-oracle --segs-out/--segs-in: the emulator's eth_tx frames equal the senders' tcp_info_segs_out, and ionic1's delivered frames equal the receivers' tcp_info_segs_in, exactly (TSO/GSO/GRO off). - The ernic workload clients and servers turn TCP keepalive off: Go's 15 s default sent probes after xtcp2's last poll (2 frames per flow). - The fabric bridge runs with mcast_snooping 0: with snooping on, the bridge joins 224.0.0.106 when it comes up and floods an IGMPv3 report to both TAPs (the stray frame on ionic1; net/bridge/br_device.c). - The oracle check's result variable no longer shadows $out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- GOLDEN_ERNIC_COUNTERS adds ionic0_segs_out and ionic1_segs_in, summed from the captured records. - New row quiescent: the ionic counters are unchanged 1 s after the read. - no_noise again requires 0 frames on ionic0 and ionic1 before the transfers. - loss_seen's detail reports netem's own drop count per veth0, so a failure tells netem dropping nothing from TCP seeing no loss. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lt rows Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ionic2 (golden-ernic-c, 10.0.5.15) and ionic3 (golden-ernic-d, 10.0.5.16) on their own fabric bridge, PCI slots 0x1b and 0x1c. - ionic2 drops eth_tx frames 501, 1002-1004 and 1505-1512 (sequence "0x500,1x1,0x500,1x3,0x500,1x8,0x60000"; counts are decimal). - Rows seq_fired, seq_egress, seq_retrans, seq_segs_out, seq_no_noise, seq_quiescent; ernic-oracle checks ionic2's fault report and both NICs' frames against segs_out/segs_in. - Both pairs' counters go on one GOLDEN_ERNIC_COUNTERS line (the oracle reads the last). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tures) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…etric Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A disagreement in oracle_segs_out then tells frames sent after the poll from frames no live socket counted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…resent ionic1 drops every 64th frame, and in 2 of 12 captures that was a SYN. tcp_client's default 1 s dial timeout closed the socket just as the kernel's first SYN retransmit came due (TCP_TIMEOUT_INIT), and dialed again; the closed socket's segs_out went with it, so oracle_segs_out was 1 or 2 short. The pcap showed the lone SYN (port 55522) and the redial 1 s later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…idation runs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Round 2 of rocm-ernic verification: the emulator's own frame counts become an external oracle for xtcp2, plus an egress-metric fix found along the way. Design and findings:
docs/design-rocm-ernic-tests.md.Fix
localnet.insertRoutekept the one listed last. The kernel lists them by ascending metric (fib_find_alias,fib6_add_rt2node), so that was the highest-metric route. It now keeps the lowest metric, and on a tie the first route listed. Golden rowegress_metric(netns golden-metric-a, m1 metric 100 / m2 metric 200).Oracle
ernic-run-manystops every server cleanly, so each prints itsFault <site>: eligible N, fired Mreport.--pcap IFNAMErecords a fabric interface.<transcript>.ernic/, and runs the newernic-oracle.ernic-oraclechecks each fault report against the guest's NIC counters. It also checks each NIC's frames against thetcp_info_segs_out/segs_inxtcp2 recorded: exactly equal, no offset, on all four NICs.-keepaliveflag ontcp_client/tcp_server.mcast_snooping 0). This was the old stray ionic1 frame.no_noiseis strict again.segs_out(2 of 12 captures). The ernic clients now use-dialTimeout 30s.Deterministic loss on one flow
sequence(frames 501, 1002–1004, 1505–1512).seq_fired(exactly 12),seq_egress,seq_retrans,seq_segs_out,seq_no_rto,seq_no_noise,seq_quiescent.goldenrec.DefaultFaultNetnsgains golden-ernic-c/d.Other
DefaultUplinksordering pinned byTestDefaultUplinksMetricand documented. It trusts the kernel's order and is evaluated once at startup (TODO in the doc).retrans_covers_drops/bytes_retrans_mss. Echo traffic means some drops are pure ACKs, which are never resent.loss_seen: once, one whole dctcp flow got through netem's 2 % loss untouched.golden-cc-asocket made onediffmismatch (pre-existing).Red (test commits before each fix)
Verification
go test ./...diffclean pairwise except the keepalive-probe TODO.loss_seenTODO.shape-diff: onlybbr_info_bw_hiandsk_mem_info_optmemare populated on the fleet and not in the fixture; the rest is NIC identity a VM can't reproduce.🤖 Generated with Claude Code