From: Isaac Boukris <iboukris@gmail.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
Chenbo Xia <chenbox@nvidia.com>
Cc: dev@dpdk.org, David Marchand <david.marchand@redhat.com>,
Aman Singh <aman.deep.singh@intel.com>,
Luca Vizzarro <luca.vizzarro@arm.com>,
Patrick Robb <patrickrobb1997@gmail.com>,
Isaac Boukris <iboukris@gmail.com>
Subject: [PATCH v3 7/7] dts: add Rx interrupt test suite
Date: Wed, 18 Nov 2026 02:19:18 +0200 [thread overview]
Message-ID: <20261118001918.990884-8-iboukris@gmail.com> (raw)
In-Reply-To: <20261118001918.990884-1-iboukris@gmail.com>
Test that packets received on a port wake up a testpmd lcore that
sleeps on the Rx queues' interrupts (testpmd's --rxq-interrupt).
The first test case also tests it after the ports are configured a
second time, with the same number of queues.
The second test case tests it after the number of queues changed. It
configures the ports with two queues, then with one queue. The packets
differ in their source address, to spread over the queues, and with
two queues both must receive packets. The test case is skipped if a
port cannot have two queues, or if the packets do not reach both
queues.
The test cases run on the ingress port of the test run, so they test
the driver of that port. For the virtio PCI driver, the SUT is a VM
and its port a virtio-net device.
Signed-off-by: Isaac Boukris <iboukris@gmail.com>
---
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 | 122 +++++++++++++++++++
4 files changed, 133 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..05d82487d5
--- /dev/null
+++ b/dts/tests/TestSuite_rx_interrupt.py
@@ -0,0 +1,122 @@
+# 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. Test it again after the ports are configured again, with the same number of queues
+and with another number.
+"""
+
+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
+
+
+@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.
+
+ A packet is sent only after the previous one woke the lcore up. The lcore is awake for
+ a short time every 10 ms, to look at its queues. A packet that arrives then is received
+ without a wake-up, so send each packet 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
prev parent reply other threads:[~2026-11-18 0:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 12:43 [PATCH 0/1] net/virtio: fix Rx interrupts with MSI-X Isaac Boukris
2026-11-17 12:43 ` [PATCH 1/1] net/virtio: fix Rx interrupt setup " Isaac Boukris
2026-11-17 14:29 ` David Marchand
2026-11-17 19:51 ` Isaac Boukris
2026-11-17 21:59 ` [PATCH v2 0/5] net/virtio: fix Rx interrupts " Isaac Boukris
2026-11-17 21:59 ` [PATCH v2 1/5] net/virtio: fix Rx interrupt setup " Isaac Boukris
2026-11-17 21:59 ` [PATCH v2 2/5] test/virtio_user: add unit test of Rx interrupts Isaac Boukris
2026-11-17 21:59 ` [PATCH v2 3/5] app/testpmd: add Rx queue interrupts option Isaac Boukris
2026-11-17 22:00 ` [PATCH v2 4/5] dts: support virtio PCI ports Isaac Boukris
2026-11-17 22:00 ` [PATCH v2 5/5] dts: add Rx interrupt test suite Isaac Boukris
2026-11-18 0:19 ` [PATCH v3 0/7] net/virtio: fix Rx interrupts with MSI-X Isaac Boukris
2026-11-18 0:19 ` [PATCH v3 1/7] net/virtio: fix Rx interrupt setup " Isaac Boukris
2026-11-18 0:19 ` [PATCH v3 2/7] net/virtio-user: fix packet loss with unused queue pairs Isaac Boukris
2026-11-18 0:19 ` [PATCH v3 3/7] test/virtio_user: add unit test of " Isaac Boukris
2026-11-18 0:19 ` [PATCH v3 4/7] test/virtio_user: add unit test of Rx interrupts Isaac Boukris
2026-11-18 0:19 ` [PATCH v3 5/7] app/testpmd: add Rx queue interrupts option Isaac Boukris
2026-11-18 0:19 ` [PATCH v3 6/7] dts: support virtio PCI ports Isaac Boukris
2026-11-18 0:19 ` Isaac Boukris [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261118001918.990884-8-iboukris@gmail.com \
--to=iboukris@gmail.com \
--cc=aman.deep.singh@intel.com \
--cc=chenbox@nvidia.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=luca.vizzarro@arm.com \
--cc=maxime.coquelin@redhat.com \
--cc=patrickrobb1997@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.