[PATCH v4 8/8] dts: add Rx interrupt test suite

Isaac Boukris iboukris at gmail.com
Wed Nov 18 09:27:52 CET 2026


Test that packets received on a port wake up a testpmd lcore that
sleeps on the Rx queues' interrupts (--rxq-interrupt).

The first test case also does it after the ports are configured
again with the same number of queues. The second does it after the
number of queues changed, to two and back to one. With two queues,
both must receive packets. It is skipped if a port cannot have two
queues, or if the packets do not reach both.

The test cases run on the ingress port of the test run, so they test
its driver. For the virtio PCI driver, the SUT is a VM and its port a
virtio-net device.

Signed-off-by: Isaac Boukris <iboukris at gmail.com>
---
v4: shorter commit message and docstrings, no code change.

 doc/api/dts/tests.TestSuite_rx_interrupt.rst |   8 ++
 dts/api/params/types.py                      |   1 +
 dts/api/testpmd/config.py                    |   2 +
 dts/tests/TestSuite_rx_interrupt.py          | 119 +++++++++++++++++++
 4 files changed, 130 insertions(+)
 create mode 100644 doc/api/dts/tests.TestSuite_rx_interrupt.rst
 create mode 100644 dts/tests/TestSuite_rx_interrupt.py

diff --git a/doc/api/dts/tests.TestSuite_rx_interrupt.rst b/doc/api/dts/tests.TestSuite_rx_interrupt.rst
new file mode 100644
index 0000000000..ff65daf78c
--- /dev/null
+++ b/doc/api/dts/tests.TestSuite_rx_interrupt.rst
@@ -0,0 +1,8 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+
+rx_interrupt Test Suite
+=======================
+
+.. automodule:: tests.TestSuite_rx_interrupt
+   :members:
+   :show-inheritance:
diff --git a/dts/api/params/types.py b/dts/api/params/types.py
index c4b718eebe..3d852cf1fb 100644
--- a/dts/api/params/types.py
+++ b/dts/api/params/types.py
@@ -190,6 +190,7 @@ class TestPmdParamsDict(EalParamsDict, total=False):
     disable_device_start: Switch
     no_lsc_interrupt: Switch
     no_rmv_interrupt: Switch
+    rxq_interrupt: Switch
     bitrate_stats: int | None
     latencystats: int | None
     print_events: list[Event] | None
diff --git a/dts/api/testpmd/config.py b/dts/api/testpmd/config.py
index c72c1b2c90..92b5a23862 100644
--- a/dts/api/testpmd/config.py
+++ b/dts/api/testpmd/config.py
@@ -491,6 +491,7 @@ class TestPmdParams(EalParams):
                               for the first time.
         no_lsc_interrupt: Disable LSC interrupts for all ports, even those supporting it.
         no_rmv_interrupt: Disable RMV interrupts for all ports, even those supporting it.
+        rxq_interrupt: Enable Rx queue interrupts for all ports. Idle forwarding lcores sleep.
         bitrate_stats: Set the logical core N to perform bitrate calculation.
         latencystats: Set the logical core N to perform latency and jitter calculations.
         print_events: Enable printing the occurrence of the designated events.
@@ -596,6 +597,7 @@ class TestPmdParams(EalParams):
     disable_device_start: Switch = None
     no_lsc_interrupt: Switch = None
     no_rmv_interrupt: Switch = None
