Make every failed check and unreadable counter fatal instead of degrading
This commit is contained in:
@@ -462,6 +462,7 @@ func checkGovernor(want string) checkResult {
|
||||
paths, err := filepath.Glob("/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor")
|
||||
if err != nil || len(paths) == 0 {
|
||||
res.err = fmt.Errorf("no cpufreq governors found")
|
||||
res.fatal = true
|
||||
return res
|
||||
}
|
||||
var wrong []string
|
||||
@@ -470,6 +471,7 @@ func checkGovernor(want string) checkResult {
|
||||
b, err := os.ReadFile(p)
|
||||
if err != nil {
|
||||
res.err = err
|
||||
res.fatal = true
|
||||
return res
|
||||
}
|
||||
got := strings.TrimSpace(string(b))
|
||||
@@ -490,6 +492,7 @@ func checkGovernor(want string) checkResult {
|
||||
if err := os.WriteFile(p, []byte(want), 0o644); err != nil {
|
||||
res.err = err
|
||||
res.state = fmt.Sprintf("could not set %s", p)
|
||||
res.fatal = true
|
||||
return res
|
||||
}
|
||||
}
|
||||
@@ -532,6 +535,7 @@ func checkCoalesce(fd int, ifname string, rxUsecs, txUsecs uint32) checkResult {
|
||||
ec, err := getCoalesce(fd, ifname)
|
||||
if err != nil {
|
||||
res.err = err
|
||||
res.fatal = true
|
||||
return res
|
||||
}
|
||||
desc := func(e ethtoolCoalesce) string {
|
||||
@@ -552,6 +556,7 @@ func checkCoalesce(fd int, ifname string, rxUsecs, txUsecs uint32) checkResult {
|
||||
if err := ethtoolCall(fd, ifname, unsafe.Pointer(&ec)); err != nil {
|
||||
res.err = err
|
||||
res.state = "could not set"
|
||||
res.fatal = true
|
||||
return res
|
||||
}
|
||||
res.fixed = true
|
||||
@@ -564,6 +569,7 @@ func checkRings(fd int, ifname string, rxWant, txWant uint32) checkResult {
|
||||
rp, err := getRings(fd, ifname)
|
||||
if err != nil {
|
||||
res.err = err
|
||||
res.fatal = true
|
||||
return res
|
||||
}
|
||||
rx := min(rxWant, rp.rxMaxPending)
|
||||
@@ -579,6 +585,7 @@ func checkRings(fd int, ifname string, rxWant, txWant uint32) checkResult {
|
||||
if err := ethtoolCall(fd, ifname, unsafe.Pointer(&rp)); err != nil {
|
||||
res.err = err
|
||||
res.state = "could not set"
|
||||
res.fatal = true
|
||||
return res
|
||||
}
|
||||
res.fixed = true
|
||||
|
||||
Reference in New Issue
Block a user