Always color output and fold settled values into constants

This commit is contained in:
flamingcow
2026-07-25 18:20:34 -07:00
parent 29c6ce0b56
commit 3ba68952bb
5 changed files with 29 additions and 79 deletions
+10 -11
View File
@@ -62,13 +62,12 @@ type ethtoolCoalesce struct {
rateSampleInterval uint32
}
type systemConfig struct {
governor string
rxUsecs uint32
txUsecs uint32
rxRing uint32
txRing uint32
}
const (
wantGovernor = "performance"
wantCoalesceUsecs = 25
wantRxRing = 8160
wantTxRing = 4096
)
type checkResult struct {
item string
@@ -311,15 +310,15 @@ func withIoctlSocket(fn func(fd int) []checkResult) []checkResult {
return fn(fd)
}
func configureSystem(cfg systemConfig, ifnames []string) []checkResult {
func configureSystem(ifnames []string) []checkResult {
return withIoctlSocket(func(fd int) []checkResult {
out := []checkResult{checkGovernor(cfg.governor)}
out := []checkResult{checkGovernor(wantGovernor)}
for _, ifname := range ifnames {
out = append(out, checkLinkUp(fd, ifname))
out = append(out, checkCoalesce(fd, ifname, cfg.rxUsecs, cfg.txUsecs))
out = append(out, checkCoalesce(fd, ifname, wantCoalesceUsecs, wantCoalesceUsecs))
carrierWait := 3 * time.Second
r, reset := checkRings(fd, ifname, cfg.rxRing, cfg.txRing)
r, reset := checkRings(fd, ifname, wantRxRing, wantTxRing)
out = append(out, r)
if reset {
carrierWait = 10 * time.Second