From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7EDC4489B3; Thu, 23 Oct 2025 15:00:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4A3C4402C1; Thu, 23 Oct 2025 15:00:12 +0200 (CEST) Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by mails.dpdk.org (Postfix) with ESMTP id 3C13F40151 for ; Thu, 23 Oct 2025 15:00:11 +0200 (CEST) Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-b608df6d2a0so670460a12.1 for ; Thu, 23 Oct 2025 06:00:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1761224410; x=1761829210; darn=dpdk.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=0S+7KUal2B9Dw+k6retsRlgzQL7NYUGJ+Nm2c0lpjTE=; b=PtRkZYyhOFi34DTMeL5kFCbbhq+aE398chMj7HIvNs4JyfTD2oKyqcBz/Cl4b4TG37 RZIBnBm5094zTaw2KSu2ZID3k3yapDN+N7/R0Ab246NJs/wH4vQUIvclbo/aXzhRHuYa 5+LruYu61dGRkTHNCM8oFnMIi0ZfshAqSowN0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761224410; x=1761829210; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0S+7KUal2B9Dw+k6retsRlgzQL7NYUGJ+Nm2c0lpjTE=; b=YDHdCu1D0WDEHtg8BuezYxAMOO3jPqpDIVr/yN5ckmWBmIOm5p+3UCBXIzMTLnuV9K niHHn6CIKTjF43jBLFAmXZECsFZEwXr/GPa4taWI0y/zGNpJrvZIA14vHwkFl6uP5mes DKByZp0AS4jkC7d4BgBaP1qLeg/TmJZToJxIPSa7eUg0KoxMh73rwUkKiv/45jLYxFmr AIriArWWVmL3YpsMGkA6oixoqXNbR0Q17v1zyXqZde70QE80bjnpKUd99RacM0aSdTDg eBxXVhv0iRxDdNTmelIIKPaiH9ajBANxFnreoX22RrJHEM5duR3ScAe3FbYSCIaY2tGq KxvA== X-Forwarded-Encrypted: i=1; AJvYcCWZCk2wIgXzFs8djHWiv/yVyRTz/WSECIT+hc9UV0kGr8goot+iOdDsQlL9lXHxYZ2Sk5E=@dpdk.org X-Gm-Message-State: AOJu0Yz/kbeVyW0LiI6IchPeDWYK3wnphKIlZrxcG2nJkqf7xAy8XWZ7 ejMmewfXDUbkM5C8F/Wo9H/eqM29VLLP3phqFVocZLQUq/HzT1UEkz72nMceJ6AnKFW7xhiZ1u0 RGhze9BFuYrMUeJ7i815ohp1S450N4g8u4NVIDwKoLg== X-Gm-Gg: ASbGncvY3fDvHS5A2sge/p476yBQ3Yqhihut4F6todgVHGppgFRvgqydLvC/978yI1h /OfmiSvrh1eLESg0mprjHjnKdcRJmMVnfDmF/QpKMUqfb+obElcfXVD5EbOUkL0fPl0g1eva3oE /nocThly4KS0wYp/7LPR8cIKptrxpABwCh9ZgJdKkjOOP82jhXd0zjvm0OhKNxfZ4kdxEadEBHc /dgX2Nyvdm2MeEH2b6qhT6O/4Y3OSrsb6MbIf29YBuf8j5WCDodFft6cCbUb31mbpmLIHW4UrJn d0FK21TCjXu6Op4s3AmwBvrQOuQ= X-Google-Smtp-Source: AGHT+IEddHbChH2lGYCmult07MgKWbDQlw30lkOL7s86cHxBsYveLdfwmgcqEdlgPhqr3sekNAkcb3irsyk/MJ4LQ6M= X-Received: by 2002:a17:903:3546:b0:267:e097:7a9c with SMTP id d9443c01a7336-290cc6d4ba8mr320329395ad.53.1761224410158; Thu, 23 Oct 2025 06:00:10 -0700 (PDT) MIME-Version: 1.0 References: <20250916200458.259376-1-dmarx@iol.unh.edu> <20251003192717.444490-1-dmarx@iol.unh.edu> <20251003192717.444490-2-dmarx@iol.unh.edu> In-Reply-To: <20251003192717.444490-2-dmarx@iol.unh.edu> From: Patrick Robb Date: Thu, 23 Oct 2025 08:59:17 -0400 X-Gm-Features: AS18NWBBmtWbuG6lI_e96QYXjNtG-yxBYbK6QUrEDgX-DnY1JLg1dmQ5rch2Uok Message-ID: Subject: Re: [PATCH v2 2/2] dts: add virtio forwarding test suite To: Dean Marx Cc: luca.vizzarro@arm.com, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com, dev@dpdk.org Content-Type: multipart/alternative; boundary="000000000000566d320641d303bc" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --000000000000566d320641d303bc Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Oct 3, 2025 at 3:27=E2=80=AFPM Dean Marx wrote: > Add test suite covering virtio-user and vhost > server/client forwarding scenarios with > testpmd packet validation. > > Signed-off-by: Dean Marx > --- > doc/api/tests.TestSuite_virtio_fwd.rst | 8 ++ > dts/tests/TestSuite_virtio_fwd.py | 180 +++++++++++++++++++++++++ > 2 files changed, 188 insertions(+) > create mode 100644 doc/api/tests.TestSuite_virtio_fwd.rst > create mode 100644 dts/tests/TestSuite_virtio_fwd.py > > diff --git a/doc/api/tests.TestSuite_virtio_fwd.rst > b/doc/api/tests.TestSuite_virtio_fwd.rst > new file mode 100644 > index 0000000000..782eddad2d > --- /dev/null > +++ b/doc/api/tests.TestSuite_virtio_fwd.rst > @@ -0,0 +1,8 @@ > +.. SPDX-License-Identifier: BSD-3-Clause > + > +virtio_fwd Test Suite > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > + > +.. automodule:: tests.TestSuite_virtio_fwd > + :members: > + :show-inheritance: > \ No newline at end of file > diff --git a/dts/tests/TestSuite_virtio_fwd.py > b/dts/tests/TestSuite_virtio_fwd.py > new file mode 100644 > index 0000000000..194bd24257 > --- /dev/null > +++ b/dts/tests/TestSuite_virtio_fwd.py > @@ -0,0 +1,180 @@ > +# SPDX-License-Identifier: BSD-3-Clause > +# Copyright(c) 2025 University of New Hampshire > + > +"""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? > +""" > + > +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 > + > + > +@requires(topology_type=3DLinkTopology.TWO_LINKS) > two links is true for the pvp test, but the other two dont require any links, right? > +class TestVirtioFwd(TestSuite): > + """Virtio forwarding test suite.""" > + > + class ForwardingParsers: > + """Class for gathering Rx/Tx packets from testpmd stats.""" > + > + rx_packets =3D TextParser.find_int(r"RX-packets:\s*(\d+)") > + tx_packets =3D TextParser.find_int(r"TX-packets:\s*(\d+)") > + > + class vdevs: > + """Class containing virtio-user and vhost-user virtual devices."= "" > + > + virtio_user =3D VirtualDevice( > + > "net_virtio_user0,mac=3D00:01:02:03:04:05,path=3D/tmp/vhost-net,server=3D= 1" > + ) > + vhost_user =3D > VirtualDevice("eth_vhost0,iface=3D/tmp/vhost-net,client=3D1") > +1 to Luca's comment about not needing these to be internal classes. > + > + @func_test > + def virtio_server(self) -> None: > + """Test virtio server packet transmission. > + > + Steps: > + * Launch a testpmd session with a vhost-user virtual device > (client side). > + * Launch a testpmd session with a virtio-user virtual device > (server side). > + * Set the forwarding mode to mac in both sessions. > + * Start packet forwarding on vhost session. > + * Send a burst of packets from the virtio session. > + * Stop packet forwarding on vhost session and collect Rx > packet stats. > + > + Verify: > + * Vhost session receives packets from virtio session. > + """ > + with ( > + TestPmd( > + prefix=3D"vhost", > + no_pci=3DTrue, > + memory_channels=3D4, > + vdevs=3D[self.vdevs.vhost_user], > + ) as vhost, > + TestPmd( > + prefix=3D"virtio", > + no_pci=3DTrue, > + memory_channels=3D4, > + vdevs=3D[self.vdevs.virtio_user], > + ) as virtio, > + ): > + vhost.set_forward_mode(SimpleForwardingModes.mac) > + virtio.set_forward_mode(SimpleForwardingModes.mac) > + > + vhost.start() > + virtio.start_tx_first(burst_num=3D32) > + > + forwarding_stats =3D vhost.stop() > + > + rx_packets =3D > self.ForwardingParsers.rx_packets["TextParser_fn"](forwarding_stats) or 0 > + tx_packets =3D > self.ForwardingParsers.tx_packets["TextParser_fn"](forwarding_stats) or 0 > + > + self.verify( > + rx_packets !=3D 0 and tx_packets !=3D 0, > + "Vhost session failed to receive packets from virtio > session.", > + ) > + > + @func_test > + def virtio_server_reconnect(self) -> None: > + """Test virtio server reconnection. > + > + Steps: > + * Launch a testpmd session with a vhost-user virtual device > (client side). > + * Launch a testpmd session with a virtio-user virtual device > (server side). > + * Close the virtio session and relaunch it. > + * Start packet forwarding on vhost session. > + * Send a burst of packets from the virtio session. > + * Stop packet forwarding on vhost session and collect Rx > packet stats. > + > + Verify: > + * Vhost session receives packets from relaunched virtio > session. > + """ > + with TestPmd( > + prefix=3D"vhost", > + no_pci=3DTrue, > + memory_channels=3D4, > + vdevs=3D[self.vdevs.vhost_user], > + ) as vhost: > + with TestPmd( > + prefix=3D"virtio", > + no_pci=3DTrue, > + memory_channels=3D4, > + vdevs=3D[self.vdevs.virtio_user], > + ) as virtio: > + pass > + # end session and reconnect > + with TestPmd( > + prefix=3D"virtio", > + no_pci=3DTrue, > + memory_channels=3D4, > + vdevs=3D[self.vdevs.virtio_user], > + ) as virtio: > + virtio.set_forward_mode(SimpleForwardingModes.mac) > + vhost.set_forward_mode(SimpleForwardingModes.mac) > + > + vhost.start() > + virtio.start_tx_first(burst_num=3D32) > + > + forwarding_stats =3D vhost.stop() > + > + rx_packets =3D ( > + > self.ForwardingParsers.rx_packets["TextParser_fn"](forwarding_stats) or 0 > + ) > + tx_packets =3D ( > + > self.ForwardingParsers.tx_packets["TextParser_fn"](forwarding_stats) or 0 > + ) > + > + self.verify( > + rx_packets !=3D 0 and tx_packets !=3D 0, > + "Vhost session failed to receive packets from virtio > session.", > + ) > + > + @func_test > + def pvp_loop(self) -> None: > + """Test vhost/virtio physical-virtual-physical loop topology. > + > + Steps: > + * Launch testpmd session with a physical NIC and virtio-user > vdev > + connected to a vhost-net socket. > + * Configure the tap interface that is created with IP addres= s > and > + set link state to UP. > + * Launch second testpmd session with af_packet vdev connecte= d > to > + the tap interface. > + * Start packet forwarding on both testpmd sessions. > + * Send 100 packets to the physical interface from external > tester. > + * Capture packets on the same physical interface. > + > + Verify: > + * Physical interface receives all 100 sent packets. > + """ > + self.sut_node =3D self._ctx.sut_node > + if not isinstance(self.sut_node.main_session, LinuxSession): > + self.verify(False, "Must be running on a Linux environment."= ) > + with TestPmd( > + prefix=3D"virtio", > + > vdevs=3D[VirtualDevice("virtio_user0,path=3D/dev/vhost-net,queues=3D1,que= ue_size=3D1024")], > + ) as virtio: > + self.sut_node.main_session.send_command("ip link set dev tap= 0 > up", privileged=3DTrue) > + with TestPmd( > + prefix=3D"vhost", no_pci=3DTrue, > vdevs=3D[VirtualDevice("net_af_packet0,iface=3Dtap0")] > + ) as vhost: > + virtio.set_forward_mode(SimpleForwardingModes.mac) > + vhost.set_forward_mode(SimpleForwardingModes.mac) > + vhost.start() > + virtio.start() > + > + packet =3D Ether() / IP() > + packets =3D [packet] * 100 > + captured_packets =3D self.send_packets_and_capture(packe= ts) > + > + self.verify( > + len(captured_packets) >=3D 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. :) > -- > 2.51.0 > > Reviewed-by: Patrick Robb --000000000000566d320641d303bc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Fri, Oct 3, = 2025 at 3:27=E2=80=AFPM Dean Marx <= dmarx@iol.unh.edu> 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>
---
=C2=A0doc/api/tests.TestSuite_virtio_fwd.rst |=C2=A0 =C2=A08 ++
=C2=A0dts/tests/TestSuite_virtio_fwd.py=C2=A0 =C2=A0 =C2=A0 | 180 +++++++++= ++++++++++++++++
=C2=A02 files changed, 188 insertions(+)
=C2=A0create mode 100644 doc/api/tests.TestSuite_virtio_fwd.rst
=C2=A0create mode 100644 dts/tests/TestSuite_virtio_fwd.py

