From ea6d52d4434366f52ee48a6714e3657a2aad3b63 Mon Sep 17 00:00:00 2001 From: Hyeongju Johannes Lee Date: Mon, 5 Aug 2024 15:14:08 +0300 Subject: [PATCH] QAT: make plugin read trimmed heartbeat status Plugin used to consider only the value "-1" but there are some cases when files show "\n" or "\n\x00". This makes plugin to have wrong status of the device. So, trim the value after \n so only numerical value can be read. Signed-off-by: Hyeongju Johannes Lee --- cmd/qat_plugin/dpdkdrv/dpdkdrv.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/qat_plugin/dpdkdrv/dpdkdrv.go b/cmd/qat_plugin/dpdkdrv/dpdkdrv.go index ba981d6a..37743b6f 100644 --- a/cmd/qat_plugin/dpdkdrv/dpdkdrv.go +++ b/cmd/qat_plugin/dpdkdrv/dpdkdrv.go @@ -416,7 +416,7 @@ func getDeviceHealthiness(device string, lookup map[string]string) string { // If status reads "-1", the device is considered bad: // https://github.com/torvalds/linux/blob/v6.6-rc5/Documentation/ABI/testing/debugfs-driver-qat - if data, err := os.ReadFile(hbStatusFile); err == nil && string(data) == "-1" { + if data, err := os.ReadFile(hbStatusFile); err == nil && strings.Split(string(data), "\n")[0] == "-1" { healthiness = pluginapi.Unhealthy }