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>
Subject: [PATCH bpf-next v2 00/10] seltests/xsk: prepare for AF_XDP multi-buffer testing
Date: Tue, 16 May 2023 12:30:59 +0200 [thread overview]
Message-ID: <20230516103109.3066-1-magnus.karlsson@gmail.com> (raw)
Prepare the AF_XDP selftests test framework code for the upcoming
multi-buffer support in AF_XDP. This so that the multi-buffer patch
set does not become way too large. In that upcoming patch set, we are
only including the multi-buffer tests together with any framework
code that depends on the new options bit introduced in the AF_XDP
multi-buffer implementation itself.
Currently, the test framework is based on the premise that a packet
consists of a single fragment and thus occupies a single buffer and a
single descriptor. Multi-buffer breaks this assumption, as that is the
whole purpose of it. Now, a packet can consist of multiple buffers and
therefore consume multiple descriptors.
The patch set starts with some clean-ups and simplifications followed
by patches that make sure that the current code works even when a
packet occupies multiple buffers. The actual code for sending and
receiving multi-buffer packets will be included in the AF_XDP
multi-buffer patch set as it depends on a new bit being used in the
options field of the descriptor.
Patch set anatomy:
1: The XDP program was unnecessarily changed many times. Fixes this.
2: There is no reason to generate a full UDP/IPv4 packet as it is
never used. Simplify the code by just generating a valid Ethernet
frame.
3: Introduce a more complicated payload pattern that can detect
fragments out of bounds in a multi-buffer packet and other errors
found in single-fragment packets.
4: As a convenience, dump the content of the faulty packet at error.
5: To simplify the code, make the usage of the packet stream for Tx
and Rx more similar.
6: Store the offset of the packet in the buffer in the struct pkt
definition instead of the address in the umem itself and introduce
a simple buffer allocator. The address only made sense when all
packets consumed a single buffer. Now, we do not know beforehand
how many buffers a packet will consume, so we instead just allocate
a buffer from the allocator and specify the offset within that
buffer.
7: Test for huge pages only once instead of before each test that needs it.
8: Populate the fill ring based on how many frags are needed for each
packet.
9: Change the data generation code so it can generate data for
multi-buffer packets too.
10: Adjust the packet pacing algorithm so that it can cope with
multi-buffer packets. The pacing algorithm is present so that Tx
does not send too many packets/frames to Rx that it starts to drop
packets. That would ruin the tests.
v1 -> v2:
* Fixed spelling error in patch #6 [Simon]
* Fixed compilation error with llvm in patch #7 [Daniel]
Thanks: Magnus
Magnus Karlsson (10):
selftests/xsk: do not change XDP program when not necessary
selftests/xsk: generate simpler packets with variable length
selftests/xsk: add varying payload pattern within packet
selftests/xsk: dump packet at error
selftests/xsk: add packet iterator for tx to packet stream
selftests/xsk: store offset in pkt instead of addr
selftests/xsx: test for huge pages only once
selftests/xsk: populate fill ring based on frags needed
selftests/xsk: generate data for multi-buffer packets
selftests/xsk: adjust packet pacing for multi-buffer support
tools/testing/selftests/bpf/test_xsk.sh | 10 +-
tools/testing/selftests/bpf/xsk.h | 5 +
tools/testing/selftests/bpf/xskxceiver.c | 771 +++++++++++------------
tools/testing/selftests/bpf/xskxceiver.h | 31 +-
4 files changed, 379 insertions(+), 438 deletions(-)
base-commit: 108598c39eefbedc9882273ac0df96127a629220
--
2.34.1
next reply other threads:[~2023-05-16 10:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-16 10:30 Magnus Karlsson [this message]
2023-05-16 10:31 ` [PATCH bpf-next v2 01/10] selftests/xsk: do not change XDP program when not necessary Magnus Karlsson
2023-05-16 10:31 ` [PATCH bpf-next v2 02/10] selftests/xsk: generate simpler packets with variable length Magnus Karlsson
2023-05-16 10:31 ` [PATCH bpf-next v2 03/10] selftests/xsk: add varying payload pattern within packet Magnus Karlsson
2023-05-16 10:31 ` [PATCH bpf-next v2 04/10] selftests/xsk: dump packet at error Magnus Karlsson
2023-05-16 10:31 ` [PATCH bpf-next v2 05/10] selftests/xsk: add packet iterator for tx to packet stream Magnus Karlsson
2023-05-16 10:31 ` [PATCH bpf-next v2 06/10] selftests/xsk: store offset in pkt instead of addr Magnus Karlsson
2023-05-16 10:31 ` [PATCH bpf-next v2 07/10] selftests/xsx: test for huge pages only once Magnus Karlsson
2023-05-16 12:58 ` Maciej Fijalkowski
2023-05-16 13:06 ` Maciej Fijalkowski
2023-05-16 14:26 ` Magnus Karlsson
2023-05-16 14:25 ` Magnus Karlsson
2023-05-16 14:40 ` Maciej Fijalkowski
2023-05-16 10:31 ` [PATCH bpf-next v2 08/10] selftests/xsk: populate fill ring based on frags needed Magnus Karlsson
2023-05-16 10:31 ` [PATCH bpf-next v2 09/10] selftests/xsk: generate data for multi-buffer packets Magnus Karlsson
2023-05-16 10:31 ` [PATCH bpf-next v2 10/10] selftests/xsk: adjust packet pacing for multi-buffer support Magnus Karlsson
2023-05-17 5:40 ` [PATCH bpf-next v2 00/10] seltests/xsk: prepare for AF_XDP multi-buffer testing patchwork-bot+netdevbpf
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=20230516103109.3066-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=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).