netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jiri Pirko <jiri@resnulli.us>
Cc: netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com,
	davem@davemloft.net, edumazet@google.com, parav@nvidia.com,
	jasowang@redhat.com, xuanzhuo@linux.alibaba.com,
	shuah@kernel.org, petrm@nvidia.com, liuhangbin@gmail.com,
	vladimir.oltean@nxp.com, bpoirier@nvidia.com, idosch@nvidia.com,
	virtualization@lists.linux.dev
Subject: Re: [patch net-next v4 0/6] selftests: virtio_net: introduce initial testing infrastructure
Date: Mon, 22 Apr 2024 17:04:14 -0400	[thread overview]
Message-ID: <20240422170405-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20240418160830.3751846-1-jiri@resnulli.us>

On Thu, Apr 18, 2024 at 06:08:24PM +0200, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@nvidia.com>
> 
> This patchset aims at introducing very basic initial infrastructure
> for virtio_net testing, namely it focuses on virtio feature testing.
> 
> The first patch adds support for debugfs for virtio devices, allowing
> user to filter features to pretend to be driver that is not capable
> of the filtered feature.


virtio things:

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> Example:
> $ cat /sys/bus/virtio/devices/virtio0/features
> 1110010111111111111101010000110010000000100000000000000000000000
> $ echo "5" >/sys/kernel/debug/virtio/virtio0/filter_feature_add
> $ cat /sys/kernel/debug/virtio/virtio0/filter_features
> 5
> $ echo "virtio0" > /sys/bus/virtio/drivers/virtio_net/unbind
> $ echo "virtio0" > /sys/bus/virtio/drivers/virtio_net/bind
> $ cat /sys/bus/virtio/devices/virtio0/features
> 1110000111111111111101010000110010000000100000000000000000000000
> 
> Leverage that in the last patch that lays ground for virtio_net
> selftests testing, including very basic F_MAC feature test.
> 
> To run this, do:
> $ make -C tools/testing/selftests/ TARGETS=drivers/net/virtio_net/ run_tests
> 
> It is assumed, as with lot of other selftests in the net group,
> that there are netdevices connected back-to-back. In this case,
> two virtio_net devices connected back to back. If you use "tap" qemu
> netdevice type, to configure this loop on a hypervisor, one may use
> this script:
> #!/bin/bash
> 
> DEV1="$1"
> DEV2="$2"
> 
> sudo tc qdisc add dev $DEV1 clsact
> sudo tc qdisc add dev $DEV2 clsact
> sudo tc filter add dev $DEV1 ingress protocol all pref 1 matchall action mirred egress redirect dev $DEV2
> sudo tc filter add dev $DEV2 ingress protocol all pref 1 matchall action mirred egress redirect dev $DEV1
> sudo ip link set $DEV1 up
> sudo ip link set $DEV2 up
> 
> Another possibility is to use virtme-ng like this:
> $ vng --network=loop
> or directly:
> $ vng --network=loop -- make -C tools/testing/selftests/ TARGETS=drivers/net/virtio_net/ run_tests
> 
> "loop" network type will take care of creating two "hubport" qemu netdevs
> putting them into a single hub.
> 
> To do it manually with qemu, pass following command line options:
> -nic hubport,hubid=1,id=nd0,model=virtio-net-pci
> -nic hubport,hubid=1,id=nd1,model=virtio-net-pci
> 
> ---
> v3->v4:
> - addressed comments from Petr and Benjamin, more or less cosmetical
>   issues. See individual patches changelog for details.
> - extended cover letter by vng usage
> v2->v3:
> - added forgotten kdoc entry in patch #1.
> v1->v2:
> - addressed comments from Jakub and Benjamin, see individual
>   patches #3, #5 and #6 for details.
> 
> Jiri Pirko (6):
>   virtio: add debugfs infrastructure to allow to debug virtio features
>   selftests: forwarding: move initial root check to the beginning
>   selftests: forwarding: add ability to assemble NETIFS array by driver
>     name
>   selftests: forwarding: add check_driver() helper
>   selftests: forwarding: add wait_for_dev() helper
>   selftests: virtio_net: add initial tests
> 
>  MAINTAINERS                                   |   1 +
>  drivers/virtio/Kconfig                        |   9 ++
>  drivers/virtio/Makefile                       |   1 +
>  drivers/virtio/virtio.c                       |   8 ++
>  drivers/virtio/virtio_debug.c                 | 109 +++++++++++++++
>  include/linux/virtio.h                        |  35 +++++
>  tools/testing/selftests/Makefile              |   1 +
>  .../selftests/drivers/net/virtio_net/Makefile |  15 ++
>  .../drivers/net/virtio_net/basic_features.sh  | 131 ++++++++++++++++++
>  .../selftests/drivers/net/virtio_net/config   |   2 +
>  .../net/virtio_net/virtio_net_common.sh       |  99 +++++++++++++
>  tools/testing/selftests/net/forwarding/lib.sh |  70 +++++++++-
>  12 files changed, 477 insertions(+), 4 deletions(-)
>  create mode 100644 drivers/virtio/virtio_debug.c
>  create mode 100644 tools/testing/selftests/drivers/net/virtio_net/Makefile
>  create mode 100755 tools/testing/selftests/drivers/net/virtio_net/basic_features.sh
>  create mode 100644 tools/testing/selftests/drivers/net/virtio_net/config
>  create mode 100644 tools/testing/selftests/drivers/net/virtio_net/virtio_net_common.sh
> 
> -- 
> 2.44.0


      parent reply	other threads:[~2024-04-22 21:04 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-18 16:08 [patch net-next v4 0/6] selftests: virtio_net: introduce initial testing infrastructure Jiri Pirko
2024-04-18 16:08 ` [patch net-next v4 1/6] virtio: add debugfs infrastructure to allow to debug virtio features Jiri Pirko
2024-04-19 23:52   ` kernel test robot
2024-04-18 16:08 ` [patch net-next v4 2/6] selftests: forwarding: move initial root check to the beginning Jiri Pirko
2024-04-18 16:56   ` Petr Machata
2024-04-18 18:48   ` Benjamin Poirier
2024-04-19 13:51     ` Jiri Pirko
2024-04-18 16:08 ` [patch net-next v4 3/6] selftests: forwarding: add ability to assemble NETIFS array by driver name Jiri Pirko
2024-04-18 16:58   ` Petr Machata
2024-04-18 16:08 ` [patch net-next v4 4/6] selftests: forwarding: add check_driver() helper Jiri Pirko
2024-04-18 16:08 ` [patch net-next v4 5/6] selftests: forwarding: add wait_for_dev() helper Jiri Pirko
2024-04-18 16:59   ` Petr Machata
2024-04-18 16:08 ` [patch net-next v4 6/6] selftests: virtio_net: add initial tests Jiri Pirko
2024-04-18 17:01   ` Petr Machata
2024-04-22 15:32 ` [patch net-next v5 0/5] selftests: virtio_net: introduce initial testing infrastructure Jiri Pirko
2024-04-22 15:32 ` [patch net-next v5 1/5] virtio: add debugfs infrastructure to allow to debug virtio features Jiri Pirko
2024-04-22 15:32 ` [patch net-next v5 2/5] selftests: forwarding: add ability to assemble NETIFS array by driver name Jiri Pirko
2024-04-22 15:32 ` [patch net-next v5 3/5] selftests: forwarding: add check_driver() helper Jiri Pirko
2024-04-22 18:47   ` Benjamin Poirier
2024-04-23 10:59     ` Jiri Pirko
2024-04-22 15:32 ` [patch net-next v5 4/5] selftests: forwarding: add wait_for_dev() helper Jiri Pirko
2024-04-22 15:33 ` [patch net-next v5 5/5] selftests: virtio_net: add initial tests Jiri Pirko
2024-04-22 21:04 ` Michael S. Tsirkin [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=20240422170405-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=bpoirier@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@nvidia.com \
    --cc=jasowang@redhat.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=liuhangbin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=parav@nvidia.com \
    --cc=petrm@nvidia.com \
    --cc=shuah@kernel.org \
    --cc=virtualization@lists.linux.dev \
    --cc=vladimir.oltean@nxp.com \
    --cc=xuanzhuo@linux.alibaba.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).