netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next 0/6] selftests: virtio_net: introduce initial testing infrastructure
@ 2024-04-12 15:13 Jiri Pirko
  2024-04-12 15:13 ` [patch net-next 1/6] virtio: add debugfs infrastructure to allow to debug virtio features Jiri Pirko
                   ` (6 more replies)
  0 siblings, 7 replies; 21+ messages in thread
From: Jiri Pirko @ 2024-04-12 15:13 UTC (permalink / raw)
  To: netdev
  Cc: kuba, pabeni, davem, edumazet, parav, mst, jasowang, xuanzhuo,
	shuah, petrm, liuhangbin, vladimir.oltean, bpoirier, idosch,
	virtualization

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.

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. 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

Jiri Pirko (6):
  virtio: add debugfs infrastructure to allow to debug virtio features
  selftests: forwarding: move couple of initial 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

 drivers/virtio/Kconfig                        |   9 ++
 drivers/virtio/Makefile                       |   1 +
 drivers/virtio/virtio.c                       |   8 ++
 drivers/virtio/virtio_debug.c                 | 109 +++++++++++++++
 include/linux/virtio.h                        |  34 +++++
 tools/testing/selftests/Makefile              |   1 +
 .../selftests/drivers/net/virtio_net/Makefile |   5 +
 .../drivers/net/virtio_net/basic_features.sh  | 127 ++++++++++++++++++
 .../net/virtio_net/virtio_net_common.sh       |  99 ++++++++++++++
 tools/testing/selftests/net/forwarding/lib.sh |  88 ++++++++++--
 10 files changed, 472 insertions(+), 9 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/virtio_net_common.sh

-- 
2.44.0


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-04-17  4:36 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-12 15:13 [patch net-next 0/6] selftests: virtio_net: introduce initial testing infrastructure Jiri Pirko
2024-04-12 15:13 ` [patch net-next 1/6] virtio: add debugfs infrastructure to allow to debug virtio features Jiri Pirko
2024-04-12 15:13 ` [patch net-next 2/6] selftests: forwarding: move couple of initial check to the beginning Jiri Pirko
2024-04-12 15:13 ` [patch net-next 3/6] selftests: forwarding: add ability to assemble NETIFS array by driver name Jiri Pirko
2024-04-12 20:38   ` Benjamin Poirier
2024-04-13 13:27     ` Jiri Pirko
2024-04-14 19:32       ` Benjamin Poirier
2024-04-15  8:40         ` Jiri Pirko
2024-04-12 15:13 ` [patch net-next 4/6] selftests: forwarding: add check_driver() helper Jiri Pirko
2024-04-12 15:13 ` [patch net-next 5/6] selftests: forwarding: add wait_for_dev() helper Jiri Pirko
2024-04-12 20:43   ` Benjamin Poirier
2024-04-13 13:29     ` Jiri Pirko
2024-04-12 15:13 ` [patch net-next 6/6] selftests: virtio_net: add initial tests Jiri Pirko
2024-04-12 20:46   ` Benjamin Poirier
2024-04-13 13:29     ` Jiri Pirko
2024-04-13  1:04 ` [patch net-next 0/6] selftests: virtio_net: introduce initial testing infrastructure Jakub Kicinski
2024-04-13 13:23   ` Jiri Pirko
2024-04-15 17:26     ` Jakub Kicinski
2024-04-16  9:53       ` Jiri Pirko
2024-04-16 13:03         ` Jiri Pirko
2024-04-17  4:36           ` Jason Wang

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).