[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87ed38ragf.fsf@toke.dk>
Date: Mon, 18 Nov 2024 13:30:08 +0100
From: Toke Høiland-Jørgensen <toke@...hat.com>
To: Ryan Wilson <ryantimwilson@...il.com>
Cc: Alexei Starovoitov <alexei.starovoitov@...il.com>, Network Development
<netdev@...r.kernel.org>, Jakub Kicinski <kuba@...nel.org>, Jesper
Dangaard Brouer <hawk@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>, Andrii
Nakryiko <andrii@...nel.org>, ryantimwilson@...a.com, Willem de Bruijn
<willemdebruijn.kernel@...il.com>, Jason Wang <jasowang@...hat.com>, Eric
Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH bpf-next] bpf: Add multi-prog support for XDP BPF programs
Ryan Wilson <ryantimwilson@...il.com> writes:
> On Fri, Nov 15, 2024 at 3:07 AM Toke Høiland-Jørgensen <toke@...hat.com> wrote:
>>
>> Hi Ryan
>>
>> I'll take a more detailed look at your patch later, but wanted to add
>> a few smallish comment now, see below:
>>
>>
>> Ryan Wilson <ryantimwilson@...il.com> writes:
>> > On Thu, Nov 14, 2024 at 4:52 PM Alexei Starovoitov
>> > <alexei.starovoitov@...il.com> wrote:
>> >>
>> >> On Thu, Nov 14, 2024 at 9:07 AM Ryan Wilson <ryantimwilson@...il.com> wrote:
>> >> >
>> >> > Currently, network devices only support a single XDP program. However,
>> >> > there are use cases for multiple XDP programs per device. For example,
>> >> > at Meta, we have XDP programs for firewalls, DDOS and logging that must
>> >> > all run in a specific order. To work around the lack of multi-program
>> >> > support, a single daemon loads all programs and uses bpf_tail_call()
>> >> > in a loop to jump to each program contained in a BPF map.
>> >>
>> >> The support for multiple XDP progs per netdev is long overdue.
>> >> Thank you for working on this!
>>
>> +1 on this!
>>
>>
>> [...]
>>
>> > Note for real drivers, we do not hit this code. This is how it works
>> > for real drivers:
>> > - When installing a BPF program on a driver, we call the driver's
>> > ndo_bpf() callback function with command = XDP_QUERY_MPROG_SUPPORT. If
>> > this returns 0, then mprog is supported. Otherwise, mprog is not
>> > supported.
>>
>> We already have feature flags for XDP, so why not just make mprog
>> support a feature flag instead of the query thing? It probably should be
>> anyway, so it can also be reported to userspace.
>
> Oh wow can't believe I missed the feature flag API. Yes, I'll use this
> in v2 instead. Thanks for the suggestion!
Cool! You're welcome.
> And if it's exposed to userspace, users no longer need to guess if
> their driver supports mprog or not - although hopefully this is an
> intermediary state and the mprog migration for all drivers will be
> relatively quick and painless.
Famous last words? ;)
-Toke
Powered by blists - more mailing lists