[PATCH v2 2/2] dts: add virtio forwarding test suite

Dean Marx dmarx at iol.unh.edu
Fri Oct 24 20:38:09 CEST 2025


>> +"""Virtio forwarding test suite.
>> +
>> +Verify vhost/virtio pvp and loopback topology functionalities.
>
>
> Loopback doesn't seem quite right. Maybe you can just say pvp and fully virtual?

Sure, I'll change that in the pvp_loop docstring as well

>
>>
>> +"""
>> +
>> +from scapy.layers.inet import IP
>> +from scapy.layers.l2 import Ether
>> +
>> +from api.capabilities import LinkTopology
>> +from api.testpmd import TestPmd
>> +from api.testpmd.config import SimpleForwardingModes
>> +from framework.parser import TextParser
>> +from framework.test_suite import TestSuite, func_test
>> +from framework.testbed_model.capability import requires
>> +from framework.testbed_model.linux_session import LinuxSession
>> +from framework.testbed_model.virtual_device import VirtualDevice
>> +
>> +
>> + at requires(topology_type=LinkTopology.TWO_LINKS)
>
>
> two links is true for the pvp test, but the other two dont require any links, right?

Yes good catch, I'll change that around

>
>>
>> +class TestVirtioFwd(TestSuite):
>> +    """Virtio forwarding test suite."""
>> +
>> +    class ForwardingParsers:
>> +        """Class for gathering Rx/Tx packets from testpmd stats."""
>> +
>> +        rx_packets = TextParser.find_int(r"RX-packets:\s*(\d+)")
>> +        tx_packets = TextParser.find_int(r"TX-packets:\s*(\d+)")
>> +
>> +    class vdevs:
>> +        """Class containing virtio-user and vhost-user virtual devices."""
>> +
>> +        virtio_user = VirtualDevice(
>> +            "net_virtio_user0,mac=00:01:02:03:04:05,path=/tmp/vhost-net,server=1"
>> +        )
>> +        vhost_user = VirtualDevice("eth_vhost0,iface=/tmp/vhost-net,client=1")
>
>
> +1 to Luca's comment about not needing these to be internal classes.

Heard

<snip>
>> +        with TestPmd(
>> +            prefix="virtio",
>> +            vdevs=[VirtualDevice("virtio_user0,path=/dev/vhost-net,queues=1,queue_size=1024")],
>> +        ) as virtio:
>> +            self.sut_node.main_session.send_command("ip link set dev tap0 up", privileged=True)
>> +            with TestPmd(
>> +                prefix="vhost", no_pci=True, vdevs=[VirtualDevice("net_af_packet0,iface=tap0")]
>> +            ) as vhost:
>> +                virtio.set_forward_mode(SimpleForwardingModes.mac)
>> +                vhost.set_forward_mode(SimpleForwardingModes.mac)
>> +                vhost.start()
>> +                virtio.start()
>> +
>> +                packet = Ether() / IP()
>> +                packets = [packet] * 100
>> +                captured_packets = self.send_packets_and_capture(packets)
>> +
>> +                self.verify(
>> +                    len(captured_packets) >= 100, "Sent packets not received on physical interface."
>> +                )
>
>
> Can you remind me what docs you were working from for setting up the pvp test? I'm guessing how you've done it is valid, but I originally thought we needed 2 tap interfaces and that vhost had to run in --no-pci, not virtio. Better safe than sorry. :)

https://doc.dpdk.org/guides/howto/virtio_user_as_exception_path.html

According to the doc you only need one tap interface. Also the current
implementation already has vhost using --no-pci, not virtio

>
>>
>> --
>> 2.51.0
>>
>
> Reviewed-by: Patrick Robb <probb at iol.unh.edu>


More information about the dev mailing list