Always color output and fold settled values into constants
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user