Ghost SNR check removed as asked: no bounds, no panic, no latch re-read — a raw 0x0000 in 1.133-136 decodes as no-margin-this-poll (the untrained resting value, which appears before 1.1 reports a drop, so no read ordering could prove a ghost); panel value columns bounded by scalePanelCount (4 chars forever) with RESET narrowed to 5 chars so counts can never reach the timeline; rows and heat cells stretch proportionally to fill the band between header and footer instead of leaving the bottom half dead

This commit is contained in:
flamingcow
2026-08-17 21:48:29 -07:00
parent 66ff49f9d2
commit 4df30912b1
3 changed files with 61 additions and 45 deletions
+6 -22
View File
@@ -32,11 +32,6 @@ const (
rbPHYIDHi uint16 = 0x002B
rbPHYIDLo uint16 = 0x0BF4
// IEEE margins land near 7-9 dB on a healthy short cable; far outside is
// another register's data.
rbGhostLow = -10.0
rbGhostHigh = 25.0
)
// Only the registers proven safe on this PHY (docs/modules/wiitek/): single
@@ -170,11 +165,9 @@ func (r *rollball) identify() (ident string, err error) {
return
}
// An untrained PHY honestly serves 0x0000 here, so an out-of-band value is
// only a ghost if the link stayed up across the reads. The caller drained the
// PMA 1.1 latch when it checked the link, so one latched read now answers
// that: a drop since means the unplug race — discard the batch, ok false, and
// the next poll reads the link down.
// 0x0000 is the untrained PHY's resting value in these offset-0x8000
// registers, and the margins zero out before 1.1 reports a drop — so a zero
// read is no margin this poll, never data.
func (r *rollball) snrMargins() (out [4]float64, ok bool, err error) {
r.exec(func() {
for i := range out {
@@ -182,19 +175,10 @@ func (r *rollball) snrMargins() (out [4]float64, ok bool, err error) {
if v, err = r.mdioRead(1, uint16(133+i)); err != nil {
return
}
m := (float64(v) - 0x8000) / 10
if m < rbGhostLow || m > rbGhostHigh {
var link uint16
if link, err = r.mdioRead(1, 1); err != nil {
return
}
if link&0x0004 == 0 {
return
}
panic(fmt.Sprintf("%s: ghost SNR margin %.1f dB (1.%d=%#04x) with the link up",
r.ifname, m, 133+i, v))
if v == 0 {
return
}
out[i] = m
out[i] = (float64(v) - 0x8000) / 10
}
ok = true
})