Thread (9 messages) flat view 9 messages, 2 authors, 2022-03-09

Re: [PATCH bpf-next v10 0/5] Add support for transmitting packets using XDP in bpf_prog_run()

From: Martin KaFai Lau <hidden>
Date: 2022-03-09 06:13:21
Also in: bpf

On Tue, Mar 08, 2022 at 03:57:56PM +0100, Toke Høiland-Jørgensen wrote:
This series adds support for transmitting packets using XDP in
bpf_prog_run(), by enabling a new mode "live packet" mode which will handle
the XDP program return codes and redirect the packets to the stack or other
devices.

The primary use case for this is testing the redirect map types and the
ndo_xdp_xmit driver operation without an external traffic generator. But it
turns out to also be useful for creating a programmable traffic generator
in XDP, as well as injecting frames into the stack. A sample traffic
generator, which was included in previous versions of the series, but now
moved to xdp-tools, transmits up to 9 Mpps/core on my test machine.

To transmit the frames, the new mode instantiates a page_pool structure in
bpf_prog_run() and initialises the pages to contain XDP frames with the
data passed in by userspace. These frames can then be handled as though
they came from the hardware XDP path, and the existing page_pool code takes
care of returning and recycling them. The setup is optimised for high
performance with a high number of repetitions to support stress testing and
the traffic generator use case; see patch 1 for details.

v10:
- Only propagate memory allocation errors from xdp_test_run_batch()
Other than a case in patch 1.  The set lgtm.

Acked-by: Martin KaFai Lau <redacted>
- Get rid of BPF_F_TEST_XDP_RESERVED; batch_size can be used to probe
- Check that batch_size is unset in non-XDP test_run funcs
- Lower the number of repetitions in the selftest to 10k
- Count number of recycled pages in the selftest
- Fix a few other nits from Martin, carry forward ACKs
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help