Skip to content

Commit 29dcc6d

Browse files
authored
Merge pull request #2167 from mythi/PR-2025-019
qat: handle service parsing via debugfs
2 parents 21bf57d + 1e07de8 commit 29dcc6d

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)