Subject: Re: [PATCH RFC] Userspace library for handling multiple XDP programs on an interface

From: Toke Høiland-Jørgensen <[email-masked]>
Date: Sat, 29 Feb 2020 11:37:28 +0100

Andrii Nakryiko <[email-masked]> writes:

> On Fri, Feb 28, 2020 at 6:22 AM Toke Høiland-Jørgensen <[email-masked]> 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=*

Ah, excellent! I'll take a look, thanks for the pointer :)

-Toke