From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Antonio Quartulli <antonio@mandelbit.com>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
jasowangio@gmail.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org, mst@redhat.com, eperezma@redhat.com,
shuah@kernel.org, ast@kernel.org, daniel@iogearbox.net,
hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me,
maheshb@google.com, peterpenkov96@gmail.com,
netdev@vger.kernel.org, virtualization@lists.linux.dev,
linux-kselftest@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH net v5 2/2] selftests: net: add a vhost-net test for the tun NAPI queue bound
Date: Fri, 13 Nov 2026 10:07:44 -0500 [thread overview]
Message-ID: <willemdebruijn.kernel.14b320acee076@gmail.com> (raw)
In-Reply-To: <73aa2f53-e2ba-42b7-9712-06e223459144@mandelbit.com>
Antonio Quartulli wrote:
> On 13/11/2026 00:34, Willem de Bruijn wrote:
> > Antonio Quartulli wrote:
> >> Send 16k packets from vhost-net into a tap device with IFF_NAPI and
> >> netdev_max_backlog set to 8, in the three ways vhost-net passes packets
> >> to tun: batches of XDP buffers, one packet per sendmsg() with MSG_MORE,
> >> and zerocopy buffers. Check that excess packets are dropped and counted,
> >> that the queue keeps draining while vhost-net keeps sending, that every
> >> packet is either delivered or dropped, and that every buffer comes back
> >> to the ring. If a dropped zerocopy buffer is never completed, the test
> >> fails, and closing vhost-net then blocks until the buffer is released.
> >>
> >> The zerocopy variant needs vhost_net loaded with experimental_zcopytx
> >> set and is skipped otherwise; with it, vhost-net does not batch and the
> >> batch variant is skipped instead.
> >
> > That means it will be skipped as part of kselftests.
> >
> > And as a misc device all tests may be skipped in minimal environments
> > if vhost-net is not autoloaded.
> >
> > Maybe a .sh wrapper could resolve both.
>
> Right. With a wrapper script we should be able to deal with these.
>
> >
> >> The test drives a minimal split virtqueue itself, in little-endian as
> >> VIRTIO_F_VERSION_1 requires. It needs root and CONFIG_VHOST_NET.
> >> netdev_max_backlog is global: the test lowers it only once setup has
> >> succeeded and restores it first in teardown, and should not run in
> >> parallel with other tests.
> >>
> >> Written and tested with the help of an AI coding assistant (Claude
> >> Code).
> >>
> >> Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
> >> ---
> >> tools/testing/selftests/net/.gitignore | 1 +
> >> tools/testing/selftests/net/Makefile | 1 +
> >> tools/testing/selftests/net/config | 1 +
> >> tools/testing/selftests/net/tun_vhost.c | 409 ++++++++++++++++++++++++
> >> 4 files changed, 412 insertions(+)
> >> create mode 100644 tools/testing/selftests/net/tun_vhost.c
> >
> > That's a lot of code for a fairly narrow test.
> >
> > Not that long ago I would have applauded all test coverage we can get.
> > But now that LLMs generate them instantly, not sure where to draw the
> > line.
>
> Well, the test has already done its job because it immediately helped me
> fix some small itches in patch 1.
>
> This said, I can definitely shrink this test a bit, maybe around 50% of
> the current code. But it'll still be quite some code for a small fix.
>
> Should I just drop this patch?
>
> Alternatively, I drop it from this series and I send the shrunk-down
> version with the wrapper script to net-next later on.
>
>
> Opinions?
If you could compress it to about 50%, let's merge.
Maybe we can use it over time for more coverage in this area.
next prev parent reply other threads:[~2026-11-13 15:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 1:42 [PATCH net v5 0/2] tun: bound the NAPI receive queue Antonio Quartulli
2026-11-11 1:42 ` [PATCH net v5 1/2] " Antonio Quartulli
2026-11-12 23:28 ` Willem de Bruijn
2026-11-13 0:29 ` Antonio Quartulli
2026-11-11 1:42 ` [PATCH net v5 2/2] selftests: net: add a vhost-net test for the tun NAPI queue bound Antonio Quartulli
2026-11-12 23:34 ` Willem de Bruijn
2026-11-13 0:33 ` Antonio Quartulli
2026-11-13 15:07 ` Willem de Bruijn [this message]
2026-11-13 15:19 ` Antonio Quartulli
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=willemdebruijn.kernel.14b320acee076@gmail.com \
--to=willemdebruijn.kernel@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=antonio@mandelbit.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=eperezma@redhat.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=jasowangio@gmail.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=maheshb@google.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peterpenkov96@gmail.com \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=virtualization@lists.linux.dev \
/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