From: "Björn Töpel" <bjorn@kernel.org>
To: Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
netdev@vger.kernel.org
Cc: bpf@vger.kernel.org, magnus.karlsson@intel.com,
stfomichev@gmail.com, kuba@kernel.org, pabeni@redhat.com,
tushar.vyavahare@intel.com, kerneljasonxing@gmail.com,
Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Subject: Re: [PATCH v3 net-next 14/15] selftests: drv-net: test AF_XDP zero-copy with an SKB peer
Date: Thu, 15 Oct 2026 12:29:30 +0200 [thread overview]
Message-ID: <87jynj5kad.fsf@all.your.base.are.belong.to.us> (raw)
In-Reply-To: <20261014184539.774708-15-maciej.fijalkowski@intel.com>
Maciej Fijalkowski <maciej.fijalkowski@intel.com> writes:
> Run the AF_XDP cases that a physical link can carry as pairs of
> xskxceiver processes: a zero-copy endpoint on the DUT and an SKB-mode
> endpoint on the remote, which needs no zero-copy support. xsk.py runs
> the cases that xskxceiver -L lists, in the DUT directions listed with
> them, as KTAP variants named <rx|tx>_<CASE>. test_xsk runs them with
> the DUT socket driven by interrupts and test_xsk_busy_poll with it busy
> polling, after xsk_setup_busy_poll() sets napi_defer_hard_irqs and
> gro_flush_timeout on the DUT so that SO_PREFER_BUSY_POLL keeps its IRQs
> masked, as on veth.
>
> main() sets up what the cases share once and undoes it after them, as
> defer() works only within a case, so xsk.py rejects -l and -h, on which
> ksft_run() exits without returning:
>
> - the DUT endpoint binds the last queue with both an RX and a TX ring,
> which is taken out of RSS with ethtool -X equal and handed back with
> ethtool -X default; a TX endpoint fills no RX buffers, so in
> zero-copy mode its queue drops what it receives and TX cases need the
> queue out of RSS as much as RX cases do. A DUT with fewer than two
> such queues skips
> - an ntuple rule on each host steers the test UDP flow to the receiving
> endpoint: the DUT queue in RX cases and queue 0 of the remote, where
> its endpoint binds, in TX cases. A host without ntuple support skips.
> Setting the rules once spares each TX case the ssh round trips of a
> remote rule and toggles ntuple-filters, which resets some NICs, once
> per run rather than per case
> - huge pages are reserved on both hosts, and the UNALIGNED cases are
> left out without them
> - both endpoints get the DUT's xdp-zc-max-segs for TOO_MANY_FRAGS,
> which is left out without multi-buffer zero-copy
>
> A DUT that does not advertise AF_XDP zero-copy skips the run.
>
> The remote endpoint listens on REMOTE_V4, and the DUT endpoint connects
> once the remote says on stderr that it listens. The control connection
> shares the tested link, where the XDP programs pass it to the stack.
> Killing an ssh client does not stop the command it runs, so timeout(1)
> bounds the remote endpoint, and the runner waits for it to exit before
> the case ends. The endpoints are waited for with the test_xsk.py
> helpers, so the output of one that does not pass is logged, timeouts
> included.
>
> The endpoints detach their XDP programs and restore the MTU and ring
> sizes when they exit; the runner detaches the programs and restores the
> MTU only after one fails or is killed. Each endpoint sees only its own
> device and mode, so one may skip a case that the other runs and then
> fails once its peer is gone; such a case is reported as skipped.
>
> xsk.py runs the xskxceiver that net/lib builds, which drv-net already
> installs, and copies it to the remote with cfg.remote.deploy(). Add
> xsk.py to TEST_PROGS and to the AF_XDP entry in MAINTAINERS,
> CONFIG_XDP_SOCKETS to the drivers/net/hw config, and the xskxceiver
> helpers to the drivers/net/hw library exports.
>
> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
I just skimmed this, and it seems like it needs some scrutiny on the
cleanup side. The LLM flagged a few cleanup issues. Could you check
these paths?
| main() only restores shared state on the normal path. Exceptions
| during setup can leave RSS, steering rules or hugepage reservations
| changed. Would a run-scoped ExitStack help here?
|
| _steer_udp() enables ntuple filtering before recording its original
| state. If rule insertion fails, that change isn't tracked.
|
| _unsteer_udp() stops on the first error, leaving subsequent cleanup
| undone.
|
| _run() waits for the remote in finally, but doesn't ensure the local
| endpoint is stopped/reaped if its wait is interrupted.
|
| The fallback cleanup restores XDP/MTU, but not ring sizes after an
| endpoint is killed.
|
| "-X default" resets RSS rather than restoring the original table.
|
| An unconditional SKIP when either endpoint skips can hide a genuine
| failure on the other endpoint, including a crash or cleanup failure.
The defer ordering itself looks sensible: detach XDP before restoring
the MTU.
Björn
next prev parent reply other threads:[~2026-10-15 10:29 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 18:45 [PATCH v3 net-next 00/15] selftests: net: migrate AF_XDP test suite over to net Maciej Fijalkowski
2026-10-14 18:45 ` [PATCH v3 net-next 01/15] selftests: xsk: factor endpoint work out of pthread wrappers Maciej Fijalkowski
2026-10-15 8:14 ` Björn Töpel
2026-10-14 18:45 ` [PATCH v3 net-next 02/15] selftests: xsk: size the TX UMEM in HW_SW_MAX_RING_SIZE Maciej Fijalkowski
2026-10-15 8:15 ` Björn Töpel
2026-10-14 18:45 ` [PATCH v3 net-next 03/15] selftests: xsk: drop the single-interface loopback mode Maciej Fijalkowski
2026-10-15 8:17 ` Björn Töpel
2026-10-14 18:45 ` [PATCH v3 net-next 04/15] selftests/bpf: drop the test_progs AF_XDP wrapper Maciej Fijalkowski
2026-10-15 8:18 ` Björn Töpel
2026-10-14 18:45 ` [PATCH v3 net-next 05/15] selftests: net: add a generic rule for BPF skeletons Maciej Fijalkowski
2026-10-15 8:20 ` Björn Töpel
2026-10-14 18:45 ` [PATCH v3 net-next 06/15] selftests: xsk: move the AF_XDP test suite to selftests/net Maciej Fijalkowski
2026-10-15 8:22 ` Björn Töpel
2026-10-14 18:45 ` [PATCH v3 net-next 07/15] selftests: xsk: collect interface capabilities in struct xsk_caps Maciej Fijalkowski
2026-10-15 8:27 ` Björn Töpel
2026-10-14 18:45 ` [PATCH v3 net-next 08/15] selftests: xsk: split xskxceiver main() into setup, run and cleanup Maciej Fijalkowski
2026-10-15 8:29 ` Björn Töpel
2026-10-14 18:45 ` [PATCH v3 net-next 09/15] selftests: xsk: run one test case per xskxceiver invocation Maciej Fijalkowski
2026-10-15 8:34 ` Björn Töpel
2026-10-14 18:45 ` [PATCH v3 net-next 10/15] selftests: xsk: run the RX and TX endpoints in separate processes Maciej Fijalkowski
2026-10-15 9:04 ` Björn Töpel
2026-10-14 18:45 ` [PATCH v3 net-next 11/15] selftests: xsk: add a hardware mode to xskxceiver Maciej Fijalkowski
2026-10-15 9:42 ` Björn Töpel
2026-10-14 18:45 ` [PATCH v3 net-next 12/15] selftests: xsk: pass non-test traffic to the stack in hardware mode Maciej Fijalkowski
2026-10-15 10:05 ` Björn Töpel
2026-10-14 18:45 ` [PATCH v3 net-next 13/15] selftests: xsk: list the hardware test cases Maciej Fijalkowski
2026-10-14 18:45 ` [PATCH v3 net-next 14/15] selftests: drv-net: test AF_XDP zero-copy with an SKB peer Maciej Fijalkowski
2026-10-15 10:29 ` Björn Töpel [this message]
2026-10-14 18:45 ` [PATCH v3 net-next 15/15] selftests: xsk: document generic and hardware endpoint runs Maciej Fijalkowski
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=87jynj5kad.fsf@all.your.base.are.belong.to.us \
--to=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=kerneljasonxing@gmail.com \
--cc=kuba@kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stfomichev@gmail.com \
--cc=tushar.vyavahare@intel.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