+    rxq_interrupt: Switch = None
     bitrate_stats: int | None = None
     latencystats: int | None = None
     print_events: list[Event] | None = field(
diff --git a/dts/tests/TestSuite_rx_interrupt.py b/dts/tests/TestSuite_rx_interrupt.py
new file mode 100644
index 0000000000..a7cbdbfb8b
--- /dev/null
+++ b/dts/tests/TestSuite_rx_interrupt.py
@@ -0,0 +1,119 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2026 Isaac Boukris
+
+"""Rx interrupt test suite.
+
+Test that packets received on a port wake up a testpmd lcore that sleeps on the Rx queues'
+interrupts, also after the ports are configured again with the same or another number of queues.
+"""
+
+import re
+
+from scapy.layers.inet import IP, UDP
+from scapy.layers.l2 import Ether
+from scapy.packet import Raw
+
+from api.exception import InteractiveCommandExecutionError
+from api.packet import send_packets
+from api.test import fail, verify_else_skip
+from api.test_suite import TestSuite, func_suite, func_test
+from api.testpmd import TestPmd
+from api.testpmd.config import SimpleForwardingModes
+
+
+ at func_suite
+class TestRxInterrupt(TestSuite):
+    """Rx interrupt test suite."""
+
+    #: The number of packets to send. Each of them must wake the lcore up.
+    NUMBER_OF_WAKE_UPS = 8
+
+    def _wake_ups(self, testpmd: TestPmd) -> int:
+        match = re.search(r"RX-wakeups:\s+(\d+)", testpmd.send_command("show fwd stats all"))
+        return int(match.group(1)) if match else 0
+
+    def _verify_wake_ups(self, testpmd: TestPmd) -> str:
+        """Verify that packets wake up the lcore of `testpmd`, `NUMBER_OF_WAKE_UPS` times.
+
+        The packets differ in their source address, to spread over the Rx queues. Each is sent
+        after the previous one woke the lcore up. The lcore looks at its queues every 10 ms, and
+        a packet that arrives then causes no wake-up, so each packet is sent up to three times.
+
+        Returns:
+            The forward statistics that testpmd shows when it stops.
+        """
+        testpmd.start()
+        for number in range(1, self.NUMBER_OF_WAKE_UPS + 1):
+            packet = Ether() / IP(src=f"192.168.0.{number}") / UDP() / Raw(b"\0" * 32)
+            wake_ups = self._wake_ups(testpmd)
+            for _ in range(3):
+                send_packets([packet])
+                if self._wake_ups(testpmd) > wake_ups:
+                    break
+            else:
+                fail(f"Packet {number} did not wake up the lcore.")
+        return testpmd.stop()
+
+    def _configure_again(self, testpmd: TestPmd, number_of_queues: int) -> None:
+        """Stop the ports of `testpmd`, configure them with `number_of_queues` and start them."""
+        testpmd.set_ports_queues(number_of_queues)
+        try:
+            testpmd.start_all_ports()
+        except InteractiveCommandExecutionError:
+            fail(f"The ports did not start, configured with {number_of_queues} queue(s).")
+
+    @func_test
+    def wake_up_on_packet(self) -> None:
+        """Wake up a sleeping lcore with packets, also after a second configuration.
+
+        Steps:
+            * Start testpmd with Rx queue interrupts, receiving.
+            * Send packets to the ingress port, one at a time.
+            * Stop the ports, configure them again with the same number of queues, start them
+              and send again.
+
+        Verify:
+            * Each packet wakes up the lcore from the queue's interrupt.
+            * The ports start after the second configuration.
+        """
+        with TestPmd(rxq_interrupt=True, forward_mode=SimpleForwardingModes.rxonly) as testpmd:
+            self._verify_wake_ups(testpmd)
+            self._configure_again(testpmd, 1)
+            self._verify_wake_ups(testpmd)
+
+    @func_test
+    def wake_up_on_packet_after_queue_number_change(self) -> None:
+        """Wake up a sleeping lcore with packets after the number of queues changed.
+
+        The test case is skipped if a port cannot have two queues, or if the packets do not
+        reach both queues.
+
+        Steps:
+            * Start testpmd with Rx queue interrupts, receiving, with one queue.
+            * Stop the ports, configure them with two queues, start them and send packets to
+              the ingress port, one at a time.
+            * Do the same with one queue.
+
+        Verify:
+            * Each packet wakes up the lcore from a queue's interrupt.
+            * With two queues, both queues receive packets.
+            * The ports start after each configuration.
+        """
+        with TestPmd(rxq_interrupt=True, forward_mode=SimpleForwardingModes.rxonly) as testpmd:
+            max_queues = min(
+                min(port.max_rx_queues_num, port.max_tx_queues_num)
+                for port in testpmd.show_port_info_all()
+            )
+            verify_else_skip(
+                max_queues >= 2, f"The test needs 2 queues, and a port has {max_queues} at most."
+            )
+            self._configure_again(testpmd, 2)
+            statistics = self._verify_wake_ups(testpmd)
+            # Each packet woke the lcore up. So a queue that received packets woke it up.
+            for queue in (0, 1):
+                verify_else_skip(
+                    f"RX Port= 0/Queue= {queue}" in statistics,
+                    f"No packet reached Rx queue {queue} of the ingress port.",
+                )
+            self._configure_again(testpmd, 1)
+            self._verify_wake_ups(testpmd)
-- 
2.56.1



More information about the dev mailing list