From: Magnus Karlsson <magnus.karlsson@gmail.com>
To: magnus.karlsson@intel.com, bjorn@kernel.org, ast@kernel.org,
daniel@iogearbox.net, netdev@vger.kernel.org,
maciej.fijalkowski@intel.com, bpf@vger.kernel.org, yhs@fb.com,
andrii@kernel.org, martin.lau@linux.dev, song@kernel.org,
john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com,
haoluo@google.com, jolsa@kernel.org, tirthendu.sarkar@intel.com
Cc: Magnus Karlsson <magnus.karlsson@gmail.com>, jonathan.lemon@gmail.com
Subject: [PATCH bpf-next v2 00/15] selftests/xsk: speed-ups, fixes, and new XDP programs
Date: Wed, 4 Jan 2023 13:17:29 +0100 [thread overview]
Message-ID: <20230104121744.2820-1-magnus.karlsson@gmail.com> (raw)
This is a patch set of various performance improvements, fixes and the
introduction of more than one XDP program to the xsk selftests
framework so we can test more things in the future such as upcoming
multi-buffer and metadata support for AF_XDP. The new programs just
reuses the framework that all the other eBPF selftests use. The new
feature is used to implement one new test that does XDP_DROP on every
other packet. More tests using this will be added in future commits.
Contents:
* The run-time of the test suite is cut by 10x when executing the
tests on a real NIC, by only attaching the XDP program once per mode
tested, instead of once per test program.
* Over 700 lines of code have been removed. The xsk.c control file was
moved straight over from libbpf when the xsk support was deprecated
there. As it is now not used as library code that has to work with
all kinds of versions of Linux, a lot of code could be dropped or
simplified.
* Add a new command line option "-d" that can be used when a test
fails and you want to debug it with gdb or some other debugger. The
option creates the two veth netdevs and prints them to the screen
without deleting them afterwards. This way these veth netdevs can be
used when running xskxceiver in a debugger.
* Implemented the possibility to load external XDP programs so we can
have more than the default one. This feature is used to implement a
test where every other packet is dropped. Good exercise for the
recycling mechanism of the xsk buffer pool used in zero-copy mode.
* Various clean-ups and small fixes in patches 1 to 5. None of these
fixes has any impact on the correct execution of the tests when they
pass, though they can be irritating when a test fails. IMHO, they do
not need to go to bpf as they will not fix anything there. The first
version of patches 1, 2, and 4 where previously sent to bpf, but has
now been included here.
v1 -> v2:
* Fixed spelling error in commit message of patch #6 [Björn]
* Added explanation on why it is safe to use C11 atomics in patch #7
[Daniel]
* Put all XDP programs in the same file so that adding more XDP
programs to xskxceiver.c becomes more scalable in patches #11 and
#12 [Maciej]
* Removed more dead code in patch #8 [Maciej]
* Removed stale %s specifier in error print, patch #9 [Maciej]
* Changed name of XDP_CONSUMES_SOME_PACKETS to XDP_DROP_HALF to
hopefully make it clearer [Maciej]
* ifobj_rx and ifobj_tx name changes in patch #13 [Maciej]
* Simplified XDP attachment code in patch #15 [Maciej]
Patches:
1-5: Small fixes and clean-ups
6: New convenient debug option when using a debugger such as gdb
7-8: Removal of unnecessary code
9: Add the ability to load external XDP programs
10-11: Removal of more unnecessary code
12: Implement a new test where every other packet is XDP_DROP:ed
13: Unify the thread dispatching code
14-15: Simplify the way tests are written when using custom packet_streams
or custom XDP programs
Thanks: Magnus
Magnus Karlsson (15):
selftests/xsk: print correct payload for packet dump
selftests/xsk: do not close unused file descriptors
selftests/xsk: submit correct number of frames in populate_fill_ring
selftests/xsk: print correct error codes when exiting
selftests/xsk: remove unused variable outstanding_tx
selftests/xsk: add debug option for creating netdevs
selftests/xsk: replace asm acquire/release implementations
selftests/xsk: remove namespaces
selftests/xsk: load and attach XDP program only once per mode
selftests/xsk: remove unnecessary code in control path
selftests/xsk: get rid of built-in XDP program
selftests/xsk: add test when some packets are XDP_DROPed
selftests/xsk: merge dual and single thread dispatchers
selftests/xsk: automatically restore packet stream
selftests/xsk: automatically switch XDP programs
tools/testing/selftests/bpf/Makefile | 2 +-
.../selftests/bpf/progs/xsk_xdp_progs.c | 30 +
tools/testing/selftests/bpf/test_xsk.sh | 42 +-
tools/testing/selftests/bpf/xsk.c | 674 +-----------------
tools/testing/selftests/bpf/xsk.h | 97 +--
tools/testing/selftests/bpf/xsk_prereqs.sh | 12 +-
tools/testing/selftests/bpf/xskxceiver.c | 382 +++++-----
tools/testing/selftests/bpf/xskxceiver.h | 17 +-
8 files changed, 308 insertions(+), 948 deletions(-)
create mode 100644 tools/testing/selftests/bpf/progs/xsk_xdp_progs.c
base-commit: bb5747cfbc4b7fe29621ca6cd4a695d2723bf2e8
--
2.34.1
next reply other threads:[~2023-01-04 12:18 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-04 12:17 Magnus Karlsson [this message]
2023-01-04 12:17 ` [PATCH bpf-next v2 01/15] selftests/xsk: print correct payload for packet dump Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 02/15] selftests/xsk: do not close unused file descriptors Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 03/15] selftests/xsk: submit correct number of frames in populate_fill_ring Magnus Karlsson
2023-01-09 23:01 ` Maciej Fijalkowski
2023-01-04 12:17 ` [PATCH bpf-next v2 04/15] selftests/xsk: print correct error codes when exiting Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 05/15] selftests/xsk: remove unused variable outstanding_tx Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 06/15] selftests/xsk: add debug option for creating netdevs Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 07/15] selftests/xsk: replace asm acquire/release implementations Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 08/15] selftests/xsk: remove namespaces Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 09/15] selftests/xsk: load and attach XDP program only once per mode Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 10/15] selftests/xsk: remove unnecessary code in control path Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 11/15] selftests/xsk: get rid of built-in XDP program Magnus Karlsson
2023-01-04 18:14 ` David Vernet
2023-01-04 18:19 ` Stanislav Fomichev
2023-01-04 19:13 ` David Vernet
2023-01-04 19:46 ` Stanislav Fomichev
2023-01-05 8:38 ` Magnus Karlsson
2023-01-04 23:15 ` Andrii Nakryiko
2023-01-04 23:44 ` Stanislav Fomichev
2023-01-11 19:20 ` Andrii Nakryiko
2023-01-04 12:17 ` [PATCH bpf-next v2 12/15] selftests/xsk: add test when some packets are XDP_DROPed Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 13/15] selftests/xsk: merge dual and single thread dispatchers Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 14/15] selftests/xsk: automatically restore packet stream Magnus Karlsson
2023-01-04 12:17 ` [PATCH bpf-next v2 15/15] selftests/xsk: automatically switch XDP programs Magnus Karlsson
2023-01-10 11:56 ` Maciej Fijalkowski
2023-01-10 12:08 ` Magnus Karlsson
2023-01-10 12:00 ` [PATCH bpf-next v2 00/15] selftests/xsk: speed-ups, fixes, and new " Maciej Fijalkowski
2023-01-10 12:10 ` Magnus Karlsson
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=20230104121744.2820-1-magnus.karlsson@gmail.com \
--to=magnus.karlsson@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=jonathan.lemon@gmail.com \
--cc=kpsingh@kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=martin.lau@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=tirthendu.sarkar@intel.com \
--cc=yhs@fb.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).