From: xinfeng zhao Date: Tue, 15 Aug 2023 06:17:04 +0000 (+0000) Subject: fix crypto device init functions X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=commitdiff_plain;h=837b144cac331214edfe48dfbffe97475e4f4e11 fix crypto device init functions Change-Id: I96616f6895c9a0c9fb7dc876b2e8b83eff379f16 Signed-off-by: xinfeng zhao --- 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(