Skip to content

Commit 1e07de8

Browse files
committed
qat: handle service parsing via debugfs
The QAT out-of-tree driver does not provide sysfs based cfg_services interface to read (and write) services configurations so QAT debugfs is used as the fallback. bad65eb changed how the services string is parsed and trimmed but missed the debugfs path. Because of this, the resource registration errors due so invalid resource names (e.g., "sym;dc", which should be "sym-dc"). Fix by handling the debugfs path the same way as the cfg_services sysfs path. Signed-off-by: Mikko Ylinen <[email protected]>
1 parent e156284 commit 1e07de8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

cmd/qat_plugin/dpdkdrv/dpdkdrv.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,11 @@ func (dp *DevicePlugin) getDpdkMounts(dpdkDeviceName string) []pluginapi.Mount {
338338
}
339339
}
340340

341+
// Trim services reported by the kernel into k8s resource names.
342+
func trimServiceName(serviceName string) string {
343+
return strings.Replace(strings.TrimSpace(serviceName), ";", "-", 2)
344+
}
345+
341346
func readDeviceConfiguration(pfDev string) string {
342347
qatState, err := os.ReadFile(filepath.Join(pfDev, "qat/state"))
343348
if err != nil && !errors.Is(err, os.ErrNotExist) {
@@ -353,7 +358,7 @@ func readDeviceConfiguration(pfDev string) string {
353358
}
354359

355360
if err2 == nil && len(qatCfgServices) != 0 {
356-
return strings.Join(strings.SplitN(strings.TrimSpace(string(qatCfgServices)), ";", 3), "-")
361+
return trimServiceName(string(qatCfgServices))
357362
}
358363
}
359364

@@ -370,7 +375,7 @@ func readDeviceConfiguration(pfDev string) string {
370375
return defaultCapabilities
371376
}
372377

373-
return devCfg.Section("GENERAL").Key("ServicesEnabled").String()
378+
return trimServiceName(devCfg.Section("GENERAL").Key("ServicesEnabled").String())
374379
}
375380

376381
func getDeviceHealthiness(device string, lookup map[string]string) string {

0 commit comments

Comments
 (0)