aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/QATUtil.py
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries/python/QATUtil.py')
-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(