From f990906641a53afbc5999a9ebe291f0cbaa6f7fe Mon Sep 17 00:00:00 2001 From: Peter Mikus Date: Mon, 2 Jun 2025 09:41:23 +0200 Subject: [PATCH] fix(tests): TAP Signed-off-by: Peter Mikus Change-Id: I251f8432ceab1608d5b45114bc2d3523a402268a --- resources/libraries/python/CpuUtils.py | 6 +----- resources/libraries/python/VhostUser.py | 12 +++++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/resources/libraries/python/CpuUtils.py b/resources/libraries/python/CpuUtils.py index c573417fca..34f68015b2 100644 --- a/resources/libraries/python/CpuUtils.py +++ b/resources/libraries/python/CpuUtils.py @@ -1,4 +1,4 @@ -# 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: @@ -474,10 +474,6 @@ class CpuUtils: 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) diff --git a/resources/libraries/python/VhostUser.py b/resources/libraries/python/VhostUser.py index b36edbf95a..a5711df3ea 100644 --- a/resources/libraries/python/VhostUser.py +++ b/resources/libraries/python/VhostUser.py @@ -1,4 +1,4 @@ -# 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: @@ -164,13 +164,15 @@ class VhostUser: :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) -- 2.16.6