Jumbo in the size mix (MTU 9000 + module jumbo pinned), check-first module config trusting GET reads, cable diag async at startup through the reset path, MODULES table dissolved into SETTINGS/LINKS, per-driver NIC counter sets, comment cleanup

This commit is contained in:
flamingcow
2026-08-13 08:04:26 -07:00
parent 979dc7a772
commit bba1fa5e02
12 changed files with 201 additions and 135 deletions
+40 -23
View File
@@ -488,8 +488,8 @@ const (
)
// The mac appends the fcs, so 60 and 1514 here are the smallest and largest
// standard frames, 64 and 1518 on the wire.
var frameSizes = []int{60, 128, 256, 512, 1024, 1280, 1514}
// standard frames, 64 and 1518 on the wire; 9014 fills the 9000 MTU.
var frameSizes = []int{60, 128, 256, 512, 1024, 1280, 1514, 9014}
func main() {
// Left empty, the test pair is found by driver name instead: as PID 1 there
@@ -576,13 +576,6 @@ func run(aName, bName string) (err error) {
return err
}
defer noise.close()
for _, e := range []endpoint{a, b} {
for _, s := range frameSizes {
if s > e.mtu+ethHdrLen {
return fmt.Errorf("size %d exceeds %s MTU %d (max frame %d)", s, e.name, e.mtu, e.mtu+ethHdrLen)
}
}
}
a.tag, b.tag = "TEST A", "TEST B"
noise.eps[0].tag, noise.eps[1].tag = "NOISE A", "NOISE B"
@@ -593,16 +586,34 @@ func run(aName, bName string) (err error) {
ethertypes[i] = uint16(etherBase + i)
}
if err := reportChecks("HOST SETTINGS",
append(configureSystem(ifnames, ethertypes), configureNoise(noise.names())...)); err != nil {
modules, moduleIDs, err := openModules([2]string{a.name, b.name})
if err != nil {
return err
}
modules, cable, moduleChecks := moduleBringup([2]string{a.name, b.name})
if err := reportChecks("MODULES", moduleChecks); err != nil {
checks := configureSystem(ifnames, ethertypes)
checks = append(checks, moduleChecks(modules, [2]string{a.name, b.name})...)
checks = append(checks, configureNoise(noise.names())...)
if err := reportChecks("SETTINGS", checks); err != nil {
return err
}
diag := newCableDiag(modules, cable)
// The MTU check may have just raised them, so both are re-read before the
// frame sizes are judged.
for _, e := range []*endpoint{&a, &b} {
fresh, err := lookupEndpoint(e.name)
if err != nil {
return err
}
e.mtu = fresh.mtu
for _, s := range frameSizes {
if s > e.mtu+ethHdrLen {
return fmt.Errorf("size %d exceeds %s MTU %d (max frame %d)", s, e.name, e.mtu, e.mtu+ethHdrLen)
}
}
}
diag := newCableDiag(modules, cableInfo{})
var dirs []*direction
for _, p := range [][2]endpoint{{a, b}, {b, a}} {
@@ -619,14 +630,18 @@ func run(aName, bName string) (err error) {
}()
var linkRows [][]string
for _, e := range []endpoint{a, b, noise.eps[0], noise.eps[1]} {
for i, e := range []endpoint{a, b, noise.eps[0], noise.eps[1]} {
mod := ""
if i < len(moduleIDs) {
mod = moduleIDs[i]
}
linkRows = append(linkRows, []string{
paint(e.tag, cCyan), e.name, e.macString(), fmt.Sprintf("%d", e.mtu),
paint(e.tag, cCyan), e.name, e.macString(), fmt.Sprintf("%d", e.mtu), mod,
})
}
fmt.Println(renderBox("LINKS",
[]string{"TAG", "INTERFACE", "MAC", "MTU"},
[]bool{false, false, false, true}, linkRows))
[]string{"TAG", "INTERFACE", "MAC", "MTU", "MODULE"},
[]bool{false, false, false, true, false}, linkRows))
fmt.Println()
// One row carries both directions, so line rate is both links at once.
@@ -657,8 +672,6 @@ func run(aName, bName string) (err error) {
defer holdPanic()
noise.run(&done)
}()
// Also ungated: SNR and temperature ride the module's own management bus,
// not the wire being measured.
for _, m := range modules {
wg.Add(1)
go func() {
@@ -716,6 +729,9 @@ func run(aName, bName string) (err error) {
start := time.Now()
close(startTx)
// The first measure rides the same async path as a reset, so startup never
// waits on it; counters re-baseline when its link blip is over.
diag.kick(&done)
tick := time.NewTicker(reportInterval)
defer tick.Stop()
@@ -728,14 +744,15 @@ func run(aName, bName string) (err error) {
return fmt.Errorf("%v", p)
case <-sig:
return nil
// A reset re-measures the cable first the cable under a reset is
// usually a new one — and the counters re-baseline when the diag's own
// link blip is over, so it is never charged to the fresh run.
// A reset re-measures the cable first; the counters re-baseline at diag
// completion, so its link blip is never charged to the fresh run.
case <-space:
if diag.kick(&done) {
fmt.Println(stats.rule("measuring cable"))
}
case <-diag.completed:
info, _ := diag.snapshot()
fmt.Println(stats.rule("cable diag: " + cableLine(info)))
start = resetAll(dirs, modules, stats)
case <-disp.fb.flips:
now := time.Now()