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

Dean Marx dmarx at iol.unh.edu
Fri Oct 3 20:14:37 CEST 2025


> Would it be worth introducing a TextParser class that will actually
> parse the forwarding stats and present them properly to the test?

Yes I think that would be useful moving forward, I'll add one to the
next version.

<snip>
> > +        with TestPmdShell(
> > +            prefix="vhost",
> > +            no_pci=True,
> > +            memory_channels=4,
> > +            vdevs=[VirtualDevice("eth_vhost0,iface=/tmp/vhost-net,client=1")],
> > +        ) as vhost:
> > +            with TestPmdShell(
> > +                prefix="virtio",
> > +                no_pci=True,
> > +                memory_channels=4,
> > +                vdevs=[
> > +                    VirtualDevice(
> > +                        "net_virtio_user0,mac=00:01:02:03:04:05,path=/tmp/vhost-net,server=1"
> > +                    )
> > +                ],
> > +            ) as virtio:
> > +                pass
> > +            # end session and reconnect
> how could this is launched twice? Could use some explanation here.

Essentially the way it works is by launching a vhost-user testpmd
session, which waits for a virtio-user testpmd session to connect to:

EAL: Detected CPU lcores: 32
EAL: Detected NUMA nodes: 2
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/virtio_27338_20251003172250/mp_socket
EAL: Selected IOVA mode 'VA'
EAL: VFIO support initialized
VIRTIO_DRIVER: vhost_user_start_server(): (/tmp/vhost-net) waiting for
client connection...

Then, when the virtio-user session is launched, it connects to the
vhost-user socket /tmp/vhost-net:

VHOST_CONFIG: (/tmp/vhost-net) connected
...
VHOST_CONFIG: (/tmp/vhost-net) new device status(0x0000000f):
VHOST_CONFIG: (/tmp/vhost-net)  -RESET: 0
VHOST_CONFIG: (/tmp/vhost-net)  -ACKNOWLEDGE: 1
VHOST_CONFIG: (/tmp/vhost-net)  -DRIVER: 1
VHOST_CONFIG: (/tmp/vhost-net)  -FEATURES_OK: 1
VHOST_CONFIG: (/tmp/vhost-net)  -DRIVER_OK: 1
VHOST_CONFIG: (/tmp/vhost-net)  -DEVICE_NEED_RESET: 0
VHOST_CONFIG: (/tmp/vhost-net)  -FAILED: 0

By launching the virtio-user session through the context manager, then
closing it and starting a new session with a new context manager, the
original virtio-user session is closed, disconnecting the client. The
test case is verifying that the vhost-user socket can support multiple
sequential client connections.

> > +            with TestPmdShell(
> > +                prefix="virtio",
> > +                no_pci=True,
> > +                memory_channels=4,
> > +                vdevs=[
> > +                    VirtualDevice(
> > +                        "net_virtio_user0,mac=00:01:02:03:04:05,path=/tmp/vhost-net,server=1"
> > +                    )
> Wouldn't it make more sense to store the vdev in a variable and re-use
> it?

Definitely, I'll fix that

<snip>
> > +        self.sut_node = self._ctx.sut_node
> > +        if not isinstance(self._ctx.sut_node.main_session, LinuxSession):
> surely you could just use the `self.sut_node` you've just created :D

Good catch thanks

I'll send out a new version within the next week addressing these
points. Thanks for the review!


More information about the dev mailing list