aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries
diff options
context:
space:
mode:
authorpmikus <peter.mikus@protonmail.ch>2023-08-04 06:48:29 +0000
committerpmikus <peter.mikus@protonmail.ch>2023-08-04 06:48:29 +0000
commit4c138c4a6dc8fc55f6b64cbfc7daaaf0f05f258c (patch)
tree3178729c5e154564d89c194ed12b53f1d8bb8442 /resources/libraries
parentf6b5ccd00bd431f9139d464eb201d88d4cecaae8 (diff)
fix(core): QAT VF bind
Signed-off-by: pmikus <peter.mikus@protonmail.ch> Change-Id: Iafae1a1f538b928d3bb80bf9610a0bf7de646f8a
Diffstat (limited to 'resources/libraries')
-rw-r--r--resources/libraries/python/QATUtil.py26
-rw-r--r--resources/libraries/robot/shared/default.robot2
2 files changed, 16 insertions, 12 deletions
diff --git a/resources/libraries/python/QATUtil.py b/resources/libraries/python/QATUtil.py
index e709aad6ed..34a8e3b8d9 100644
--- a/resources/libraries/python/QATUtil.py
+++ b/resources/libraries/python/QATUtil.py
@@ -22,7 +22,7 @@ class QATUtil:
"""Contains methods for setting up QATs."""
@staticmethod
- def crypto_device_verify(node, crypto_type, numvfs, force_init=False):
+ def crypto_device_verify(node, crypto_type, numvfs, force_init=True):
"""Verify if Crypto QAT device virtual functions are initialized on all
DUTs. If parameter force initialization is set to True, then try to
initialize or remove VFs on QAT.
@@ -41,16 +41,20 @@ class QATUtil:
to False.
"""
pci_addr = Topology.get_cryptodev(node)
- sriov_numvfs = DUTSetup.get_sriov_numvfs(node, pci_addr)
-
- if sriov_numvfs != numvfs:
- if force_init:
- # QAT is not initialized and we want to initialize with numvfs
- QATUtil.crypto_device_init(node, crypto_type, numvfs)
- else:
- raise RuntimeError(
- f"QAT device failed to create VFs on {node[u'host']}"
- )
+
+ if force_init:
+ # QAT is not initialized and we want to initialize with numvfs.
+ QATUtil.crypto_device_init(node, crypto_type, numvfs)
+ else:
+ raise RuntimeError(
+ f"QAT device failed to create VFs on {node[u'host']}"
+ )
+
+ # QAT VF devices must be re-bound to vfio-pci driver before use.
+ pci_addr = Topology.get_cryptodev(node)
+ for i in range(numvfs):
+ DUTSetup.pci_vf_driver_unbind(node, pci_addr, i)
+ DUTSetup.pci_vf_driver_bind(node, pci_addr, i, "vfio-pci")
@staticmethod
def crypto_device_init(node, crypto_type, numvfs):
diff --git a/resources/libraries/robot/shared/default.robot b/resources/libraries/robot/shared/default.robot
index 755bc1a63d..be68958f5f 100644
--- a/resources/libraries/robot/shared/default.robot
+++ b/resources/libraries/robot/shared/default.robot
@@ -112,7 +112,7 @@
| |
| | ... | \| Configure crypto device on all DUTs \| HW_DH895xcc \| ${32} \|
| |
-| | [Arguments] | ${crypto_type} | ${numvfs} | ${force_init}=${False}
+| | [Arguments] | ${crypto_type} | ${numvfs} | ${force_init}=${True}
| |
| | FOR | ${dut} | IN | @{duts}
| | | Crypto Device Verify | ${nodes['${dut}']} | ${crypto_type}