Skip to content

Conversation

@SiskaPavel
Copy link
Collaborator

Fix queue size and workers affinity for DPDK
Script is now compatible with python3.6

fix queue size and workers affinity
@SiskaPavel SiskaPavel requested a review from Copilot May 27, 2025 11:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Fixes Python 3.6 compatibility and improves CPU and DPDK argument handling in the config2args script.

  • Updated type hints to use List[int] for Python 3.6 compatibility
  • Refactored get_cpus_for_pci_device for missing NUMA node files and adjusted subprocess API
  • Enhanced DPDK plugin argument assembly with primary CPU affinity and queue parameters
Comments suppressed due to low confidence (2)

init/config2args.py:69

  • The numa_node value remains a string after reading; cast it to an integer (e.g., numa_node = int(numa_path.read_text().strip())) to avoid type mismatch when comparing or using it.
numa_node = numa_path.read_text().strip()

init/config2args.py:67

  • Defaulting numa_node to 0 when the path doesn't exist changes behavior; please add unit tests for both missing NUMA files and -1 cases to ensure correct defaults.
numa_node = 0

raise ValueError("Not enough CPUs available for the number of RX queues")
workers_cpu_list = cpu_list[:rx_queues]

# Main parameter for DPDK with $eal_opts
Copy link

Copilot AI May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indexing workers_cpu_list[0] without checking if the list is non-empty can lead to IndexError; add a guard (e.g., if not workers_cpu_list: ...) before accessing it.

Suggested change
# Main parameter for DPDK with $eal_opts
# Main parameter for DPDK with $eal_opts
if not workers_cpu_list:
raise ValueError("workers_cpu_list is empty. Ensure it contains at least one CPU.")

Copilot uses AI. Check for mistakes.
Comment on lines +142 to +145
if first_cpu is not None:
primary_param = f"-i \"dpdk@{first_cpu};p={','.join(str(i) for i in range(nic_count))};"
else:
primary_param = f"-i \"dpdk;p={','.join(str(i) for i in range(nic_count))};"
Copy link

Copilot AI May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The None check is redundant because first_cpu is always assigned an integer; simplify the logic by removing this conditional.

Suggested change
if first_cpu is not None:
primary_param = f"-i \"dpdk@{first_cpu};p={','.join(str(i) for i in range(nic_count))};"
else:
primary_param = f"-i \"dpdk;p={','.join(str(i) for i in range(nic_count))};"
primary_param = f"-i \"dpdk@{first_cpu};p={','.join(str(i) for i in range(nic_count))};"

Copilot uses AI. Check for mistakes.
Base automatically changed from clang-format-fix to master May 27, 2025 11:34
@SiskaPavel SiskaPavel merged commit 751378d into master May 27, 2025
7 checks passed
@SiskaPavel SiskaPavel deleted the ipfixprobed-config2args-fix branch May 27, 2025 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants