Skip to content

DPDK: 5-tuple-swap multiprocess testpmd on a single port#4241

Open
mcgov wants to merge 23 commits intomainfrom
mcgov/testpmd-multi-proc
Open

DPDK: 5-tuple-swap multiprocess testpmd on a single port#4241
mcgov wants to merge 23 commits intomainfrom
mcgov/testpmd-multi-proc

Conversation

@mcgov
Copy link
Copy Markdown
Collaborator

@mcgov mcgov commented Jan 21, 2026

Adds a simpler forwarding test using 2 VMs and 1 port. This test uses multiprocess DPDK to create a sender and receiver process on one VM, and a forwarder process on the other. The forwarder sends all traffic back to the first VM by swapping the mac and IP addresses.

@mcgov mcgov added the Review Only Part of a stacked PR label Jan 21, 2026
@mcgov mcgov requested a review from Copilot January 27, 2026 20:40
Copy link
Copy Markdown
Contributor

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

This PR adds a new DPDK test that validates multiprocess testpmd functionality using a 5-tuple-swap forwarding mode with a single port setup. The test involves two VMs: one VM runs both sender and receiver processes using DPDK multiprocessing, while the other VM acts as a forwarder that swaps MAC and IP addresses to return traffic back to the sender VM.

Changes:

  • Introduces multiprocess DPDK support with new enums for process roles and forwarding modes
  • Adds generate_5tswap_run_info function to configure the 3-process test topology
  • Updates command handling throughout to support multiple commands per node (List[str] instead of str)
  • Adds new test case verify_dpdk_testpmd_5tswap_gb_hugepages_netvsc to the test suite

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 10 comments.

File Description
lisa/microsoft/testsuites/dpdk/common.py Adds DpdkMpRole and TestpmdForwardMode enums to support multiprocess contexts and different forwarding modes
lisa/microsoft/testsuites/dpdk/dpdktestpmd.py Adds _generate_mp_arguments method and extends generate_testpmd_command to support multiprocess role configuration and custom core lists
lisa/microsoft/testsuites/dpdk/dpdkutil.py Adds generate_5tswap_run_info function for 5-tuple-swap test setup, updates return types to support multiple commands per node, and modifies verify_dpdk_send_receive to handle multiple processes
lisa/microsoft/testsuites/dpdk/dpdksuite.py Adds new test case for 5-tuple-swap multiprocess validation with 1GB hugepages

Base automatically changed from mcgov/packet-drop to main January 28, 2026 13:38
@mcgov mcgov force-pushed the mcgov/testpmd-multi-proc branch 3 times, most recently from 8ff8754 to 49b60be Compare February 4, 2026 15:56
@mcgov mcgov force-pushed the mcgov/testpmd-multi-proc branch 2 times, most recently from 7b4ad83 to 2951c20 Compare February 10, 2026 00:38
@mcgov mcgov marked this pull request as ready for review February 10, 2026 00:53
@mcgov mcgov requested a review from LiliDeng as a code owner February 10, 2026 00:53
@mcgov mcgov marked this pull request as draft February 10, 2026 01:09
@mcgov mcgov force-pushed the mcgov/testpmd-multi-proc branch from 3cb0b8e to 088eca9 Compare February 10, 2026 16:53
@mcgov mcgov marked this pull request as ready for review February 11, 2026 00:10
@mcgov mcgov force-pushed the mcgov/testpmd-multi-proc branch from ab260bc to d3d36ed Compare February 11, 2026 19:37
@mcgov mcgov removed the Review Only Part of a stacked PR label Feb 12, 2026
@LiliDeng
Copy link
Copy Markdown
Collaborator

@mcgov it failed in canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest, please check it is test case issue or image issue.

Copilot AI review requested due to automatic review settings March 18, 2026 00:06
@mcgov mcgov force-pushed the mcgov/testpmd-multi-proc branch from d3d36ed to f00a6ce Compare March 18, 2026 00:06
@mcgov mcgov requested a review from johnsongeorge-w as a code owner March 18, 2026 00:06
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

lisa/microsoft/testsuites/dpdk/dpdkutil.py:662

  • start_testpmd_concurrent now accepts multiple commands per DpdkTestResources, but _collect_dict_result stores results in output keyed only by the kit, so later command outputs will overwrite earlier ones for the same kit. If multi-process output is needed, change the output structure (e.g., Dict[DpdkTestResources, List[str]] or key by (kit, proc_index)), or explicitly document/rename the function to indicate only the last output per kit is retained.
    def _collect_dict_result(result: Tuple[DpdkTestResources, str]) -> None:
        output[result[0]] = result[1]

Copilot AI review requested due to automatic review settings March 18, 2026 19:26
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

lisa/microsoft/testsuites/dpdk/dpdkutil.py:662

  • start_testpmd_concurrent now accepts a list of commands per test kit, but _collect_dict_result stores a single string per kit (output[result[0]] = result[1]). If more than one command is provided for the same kit, later-finishing tasks will overwrite earlier outputs non-deterministically, losing logs/results. Consider changing the output type to store a list per kit (or key by (kit, index)), and update the collector accordingly.
    command_pairs_as_tuples: List[Tuple[DpdkTestResources, str]] = []
    kits_and_commands = deque(node_cmd_pairs.items())
    for kit_and_commands in kits_and_commands:
        kit, commands = kit_and_commands
        for command in commands:
            command_pairs_as_tuples += [(kit, command)]

    def _collect_dict_result(result: Tuple[DpdkTestResources, str]) -> None:
        output[result[0]] = result[1]

mcgov added 5 commits March 24, 2026 07:55
adds handling for testpmd multiple processes.
will be used for secondary process receiver for 5tswap test.
adds handling for testpmd multiple processes.
will be used for secondary process receiver for 5tswap test.
Copilot AI review requested due to automatic review settings March 24, 2026 14:56
@mcgov mcgov force-pushed the mcgov/testpmd-multi-proc branch from 0c007db to 76be3c0 Compare March 24, 2026 14:56
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.

Comments suppressed due to low confidence (1)

lisa/microsoft/testsuites/dpdk/dpdkutil.py:669

  • start_testpmd_concurrent now supports multiple commands per test kit, but _collect_dict_result stores results in output keyed only by DpdkTestResources, so later commands overwrite earlier ones. This makes the returned output incomplete/ambiguous for multiprocess runs; consider storing a list of outputs per kit (or key by (kit, proc_id) / command index) and updating the return type accordingly.
    command_pairs_as_tuples: List[Tuple[DpdkTestResources, str]] = []
    kits_and_commands = deque(node_cmd_pairs.items())
    for kit_and_commands in kits_and_commands:
        kit, commands = kit_and_commands
        for command in commands:
            command_pairs_as_tuples += [(kit, command)]

    def _collect_dict_result(result: Tuple[DpdkTestResources, str]) -> None:
        output[result[0]] = result[1]

Comment on lines +924 to +927
forwarded_over_received = abs(rcv_tx_pps / rcv_rx_pps)
assert_that(forwarded_over_received).described_as(
"receiver re-send pps was unexpectedly low!"
).is_close_to(0.8, 0.2)
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

The forwarding ratio check uses hard-coded thresholds is_close_to(0.8, 0.2) without any context for why 80% (±20%) is the expected range. Please document the rationale (e.g., expected overhead, batching behavior) or define named constants so it's clear what behavior/regression this is intended to catch.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 24, 2026 17:31
mcgov and others added 2 commits March 24, 2026 10:32
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.

)
# and save it
receiver_includes += [receiver_include]

Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

run_testpmd_concurrent/start_testpmd_concurrent now expect Dict[DpdkTestResources, List[str]], but this path still stores a single string command. This will cause iteration over characters when flattening commands. Wrap this as a one-element list (and ensure any other assignments in this function follow the same List[str] convention).

Copilot uses AI. Check for mistakes.
for kit_and_commands in kits_and_commands:
kit, commands = kit_and_commands
for command in commands:
command_pairs_as_tuples.append((kit, command))
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

With multiple commands per DpdkTestResources, _collect_dict_result overwrites prior output for the same kit, losing logs/results from earlier processes. Consider changing output to Dict[DpdkTestResources, List[str]] (preferred) or appending/concatenating outputs under the same key so multi-process/multi-command runs preserve all outputs.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

don't do that.