diff --git a/doc/api/tests.TestSuite_virtio_fwd.rst b/doc/api/tests.TestSui= te_virtio_fwd.rst
new file mode 100644
index 0000000000..782eddad2d
--- /dev/null
+++ b/doc/api/tests.TestSuite_virtio_fwd.rst
@@ -0,0 +1,8 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+
+virtio_fwd Test Suite
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
+
+.. automodule:: tests.TestSuite_virtio_fwd
+=C2=A0 =C2=A0:members:
+=C2=A0 =C2=A0:show-inheritance:
\ No newline at end of file
diff --git a/dts/tests/TestSuite_virtio_fwd.py b/dts/tests/TestSuite_virtio= _fwd.py
new file mode 100644
index 0000000000..194bd24257
--- /dev/null
+++ b/dts/tests/TestSuite_virtio_fwd.py
@@ -0,0 +1,180 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2025 University of New Hampshire
+
+"""Virtio forwarding test suite.
+
+Verify vhost/virtio pvp and loopback topology functionalities.

Loopback doesn't seem quite right. Maybe you c= an just say pvp and fully virtual?
=C2=A0
+"""
+
+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
+
+
+@requires(topology_type=3DLinkTopology.TWO_LINKS)
two links is true for the pvp test, but the other two dont requ= ire any links, right?
=C2=A0
+class TestVirtioFwd(TestSuite):
+=C2=A0 =C2=A0 """Virtio forwarding test suite.""&= quot;
+
+=C2=A0 =C2=A0 class ForwardingParsers:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Class for gathering Rx/Tx pa= ckets from testpmd stats."""
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 rx_packets =3D TextParser.find_int(r"RX-p= ackets:\s*(\d+)")
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 tx_packets =3D TextParser.find_int(r"TX-p= ackets:\s*(\d+)")
+
+=C2=A0 =C2=A0 class vdevs:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Class containing virtio-user= and vhost-user virtual devices."""
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 virtio_user =3D VirtualDevice(
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "net_virtio_user0,mac=3D00:= 01:02:03:04:05,path=3D/tmp/vhost-net,server=3D1"
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 )
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 vhost_user =3D VirtualDevice("eth_vhost0,= iface=3D/tmp/vhost-net,client=3D1")

+1 to Luca's comment about not needing these to be internal classes.<= br>
=C2=A0
+
+=C2=A0 =C2=A0 @func_test
+=C2=A0 =C2=A0 def virtio_server(self) -> None:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Test virtio server packet tr= ansmission.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Steps:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Launch a testpmd session with = a vhost-user virtual device (client side).
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Launch a testpmd session with = a virtio-user virtual device (server side).
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Set the forwarding mode to mac= in both sessions.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Start packet forwarding on vho= st session.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Send a burst of packets from t= he virtio session.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Stop packet forwarding on vhos= t session and collect Rx packet stats.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Verify:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Vhost session receives packets= from virtio session.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 with (
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 TestPmd(
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 prefix=3D"vho= st",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 no_pci=3DTrue,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 memory_channels=3D= 4,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vdevs=3D[self.vdev= s.vhost_user],
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ) as vhost,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 TestPmd(
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 prefix=3D"vir= tio",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 no_pci=3DTrue,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 memory_channels=3D= 4,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vdevs=3D[self.vdev= s.virtio_user],
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ) as virtio,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 ):
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vhost.set_forward_mode(SimpleFor= wardingModes.mac)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 virtio.set_forward_mode(SimpleFo= rwardingModes.mac)
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vhost.start()
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 virtio.start_tx_first(burst_num= =3D32)
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 forwarding_stats =3D vhost.stop(= )
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rx_packets =3D self.ForwardingPa= rsers.rx_packets["TextParser_fn"](forwarding_stats) or 0
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 tx_packets =3D self.ForwardingPa= rsers.tx_packets["TextParser_fn"](forwarding_stats) or 0
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.verify(
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rx_packets !=3D 0 = and tx_packets !=3D 0,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "Vhost sessio= n failed to receive packets from virtio session.",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 )
+
+=C2=A0 =C2=A0 @func_test
+=C2=A0 =C2=A0 def virtio_server_reconnect(self) -> None:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Test virtio server reconnect= ion.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Steps:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Launch a testpmd session with = a vhost-user virtual device (client side).
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Launch a testpmd session with = a virtio-user virtual device (server side).
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Close the virtio session and r= elaunch it.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Start packet forwarding on vho= st session.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Send a burst of packets from t= he virtio session.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Stop packet forwarding on vhos= t session and collect Rx packet stats.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Verify:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Vhost session receives packets= from relaunched virtio session.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 with TestPmd(
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 prefix=3D"vhost",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 no_pci=3DTrue,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 memory_channels=3D4,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vdevs=3D[self.vdevs.vhost_user],=
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 ) as vhost:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 with TestPmd(
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 prefix=3D"vir= tio",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 no_pci=3DTrue,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 memory_channels=3D= 4,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vdevs=3D[self.vdev= s.virtio_user],
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ) as virtio:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pass
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # end session and reconnect
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 with TestPmd(
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 prefix=3D"vir= tio",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 no_pci=3DTrue,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 memory_channels=3D= 4,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vdevs=3D[self.vdev= s.virtio_user],
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ) as virtio:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 virtio.set_forward= _mode(SimpleForwardingModes.mac)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vhost.set_forward_= mode(SimpleForwardingModes.mac)
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vhost.start()
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 virtio.start_tx_fi= rst(burst_num=3D32)
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 forwarding_stats = =3D vhost.stop()
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rx_packets =3D ( +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self= .ForwardingParsers.rx_packets["TextParser_fn"](forwarding_stats) = or 0
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 )
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 tx_packets =3D ( +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self= .ForwardingParsers.tx_packets["TextParser_fn"](forwarding_stats) = or 0
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 )
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.verify(
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rx_p= ackets !=3D 0 and tx_packets !=3D 0,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &quo= t;Vhost session failed to receive packets from virtio session.",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 )
+
+=C2=A0 =C2=A0 @func_test
+=C2=A0 =C2=A0 def pvp_loop(self) -> None:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Test vhost/virtio physical-v= irtual-physical loop topology.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Steps:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Launch testpmd session with a = physical NIC and virtio-user vdev
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 connected to a vho= st-net socket.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Configure the tap interface th= at is created with IP address and
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 set link state to = UP.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Launch second testpmd session = with af_packet vdev connected to
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 the tap interface.=
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Start packet forwarding on bot= h testpmd sessions.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Send 100 packets to the physic= al interface from external tester.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Capture packets on the same ph= ysical interface.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Verify:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Physical interface receives al= l 100 sent packets.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.sut_node =3D self._ctx.sut_node
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 if not isinstance(self.sut_node.main_session, = LinuxSession):
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.verify(False, "Must be= running on a Linux environment.")
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 with TestPmd(
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 prefix=3D"virtio",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vdevs=3D[VirtualDevice("vir= tio_user0,path=3D/dev/vhost-net,queues=3D1,queue_size=3D1024")],
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 ) as virtio:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.sut_node.main_session.send_= command("ip link set dev tap0 up", privileged=3DTrue)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 with TestPmd(
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 prefix=3D"vho= st", no_pci=3DTrue, vdevs=3D[VirtualDevice("net_af_packet0,iface= =3Dtap0")]
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ) as vhost:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 virtio.set_forward= _mode(SimpleForwardingModes.mac)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vhost.set_forward_= mode(SimpleForwardingModes.mac)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vhost.start()
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 virtio.start()
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 packet =3D Ether()= / IP()
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 packets =3D [packe= t] * 100
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 captured_packets = =3D self.send_packets_and_capture(packets)
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.verify(
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 len(= captured_packets) >=3D 100, "Sent packets not received on physical = interface."
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 )
=

Can you remind me what docs you were working from for s= etting up the pvp test? I'm guessing how you've done it is valid, b= ut I originally thought we needed 2 tap interfaces and that vhost had to ru= n in --no-pci, not virtio. Better safe than sorry. :)
=C2=A0
--
2.51.0


Reviewed-by: Patrick Robb <probb@iol.unh.edu>=C2=A0
--000000000000566d320641d303bc--