aboutsummaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
authorpmikus <peter.mikus@protonmail.ch>2023-11-10 12:02:54 +0000
committerpmikus <peter.mikus@protonmail.ch>2023-11-10 13:02:31 +0000
commit76fcd8422842d0756338502213de561eaa93e670 (patch)
treee8d0fc5da247201e1f61b475519047fd9d4542e9 /resources
parent651d799487c6432fccf731e8ad23a512d72df713 (diff)
feat(vpp_device): Main core allocation randomization
Signed-off-by: pmikus <peter.mikus@protonmail.ch> Change-Id: I0c261b08dc9b88b853922520598ddb29d222e86c
Diffstat (limited to 'resources')
-rw-r--r--resources/libraries/python/CpuUtils.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/resources/libraries/python/CpuUtils.py b/resources/libraries/python/CpuUtils.py
index 8871a5b651..7840b5fa6c 100644
--- a/resources/libraries/python/CpuUtils.py
+++ b/resources/libraries/python/CpuUtils.py
@@ -13,6 +13,8 @@
"""CPU utilities library."""
+from random import choice
+
from robot.libraries.BuiltIn import BuiltIn
from resources.libraries.python.Constants import Constants
@@ -522,15 +524,15 @@ class CpuUtils:
continue
# Number of Data Plane physical cores.
dp_cores_count = BuiltIn().get_variable_value(
- f"${{dp_cores_count}}", phy_cores
+ "${{dp_cores_count}}", phy_cores
)
# Number of Feature Plane physical cores.
fp_cores_count = BuiltIn().get_variable_value(
- f"${{fp_cores_count}}", phy_cores - dp_cores_count
+ "${{fp_cores_count}}", phy_cores - dp_cores_count
)
# Ratio between RX queues and data plane threads.
rxq_ratio = BuiltIn().get_variable_value(
- f"${{rxq_ratio}}", 1
+ "${{rxq_ratio}}", 1
)
dut_pf_keys = BuiltIn().get_variable_value(
@@ -538,7 +540,7 @@ class CpuUtils:
)
# SMT override in case of non standard test cases.
smt_used = BuiltIn().get_variable_value(
- f"${{smt_used}}", CpuUtils.is_smt_enabled(node["cpuinfo"])
+ "${{smt_used}}", CpuUtils.is_smt_enabled(node["cpuinfo"])
)
cpu_node = Topology.get_interfaces_numa_node(node, *dut_pf_keys)
@@ -546,9 +548,10 @@ class CpuUtils:
cpu_main = CpuUtils.cpu_list_per_node_str(
node, cpu_node,
skip_cnt=skip_cnt,
- cpu_cnt=Constants.CPU_CNT_MAIN,
+ cpu_cnt=Constants.CPU_CNT_MAIN if phy_cores else 0,
smt_used=False
)
+ cpu_main = cpu_main if phy_cores else choice(cpu_main.split(","))
skip_cnt += Constants.CPU_CNT_MAIN
cpu_dp = CpuUtils.cpu_list_per_node_str(
node, cpu_node,