@@ -589,7 +667,7 @@ def _run_command_with_testkit(
return (testkit, testkit.testpmd.run_for_n_seconds(cmd, seconds))

Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

With multiple commands per DpdkTestResources, _collect_dict_result overwrites prior output for the same kit, losing logs/results from earlier processes. Consider changing output to Dict[DpdkTestResources, List[str]] (preferred) or appending/concatenating outputs under the same key so multi-process/multi-command runs preserve all outputs.

Suggested change
existing_output = output.get(result[0])
if existing_output is None:
output[result[0]] = result[1]
else:
# concatenate outputs for the same kit to avoid losing earlier results
output[result[0]] = f"{existing_output}\n{result[1]}"

Copilot uses AI. Check for mistakes.

if multiple_queues:
if self.is_mana and mode == "txonly":
if self.is_mana and mode in ["rxonly", "5tswap"]:
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

This changes MANA queue selection behavior: previously txonly on MANA used 8 queues, but now txonly falls back to 4 queues. If existing perf/throughput baselines depend on 8-queue txonly, this is a regression. If the intent is to use 8 queues for all MANA modes (or specifically txonly), adjust the condition accordingly or document why txonly is excluded.

Suggested change
if self.is_mana and mode in ["rxonly", "5tswap"]:
if self.is_mana and mode in ["rxonly", "5tswap", "txonly"]:

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this was a bug, this change fixes it

mp_role=DpdkMpRole.PRIMARY_PROCESS,
num_procs=2,
proc_id=0,
core_list=[3, 7, 11, 17, 21],
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

The new 5tswap path hard-codes CPU IDs (including up to CPU 31). This makes the test fragile across VM sizes/NUMA layouts/CPU pinning and can fail even when min_core_count is met but CPU indexing/availability differs. Prefer deriving a core list from lscpu/available CPUs at runtime (and ideally keeping primary/secondary core allocations non-overlapping and NUMA-aware).

Copilot uses AI. Check for mistakes.
mp_role=DpdkMpRole.SECONDARY_PROCESS,
num_procs=2,
proc_id=1,
core_list=[1, 5, 9, 13, 19, 25, 29, 31],
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

The new 5tswap path hard-codes CPU IDs (including up to CPU 31). This makes the test fragile across VM sizes/NUMA layouts/CPU pinning and can fail even when min_core_count is met but CPU indexing/availability differs. Prefer deriving a core list from lscpu/available CPUs at runtime (and ideally keeping primary/secondary core allocations non-overlapping and NUMA-aware).

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings March 24, 2026 21:07
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

lisa/microsoft/testsuites/dpdk/dpdkutil.py:662

  • start_testpmd_concurrent now accepts Dict[DpdkTestResources, List[str]] and flattens it, but _collect_dict_result stores results in output[result[0]], which will silently overwrite earlier outputs when a kit has multiple commands. Either restrict this helper to one command per kit (validate and fail fast), or change output to collect a list of outputs per kit (or key by (kit, index)) so multi-command runs don’t lose data.
    command_pairs_as_tuples: List[Tuple[DpdkTestResources, str]] = []
    kits_and_commands = deque(node_cmd_pairs.items())
    for kit_and_commands in kits_and_commands:
        kit, commands = kit_and_commands
        for command in commands:
            command_pairs_as_tuples.append((kit, command))

    def _collect_dict_result(result: Tuple[DpdkTestResources, str]) -> None:
        output[result[0]] = result[1]

Comment on lines +945 to +948
assert_that(sender_secondary_output).described_as(
"Sender secondary process output was empty"
).is_not_empty()
snd_rx_pps = receiver.testpmd.get_mean_rx_pps()
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

In the 5tswap validation, snd_rx_pps is taken from receiver.testpmd.get_mean_rx_pps() even though this value is supposed to represent the sender’s secondary (rxonly) process. Also, the secondary process output is never parsed with process_testpmd_output, so any get_mean_rx_pps() call will be based on whichever output was parsed last (currently the sender primary txonly run), not the secondary rxonly run. Parse sender_secondary_output and compute RX PPS from that output (without overwriting the sender primary TX metrics), and use the sender’s testpmd instance rather than the receiver’s.

Suggested change
assert_that(sender_secondary_output).described_as(
"Sender secondary process output was empty"
).is_not_empty()
snd_rx_pps = receiver.testpmd.get_mean_rx_pps()
def _get_sender_secondary_rx_pps() -> Decimal:
rx_pps_values: List[Decimal] = []
for line in sender_secondary_output.splitlines():
if "rx-pps" in line.lower():
match = re.search(r"([0-9]+(?:\.[0-9]+)?)", line)
if match:
rx_pps_values.append(Decimal(match.group(1)))
assert_that(rx_pps_values).described_as(
"Unable to parse RX PPS from sender secondary testpmd output"
).is_not_empty()
return sum(rx_pps_values) / Decimal(len(rx_pps_values))
assert_that(sender_secondary_output).described_as(
"Sender secondary process output was empty"
).is_not_empty()
snd_rx_pps = _get_sender_secondary_rx_pps()

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I have good news, they have the same output.

Comment on lines +292 to +296
mp_role=DpdkMpRole.PRIMARY_PROCESS,
num_procs=2,
proc_id=0,
core_list=[3, 7, 11, 17, 21],
extra_args=f"--tx-ip={snd_nic.ip_addr},{rcv_nic.ip_addr}",
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

core_list=[3, 7, 11, 17, 21] hard-codes specific CPU IDs for the sender primary process without any explanation. Since this directly controls test behavior and scheduling assumptions, please add an inline comment explaining the rationale (e.g., avoiding sibling threads/NUMA layout) or derive the core list from lscpu/NUMA topology so it adapts to different VM sizes.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +307 to +311
mp_role=DpdkMpRole.SECONDARY_PROCESS,
num_procs=2,
proc_id=1,
core_list=[1, 5, 9, 13, 19, 25, 29, 31],
)
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

core_list=[1, 5, 9, 13, 19, 25, 29, 31] hard-codes CPU IDs for the sender secondary process. Please add an inline comment documenting why these exact cores were chosen (and any required minimum core count / SMT assumptions), or compute them dynamically from topology to avoid fragile pinning across SKUs.

Copilot generated this review using guidance from repository custom instructions.
Copilot AI review requested due to automatic review settings March 24, 2026 23:11
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

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