[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <871r2lydga.fsf@toke.dk>
Date: Thu, 09 Dec 2021 17:01:41 +0100
From: Toke Høiland-Jørgensen <toke@...hat.com>
To: John Fastabend <john.fastabend@...il.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Jesper Dangaard Brouer <hawk@...nel.org>,
Ilias Apalodimas <ilias.apalodimas@...aro.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, bpf@...r.kernel.org
Subject: RE: [PATCH bpf-next 0/8] Add support for transmitting packets using
XDP in bpf_prog_run()
John Fastabend <john.fastabend@...il.com> writes:
> Toke Høiland-Jørgensen wrote:
>> This series adds support for transmitting packets using XDP in
>> bpf_prog_run(), by enabling the xdp_do_redirect() callback so XDP programs
>> can perform "real" redirects to devices or maps, using an opt-in flag when
>> executing the program.
>>
>> The primary use case for this is testing the redirect map types and the
>> ndo_xdp_xmit driver operation without generating external traffic. But it
>> turns out to also be useful for creating a programmable traffic generator.
>> The last patch adds a sample traffic generator to bpf/samples, which
>> can transmit up to 11.5 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 with the data passed in by
>> userspace. These pages can then be redirected using the normal redirection
>> mechanism, 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 6 for details.
>>
>> The series is structured as follows: Patches 1-2 adds a few features to
>> page_pool that are needed for the usage in bpf_prog_run(). Similarly,
>> patches 3-5 performs a couple of preparatory refactorings of the XDP
>> redirect and memory management code. Patch 6 adds the support to
>> bpf_prog_run() itself, patch 7 adds a selftest, and patch 8 adds the
>> traffic generator example to samples/bpf.
>
> Overall looks pretty good. Couple questions in the series though.
Yay! Thank you for the review! Will reply to each of those...
-Toke
Powered by blists - more mailing lists