X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FQATUtil.py;h=e16221fb30c6e10bd8f52842a18057be1a901b9e;hb=0efc3083ed2bacaf3445a50fae1679a5ae88d7d9;hp=be8cc9561e40066a7ec7114afc167a5b4c3e41bf;hpb=0202f7d927dbaf40235e0f6d573f69e66a6427b2;p=csit.git diff --git a/resources/libraries/python/QATUtil.py b/resources/libraries/python/QATUtil.py index be8cc9561e..e16221fb30 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,17 +59,34 @@ 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: + path = f"drivers/{device['driver']}" DUTSetup.set_sriov_numvfs( - node, device["pci_address"], type="drivers/4xxx", + node, device["pci_address"], path=path, numvfs=device["numvfs"] ) - for cvf in range(int(device["numvfs"])): - DUTSetup.pci_vf_driver_unbind( - node, device["pci_address"], cvf - ) - DUTSetup.pci_vf_driver_bind( - node, device["pci_address"], cvf, "vfio-pci" - ) + if device["driver"] not in ["c4xxx"]: + for cvf in range(int(device["numvfs"])): + DUTSetup.pci_vf_driver_unbind( + node, device["pci_address"], cvf + ) + DUTSetup.pci_vf_driver_bind( + node, device["pci_address"], cvf, "vfio-pci" + )