aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/DUTSetup.py
diff options
context:
space:
mode:
authorpmikus <peter.mikus@protonmail.ch>2023-08-10 09:40:33 +0000
committerPeter Mikus <peter.mikus@protonmail.ch>2023-08-11 11:17:04 +0000
commit0202f7d927dbaf40235e0f6d573f69e66a6427b2 (patch)
tree631714dfd3f322e631f1dcc9402e38a3724e4a40 /resources/libraries/python/DUTSetup.py
parent4f4177abee17e177978b4dd96c2c578aa8d57925 (diff)
feat(core): QAT initialization refactor
Signed-off-by: pmikus <peter.mikus@protonmail.ch> Change-Id: Idc91da55ab0b5c6b8eb53e8b4ce4da18a1ae891c
Diffstat (limited to 'resources/libraries/python/DUTSetup.py')
-rw-r--r--resources/libraries/python/DUTSetup.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/resources/libraries/python/DUTSetup.py b/resources/libraries/python/DUTSetup.py
index a9b549a935..9fc525cab7 100644
--- a/resources/libraries/python/DUTSetup.py
+++ b/resources/libraries/python/DUTSetup.py
@@ -300,19 +300,21 @@ class DUTSetup:
return sriov_numvfs
@staticmethod
- def set_sriov_numvfs(node, pf_pci_addr, numvfs=0):
+ def set_sriov_numvfs(node, pf_pci_addr, path="devices", numvfs=0):
"""Init or reset SR-IOV virtual functions by setting its number on PCI
device on DUT. Setting to zero removes all VFs.
:param node: DUT node.
:param pf_pci_addr: Physical Function PCI device address.
+ :param type: Either device or driver.
:param numvfs: Number of VFs to initialize, 0 - removes the VFs.
:type node: dict
:type pf_pci_addr: str
+ :type type: str
:type numvfs: int
:raises RuntimeError: Failed to create VFs on PCI.
"""
- cmd = f"test -f /sys/bus/pci/devices/{pf_pci_addr}/sriov_numvfs"
+ cmd = f"test -f /sys/bus/pci/{path}/{pf_pci_addr}/sriov_numvfs"
sriov_unsupported, _, _ = exec_cmd(node, cmd)
# if sriov_numvfs doesn't exist, then sriov_unsupported != 0
if int(sriov_unsupported):
@@ -328,7 +330,7 @@ class DUTSetup:
pci = pf_pci_addr.replace(u":", r"\:")
command = f"sh -c \"echo {numvfs} | " \
- f"tee /sys/bus/pci/devices/{pci}/sriov_numvfs\""
+ f"tee /sys/bus/pci/{path}/{pci}/sriov_numvfs\""
message = f"Failed to create {numvfs} VFs on {pf_pci_addr} device " \
f"on {node[u'host']}"