diff options
author | pmikus <pmikus@cisco.com> | 2021-05-26 16:06:02 +0000 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2021-06-04 06:45:23 +0000 |
commit | 4a0b0f2b633bb9fd15a7dc8357650a9ac7846edd (patch) | |
tree | 71151a129bfc83d9da837283c78972f0f72125ee /resources/libraries/python/CpuUtils.py | |
parent | 5468f3b23b892541026ab29aa37b5131e7e30a82 (diff) |
Performance: Add AF_XDP tests
- enabling for fortville, columbiaville
- enabling experimental for mlx
Signed-off-by: pmikus <pmikus@cisco.com>
Change-Id: I1b7ceb54769f4a0089ac7309350499e60c5cca0a
Diffstat (limited to 'resources/libraries/python/CpuUtils.py')
-rw-r--r-- | resources/libraries/python/CpuUtils.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/resources/libraries/python/CpuUtils.py b/resources/libraries/python/CpuUtils.py index 293d6b6913..e23404b1dd 100644 --- a/resources/libraries/python/CpuUtils.py +++ b/resources/libraries/python/CpuUtils.py @@ -334,6 +334,36 @@ class CpuUtils: return result @staticmethod + def get_affinity_af_xdp( + node, pf_key, cpu_skip_cnt=0, cpu_cnt=1): + """Get affinity for AF_XDP interface. Result will be used to pin IRQs. + + :param node: Topology node. + :param pf_key: Topology interface. + :param cpu_skip_cnt: Amount of CPU cores to skip. + :param cpu_cnt: CPU threads count. + :type node: dict + :type pf_key: str + :type cpu_skip_cnt: int + :type cpu_cnt: int + :returns: List of CPUs allocated to AF_XDP interface. + :rtype: list + """ + if pf_key: + cpu_node = Topology.get_interface_numa_node(node, pf_key) + else: + cpu_node = 0 + + smt_used = CpuUtils.is_smt_enabled(node[u"cpuinfo"]) + if smt_used: + cpu_cnt = cpu_cnt // CpuUtils.NR_OF_THREADS + + return CpuUtils.cpu_slice_of_list_per_node( + node, cpu_node, skip_cnt=cpu_skip_cnt, cpu_cnt=cpu_cnt, + smt_used=smt_used + ) + + @staticmethod def get_affinity_nf( nodes, node, nf_chains=1, nf_nodes=1, nf_chain=1, nf_node=1, vs_dtc=1, nf_dtc=1, nf_mtcr=2, nf_dtcr=1): |