Hardware lock-in cleanup: ice RX counter set and by-driver map collapsed to the single ixgbe nicRxFields list (newNICPoller drops its redundant driver gate), checkCoalesce loses the try-tx-then-EINVAL fallback and sets rx-usecs shared with tx as the one path, ice-attributed comments neutralized, dead errs.total removed with its redundant test assertion; ice counter reference set recorded in docs/nics/e810; verified on hardware (20.00G, zero errors, ECD 41m)

This commit is contained in:
flamingcow
2026-08-17 12:45:41 -07:00
parent d9249f345c
commit 38c2cc4da2
6 changed files with 38 additions and 86 deletions
+12 -38
View File
@@ -1,7 +1,6 @@
package main
import (
"fmt"
"os"
"path/filepath"
"strconv"
@@ -27,34 +26,17 @@ var nicTxFields = []string{
"collisions",
}
// Receiving is the hardware's, and is taken from the driver's own array, which
// sysfs both flattens and overlaps: ice folds crc errors and jabbers into
// rx_errors, so the old sum of rx_errors alongside rx_crc_errors charged every
// bad frame check twice. Named individually per driver, so nothing contains
// anything else in its list.
var nicRxStatsByDriver = map[string][]string{
// The reference set: illegal_bytes and the faults move while every frame
// still arrives intact — as close to a bit error rate as the link reports.
"ice": {
"rx_crc_errors.nic",
"rx_jabber.nic",
"rx_undersize.nic",
"rx_oversize.nic",
"rx_fragments.nic",
"rx_dropped.nic",
"illegal_bytes.nic",
"mac_local_faults.nic",
"mac_remote_faults.nic",
},
// The 82599 exposes no jabber, fragment, illegal-byte or fault counters
// (docs/nics/x520/).
"ixgbe": {
"rx_crc_errors",
"rx_missed_errors",
"rx_length_errors",
"rx_long_length_errors",
"rx_short_length_errors",
},
// Receiving is the hardware's, and is taken from the driver's own array:
// sysfs flattens and overlaps it (crc errors fold into rx_errors, so summing
// rx_errors alongside rx_crc_errors charges every bad frame twice). Named
// individually, so nothing contains anything else in the list; the 82599
// exposes no jabber, fragment, illegal-byte or fault counters (docs/nics/x520/).
var nicRxFields = []string{
"rx_crc_errors",
"rx_missed_errors",
"rx_length_errors",
"rx_long_length_errors",
"rx_short_length_errors",
}
func ifDriver(name string) (string, error) {
@@ -113,15 +95,7 @@ type nicPoller struct {
}
func newNICPoller(fd int, txName, rxName string, total *atomic.Uint64, measuring *atomic.Bool) (*nicPoller, error) {
drv, err := ifDriver(rxName)
if err != nil {
return nil, err
}
want, ok := nicRxStatsByDriver[drv]
if !ok {
return nil, fmt.Errorf("%s: no rx error statistic set for driver %s", rxName, drv)
}
rx, err := newStatReader(fd, rxName, want)
rx, err := newStatReader(fd, rxName, nicRxFields)
if err != nil {
return nil, err
}