aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/QATUtil.py
diff options
context:
space:
mode:
authorPeter Mikus <peter.mikus@icloud.com>2025-02-21 12:14:44 +0100
committerPeter Mikus <peter.mikus@icloud.com>2025-02-25 06:06:58 +0000
commit7e053e65069df061748d625cea306075efdc75a8 (patch)
treef30c3f70c9bf60a9847b34ea904c6c7701d4c703 /resources/libraries/python/QATUtil.py
parent0f50112f22fcfb3679f789cce600d8e0e1cecfd8 (diff)
feat(core) QAT init fix
Signed-off-by: Peter Mikus <peter.mikus@icloud.com> Change-Id: I45198b17cfb6b62608bb03e6b1a4af0f939d10ae
Diffstat (limited to 'resources/libraries/python/QATUtil.py')
-rw-r--r--resources/libraries/python/QATUtil.py29
1 files changed, 8 insertions, 21 deletions
diff --git a/resources/libraries/python/QATUtil.py b/resources/libraries/python/QATUtil.py
index e16221fb30..9c7f092a5d 100644
--- a/resources/libraries/python/QATUtil.py
+++ b/resources/libraries/python/QATUtil.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2023 Cisco and/or its affiliates.
+# Copyright (c) 2025 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -51,28 +51,15 @@ class QATUtil:
"""
DUTSetup.verify_kernel_module(node, device["module"], force_load=True)
- current_driver = DUTSetup.get_pci_dev_driver(
- node, device["pci_address"].replace(":", r"\:")
+ exec_cmd_no_error(
+ node, f"adf_ctl {device["qat_dev"]} restart",
+ sudo=True, message="Failed to reset crypto device!"
)
- if current_driver is not None:
- DUTSetup.pci_driver_unbind(node, device["pci_address"])
- # Bind to kernel driver.
- DUTSetup.pci_driver_bind(node, device["pci_address"], device["driver"])
- cmd = f"adf_ctl status | grep {device['pci_address']} | "
- cmd += "awk '{print $1}'"
- stdout, _ = exec_cmd_no_error(
- node, cmd, sudo=True, message="Failed to check crypto device!"
+ exec_cmd_no_error(
+ node, f"adf_ctl {device["qat_dev"]} status",
+ sudo=True, retries=10, message="Failed to status crypto device!"
)
- if stdout.strip():
- qat_dev = stdout.split("_")[-1]
- conf_file = f"/etc/{device['driver']}_{qat_dev.strip()}.conf"
- exec_cmd_no_error(
- node, f"adf_ctl --config {conf_file} {stdout.strip()} restart",
- sudo=True, message="Failed to restart crypto device!"
- )
- else:
- raise ValueError("Crypto device error")
# Initialize QAT VFs.
if int(device["numvfs"]) > 0:
@@ -89,4 +76,4 @@ class QATUtil:
)
DUTSetup.pci_vf_driver_bind(
node, device["pci_address"], cvf, "vfio-pci"
- )
+ ) \ No newline at end of file