aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxinfeng zhao <xinfengx.zhao@intel.com>2023-08-15 06:17:04 +0000
committerPeter Mikus <peter.mikus@protonmail.ch>2023-11-08 08:32:25 +0000
commit837b144cac331214edfe48dfbffe97475e4f4e11 (patch)
tree3e6f9f5cf8125c520c3b8003a1e33b775d198a92
parent6ce4dd6a1dc7d4ca4f6aa00dba7713bbb989b3c3 (diff)
fix crypto device init functions
Change-Id: I96616f6895c9a0c9fb7dc876b2e8b83eff379f16 Signed-off-by: xinfeng zhao <xinfengx.zhao@intel.com>
-rw-r--r--resources/libraries/python/QATUtil.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/resources/libraries/python/QATUtil.py b/resources/libraries/python/QATUtil.py
index 09f6692aef..2afea8e29f 100644
--- a/resources/libraries/python/QATUtil.py
+++ b/resources/libraries/python/QATUtil.py
@@ -16,6 +16,7 @@
from resources.libraries.python.DUTSetup import DUTSetup
from resources.libraries.python.topology import NodeType, Topology
from resources.libraries.python.VPPUtil import VPPUtil
+from resources.libraries.python.ssh import exec_cmd_no_error
class QATUtil:
@@ -58,6 +59,21 @@ class QATUtil:
# 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!"
+ )
+ 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:
DUTSetup.set_sriov_numvfs(