From: Dean Marx <dmarx@iol.unh.edu>
To: probb@iol.unh.edu, luca.vizzarro@arm.com,
yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com,
paul.szczepanek@arm.com
Cc: dev@dpdk.org, Dean Marx <dmarx@iol.unh.edu>
Subject: [RFC PATCH] dts: add PVVP case to virtio suite
Date: Wed, 17 Dec 2025 14:51:53 -0500 [thread overview]
Message-ID: <20251217195155.32350-1-dmarx@iol.unh.edu> (raw)
Add an additional test case to the virtio_fwd suite which
tests packet forwarding across a physical-virtual-virtual-physical
topology.
Signed-off-by: Dean Marx <dmarx@iol.unh.edu>
---
dts/tests/TestSuite_virtio_fwd.py | 99 +++++++++++++++++++++++++++++++
1 file changed, 99 insertions(+)
diff --git a/dts/tests/TestSuite_virtio_fwd.py b/dts/tests/TestSuite_virtio_fwd.py
index bdecdb76fd..e78da7da05 100644
--- a/dts/tests/TestSuite_virtio_fwd.py
+++ b/dts/tests/TestSuite_virtio_fwd.py
@@ -6,6 +6,8 @@
Verify vhost/virtio pvp and fully virtual functionalities.
"""
+from pathlib import PurePath
+
from scapy.layers.inet import IP
from scapy.layers.l2 import Ether
@@ -195,3 +197,100 @@ def pvp_loop(self) -> None:
f"PVP loop forwarding verification failed: vhost interface RX={rx_packets},"
f" TX={tx_packets} (expected ≥100 each).",
)
+
+ @requires(topology_type=LinkTopology.ONE_LINK)
+ @func_test
+ def pvvp_loop(self) -> None:
+ """Test vhost/virtio physical-virtual-virtual-physical topology.
+
+ Steps:
+ * Create directory for vhost-user socket files.
+ * Launch primary testpmd session with physical NICs and two virtio-user
+ vdevs connected to vhost-user sockets in server mode.
+ * Launch first vhost testpmd session with vhost vdev connected to the
+ first vhost-user socket as client.
+ * Launch second vhost testpmd session with vhost vdev connected to the
+ second vhost-user socket as client.
+ * Configure port forwarding order in primary session to chain physical
+ port through both virtual devices.
+ * Start packet forwarding on all three testpmd sessions.
+ * Send 100 packets to the physical interface from external tester.
+
+ Verify:
+ * Both vhost sessions receive/forward 100+ packets each.
+ """
+ self.sut_node = self._ctx.sut_node
+ if not isinstance(self.sut_node.main_session, LinuxSession):
+ verify(False, "Must be running on a Linux environment.")
+ self.sut_node.main_session.remove_remote_dir("/tmp/vhost-sockets")
+ self.sut_node.main_session.create_directory(PurePath("/tmp/vhost-sockets"))
+ with (
+ TestPmd(
+ prefix="vhost1",
+ vdevs=[
+ VirtualDevice("net_vhost0,iface=/tmp/vhost-sockets/vhost0,queues=1,client=1")
+ ],
+ no_pci=True,
+ ) as vhost1,
+ TestPmd(
+ prefix="vhost2",
+ vdevs=[
+ VirtualDevice("net_vhost1,iface=/tmp/vhost-sockets/vhost1,queues=1,client=1")
+ ],
+ no_pci=True,
+ ) as vhost2,
+ TestPmd(
+ prefix="virtio",
+ vdevs=[
+ VirtualDevice(
+ "net_virtio_user0,mac=00:00:00:00:00:01,path=/tmp/vhost-sockets/vhost0,queues=1,queue_size=1024,server=1"
+ ),
+ VirtualDevice(
+ "net_virtio_user1,mac=00:00:00:00:00:02,path=/tmp/vhost-sockets/vhost1,queues=1,queue_size=1024,server=1"
+ ),
+ ],
+ port_topology=PortTopology.chained,
+ ) as virtio,
+ ):
+ virtio.set_forward_mode(SimpleForwardingModes.mac)
+ vhost1.set_forward_mode(SimpleForwardingModes.mac)
+ vhost2.set_forward_mode(SimpleForwardingModes.mac)
+
+ portlist_order = [0, 2, 3, 1] if len(virtio.ports) == 4 else [0, 2, 1]
+ virtio.set_portlist(order=portlist_order)
+
+ virtio.start()
+ vhost1.start()
+ vhost2.start()
+
+ packet = Ether() / IP()
+ packets = [packet] * 100
+ send_packets_and_capture(packets)
+
+ vhost1.stop()
+ vhost2.stop()
+ virtio.stop()
+
+ vhost1_forwarding_stats, vhost1_raw_output = vhost1.show_port_stats_all()
+ vhost2_forwarding_stats, vhost2_raw_output = vhost2.show_port_stats_all()
+
+ rx_packets_vhost1 = vhost1_forwarding_stats[0].rx_packets
+ tx_packets_vhost1 = vhost1_forwarding_stats[0].tx_packets
+
+ rx_packets_vhost2 = vhost2_forwarding_stats[0].rx_packets
+ tx_packets_vhost2 = vhost2_forwarding_stats[0].tx_packets
+
+ log(f"Vhost1 forwarding statistics:\n{vhost1_raw_output}")
+ log(f"Vhost2 forwarding statistics:\n{vhost2_raw_output}")
+
+ verify(
+ rx_packets_vhost1 >= 100 and tx_packets_vhost1 >= 100,
+ f"PVP loop forwarding verification failed: vhost1 interface RX={rx_packets_vhost1},"
+ f" TX={tx_packets_vhost1} (expected ≥100 each).",
+ )
+
+ verify(
+ rx_packets_vhost2 >= 100 and tx_packets_vhost2 >= 100,
+ f"PVP loop forwarding verification failed: vhost2 interface RX={rx_packets_vhost2},"
+ f" TX={tx_packets_vhost2} (expected ≥100 each).",
+ )
--
2.51.0
reply other threads:[~2025-12-17 19:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20251217195155.32350-1-dmarx@iol.unh.edu \
--to=dmarx@iol.unh.edu \
--cc=Honnappa.Nagarahalli@arm.com \
--cc=dev@dpdk.org \
--cc=luca.vizzarro@arm.com \
--cc=paul.szczepanek@arm.com \
--cc=probb@iol.unh.edu \
--cc=yoan.picchi@foss.arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).