-# Copyright (c) 2024 Cisco and/or its affiliates.
+# Copyright (c) 2025 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
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=cpu_node, skip_cnt=skip_cnt, cpu_cnt=cpu_cnt,
smt_used=False)
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2025 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
:type pf_key: str
:type skip_cnt: int
"""
- pids, _ = exec_cmd_no_error(
- node, f"grep -h vhost /proc/*/comm | uniq | xargs pidof")
+ command = "grep -e vhost /proc/$(pidof vpp)/task/*/comm "
+ command +="| awk 'BEGIN { FS = \"/\" } ; { print $5 }'"
+ pids, _ = exec_cmd_no_error(node, command)
affinity = CpuUtils.get_affinity_vhost(
- node, pf_key, skip_cnt=skip_cnt, cpu_cnt=len(pids.split(" ")))
+ node, pf_key, skip_cnt=skip_cnt, cpu_cnt=len(pids.splitlines())
+ )
- for cpu, pid in zip(affinity, pids.split(" ")):
+ for cpu, pid in zip(affinity, pids.splitlines()):
exec_cmd_no_error(node, f"taskset -pc {cpu} {pid}", sudo=True)