[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4Bzaqr2uZca2iZvRpz54C-ohLsNK1sdN8daBr1qkRQ+NhWg@mail.gmail.com>
Date: Fri, 28 Feb 2020 15:21:28 -0800
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Toke Høiland-Jørgensen <toke@...hat.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Andrii Nakryiko <andriin@...com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Jesper Dangaard Brouer <brouer@...hat.com>,
John Fastabend <john.fastabend@...il.com>,
Lorenz Bauer <lmb@...udflare.com>,
Andrey Ignatov <rdna@...com>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH RFC] Userspace library for handling multiple XDP programs
on an interface
On Fri, Feb 28, 2020 at 6:22 AM Toke Høiland-Jørgensen <toke@...hat.com> wrote:
>
> Hi everyone
>
> As most of you are no doubt aware, we've had various discussions on how
> to handle multiple XDP programs on a single interface. With the freplace
> functionality, the kernel infrastructure is now there to handle this
> (almost, see "missing pieces" below).
>
> While the freplace mechanism offers userspace a lot of flexibility in
> how to handle dispatching of multiple XDP programs, userspace also has
> to do quite a bit of work to implement this (compared to just issuing
> load+attach). The goal of this email is to get some feedback on a
> library to implement this, in the hope that we can converge on something
> that will be widely applicable, ensuring that both (a) everyone doesn't
> have to reinvent the wheel, and (b) we don't end up with a proliferation
> of subtly incompatible dispatcher models that makes it hard or
> impossible to mix and match XDP programs from multiple sources.
>
[...]
>
> **** Missing pieces
> While the libxdp code can assemble a basic dispatcher and load it into the
> kernel, there are a couple of missing pieces on the kernel side; I will propose
> patches to fix these, but figured there was no reason to hold back posting of
> the library for comments because of this. These missing pieces are:
>
> - There is currently no way to persist the freplace after the program exits; the
> file descriptor returned by bpf_raw_tracepoint_open() will release the program
> when it is closed, and it cannot be pinned.
This is completely addressed by patch set [0] I just posted. It will
allow you to pin freplace BPF link in BPF FS. Feel free to review and
comment there, if anything is missing.
[0] https://patchwork.ozlabs.org/project/netdev/list/?series=161582&state=*
>
> - There is no way to re-attach an already loaded program to another function;
> this is needed for updating the call sequence: When a new program is loaded,
> libxdp should get the existing list of component programs on the interface and
> insert the new one into the chain in the appropriate place. To do this it
> needs to build a new dispatcher and reattach all the old programs to it.
> Ideally, this should be doable without detaching them from the old dispatcher;
> that way, we can build the new dispatcher completely, and atomically replace
> it on the interface by the usual XDP attach mechanism.
>
> ---
>
> Toke Høiland-Jørgensen (1):
> libxdp: Add libxdp (FOR COMMENT ONLY)
>
>
> tools/lib/xdp/libxdp.c | 856 +++++++++++++++++++++++++++++++++++++++
> tools/lib/xdp/libxdp.h | 38 ++
> tools/lib/xdp/prog_dispatcher.h | 17 +
> tools/lib/xdp/xdp-dispatcher.c | 178 ++++++++
> tools/lib/xdp/xdp_helpers.h | 12 +
> 5 files changed, 1101 insertions(+)
> create mode 100644 tools/lib/xdp/libxdp.c
> create mode 100644 tools/lib/xdp/libxdp.h
> create mode 100644 tools/lib/xdp/prog_dispatcher.h
> create mode 100644 tools/lib/xdp/xdp-dispatcher.c
> create mode 100644 tools/lib/xdp/xdp_helpers.h
>
Powered by blists - more mailing lists