Drive a noise cable on the i40e pair, cycling its link down and up since the module PHYs ignore everything softer, and flag its absence beside the error columns

This commit is contained in:
flamingcow
2026-08-05 10:49:23 -07:00
parent 88f4f7da80
commit 2fcab83756
5 changed files with 335 additions and 32 deletions
+15 -9
View File
@@ -267,8 +267,9 @@ func (d *display) chipH() int { return d.grid.lineH + 2*chipPadY }
func (d *display) countChipH() int { return d.chipH() + d.gridB.lineH + pairGap }
// The error chips plus the noise cable's, which shares their row grid.
func (d *display) chipsH() int {
return gridRows(len(errRows))*(d.chipH()+chipGap) - chipGap
return gridRows(len(errRows)+1)*(d.chipH()+chipGap) - chipGap
}
func (d *display) countsH() int {
@@ -277,8 +278,8 @@ func (d *display) countsH() int {
// Outlined by drawing the border colour and sinking a smaller well of
// background into it, so both curves get the same antialiasing.
func (d *display) chipAt(i, x, w, y, h int, c rgb) (int, int, int) {
cx, cw := gridCell(i, len(errRows), x, w)
func (d *display) chipAt(i, n, x, w, y, h int, c rgb) (int, int, int) {
cx, cw := gridCell(i, n, x, w)
cy := y + (i/gridCols)*(h+chipGap)
d.fb.roundRect(cx, cy, cw, h, chipRadius, c)
@@ -288,13 +289,18 @@ func (d *display) chipAt(i, x, w, y, h int, c rgb) (int, int, int) {
}
// Whether rather than how many: over a window this short a count changes faster
// than it can be read.
func (d *display) errChips(x, w, y int, e errs) int {
// than it can be read. The noise chip rides along at the end, presence rather
// than health: red is the cable missing, not the cable failing.
func (d *display) errChips(x, w, y int, e errs, noiseMissing uint64) int {
n := len(errRows) + 1
for i, r := range errRows {
c := errColor(r.get(e))
cx, cw, cy := d.chipAt(i, x, w, y, d.chipH(), c)
cx, cw, cy := d.chipAt(i, n, x, w, y, d.chipH(), c)
d.centerIn(d.grid, cx, cw, cy+chipPadY, r.label, c)
}
c := errColor(noiseMissing)
cx, cw, cy := d.chipAt(len(errRows), n, x, w, y, d.chipH(), c)
d.centerIn(d.grid, cx, cw, cy+chipPadY, "noise", c)
return y + d.chipsH()
}
@@ -302,7 +308,7 @@ func (d *display) errCounts(x, w, y int, e errs) int {
for i, r := range errRows {
n := r.get(e)
c := errColor(n)
cx, cw, cy := d.chipAt(i, x, w, y, d.countChipH(), c)
cx, cw, cy := d.chipAt(i, len(errRows), x, w, y, d.countChipH(), c)
ty := d.centerIn(d.gridB, cx, cw, cy+chipPadY, scaleCount(n), c)
d.centerIn(d.grid, cx, cw, ty, r.label, c)
}
@@ -329,7 +335,7 @@ func errColor(n uint64) rgb {
return uiRed
}
func (d *display) render(v view, elapsed time.Duration, cable string) error {
func (d *display) render(v view, elapsed time.Duration, cable string, noiseMissing uint64) error {
fb := d.fb
fb.fill(uiBg)
@@ -338,7 +344,7 @@ func (d *display) render(v view, elapsed time.Duration, cable string) error {
{scaleSI(v.rxGbps * 1e9), "bits/s", uiFg},
{scaleSI(v.rxPPS), "packets/s", uiFg},
})
d.errChips(x, w, d.nowYs[1], v.window)
d.errChips(x, w, d.nowYs[1], v.window, noiseMissing)
x, w = d.panel(d.sincePanel, v.since)
d.stats(d.gridB, x, w, d.sinceYs[0], []statCell{