DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dean Marx <dmarx@iol.unh.edu>
To: Luca Vizzarro <luca.vizzarro@arm.com>
Cc: probb@iol.unh.edu, yoan.picchi@foss.arm.com,
	Honnappa.Nagarahalli@arm.com,  paul.szczepanek@arm.com,
	dev@dpdk.org
Subject: Re: [PATCH v2 2/2] dts: add virtio forwarding test suite
Date: Tue, 21 Oct 2025 13:35:32 -0400	[thread overview]
Message-ID: <CABD7UXPoNjmb4tYm2tKG86UX4hyKfQo1M21JH6v78MYUqjjnMA@mail.gmail.com> (raw)
In-Reply-To: <176105647358.88782.2909811739370348721.luca.vizzarro@arm.com>

On Tue, Oct 21, 2025 at 11:13 AM Luca Vizzarro <luca.vizzarro@arm.com> wrote:
>
> On Fri, Oct 03, 2025 at 03:27:16PM +0000, Dean Marx wrote:
> > Add test suite covering virtio-user and vhost
> > server/client forwarding scenarios with
> > testpmd packet validation.
> >
> > Signed-off-by: Dean Marx <dmarx@iol.unh.edu>
<snip>
> > +
> > +virtio_fwd Test Suite
> > +===========================
> this is fine, but ideally should be aligned with the heading.

I'll change this, I just noticed I put it in the wrong directory too
so thanks to you and Patrick for pointing that out

<snip>
> > +    class vdevs:
> > +        """Class containing virtio-user and vhost-user virtual devices."""
> is it actually vhost-user? or just vhost?

It's vhost-user since it's using a unix socket path (/tmp/vhost-net),
whereas a vhost version would use a kernel network interface like tap0
or something similar.

> > +
> > +        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")
>
> How come you put these properties under some internal classes? Not sure
> how this helps. The vdevs class should technically be capitalised as
> well. Either way if these are just class variables, they should be made
> as such. Doing the following:
>
>   parse_rx_packets: ClassVar[ParserFn] = TextParser...
>   parse_tx_packets: ...
>   virtio_user_vdev: ClassVar[VirtualDevice] = ...
>   vhost_user_vdev: ...
>
> is perfectly fine and acceptable.
>
> I've changed the naming of the parser functions, because you are
> effectively treating these as functions, then they should be named as
> such.

Got it, I'll change this

<snip>
> > +
> > +            rx_packets = self.ForwardingParsers.rx_packets["TextParser_fn"](forwarding_stats) or 0
> > +            tx_packets = self.ForwardingParsers.tx_packets["TextParser_fn"](forwarding_stats) or 0
>
> So I understand you are basically reusing the functionality of the
> TextParser functions here. I guess it's not a bad shout but I would not
> expose the internals which are only meant to be used within the
> TextParser class for handling with generic dataclass metadata.
>
> Ideally we want this:
>
>   rx_packets = self.parse_rx_packets(forwarding_stats) or 0
>
> You can implement __call__ in ParserFn to make this happen. In the best
> scenario we'd want the return type to be correct as well instead of just
> Any. If you want to, you can play around and implement a Generic[T] in
> ParserFn to replace Any with T. This will probably require you to make
> changes elsewhere though. It may get tricky easily, so it's not really
> mandatory.

Hmm okay, I'll try to write a workaround for this without
overcomplicating things

<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)
>
> This should have been implemented as part of main_session. If it's not,
> it should. Shouldn't call send_command directly like this.

I'll add this to the next version

>
> > +            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."
> > +                )
> > --
> > 2.51.0
> >

      reply	other threads:[~2025-10-21 17:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-16 20:04 [PATCH v1 1/2] dts: add start Tx first method to testpmd shell Dean Marx
2025-09-16 20:04 ` [PATCH v1 2/2] dts: add virtio forwarding test suite Dean Marx
2025-09-23 11:38   ` Luca Vizzarro
2025-10-03 18:14     ` Dean Marx
2025-10-09 13:04   ` Patrick Robb
2025-09-23 11:27 ` [PATCH v1 1/2] dts: add start Tx first method to testpmd shell Luca Vizzarro
2025-10-03 19:27 ` [PATCH v2 " Dean Marx
2025-10-03 19:27   ` [PATCH v2 2/2] dts: add virtio forwarding test suite Dean Marx
2025-10-21 15:13     ` Luca Vizzarro
2025-10-21 17:35       ` Dean Marx [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=CABD7UXPoNjmb4tYm2tKG86UX4hyKfQo1M21JH6v78MYUqjjnMA@mail.gmail.com \
    --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).