[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87h7qi5oij.fsf@toke.dk>
Date: Sun, 25 Oct 2020 16:11:32 +0100
From: Toke Høiland-Jørgensen <toke@...hat.com>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>,
Hangbin Liu <haliu@...hat.com>
Cc: Stephen Hemminger <stephen@...workplumber.org>,
Daniel Borkmann <daniel@...earbox.net>,
David Ahern <dsahern@...il.com>,
Alexei Starovoitov <ast@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
David Miller <davem@...emloft.net>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Jiri Benc <jbenc@...hat.com>,
Andrii Nakryiko <andrii@...nel.org>
Subject: Re: [PATCH iproute2-next 3/5] lib: add libbpf support
Andrii Nakryiko <andrii.nakryiko@...il.com> writes:
> On Thu, Oct 22, 2020 at 8:39 PM Hangbin Liu <haliu@...hat.com> wrote:
>>
>> This patch converts iproute2 to use libbpf for loading and attaching
>> BPF programs when it is available, which is started by Toke's
>> implementation[1]. With libbpf iproute2 could correctly process BTF
>> information and support the new-style BTF-defined maps, while keeping
>> compatibility with the old internal map definition syntax.
>>
>> The old iproute2 bpf code is kept and will be used if no suitable libbpf
>> is available. When using libbpf, wrapper code in bpf_legacy.c ensures that
>> iproute2 will still understand the old map definition format, including
>> populating map-in-map and tail call maps before load.
>>
>> In bpf_libbpf.c, we init iproute2 ctx and elf info first to check the
>> legacy bytes. When handling the legacy maps, for map-in-maps, we create
>> them manually and re-use the fd as they are associated with id/inner_id.
>> For pin maps, we only set the pin path and let libbp load to handle it.
>> For tail calls, we find it first and update the element after prog load.
>
> I never implemented tail call map initialization using the same
> approach as declarative map-in-map support in libbpf, because no one
> asked and/or showed a use case. But all the pieces are there, and if
> there's interest, we should probably support that in libbpf as well.
Yeah, that's what we figured; and since this series maintains
compatibility with the old map definition format for declarative
tail-calls, this doesn't have to hold up the conversion: iproute2 will
just magically gain this when/if it lands in libbpf :)
-Toke
Powered by blists - more mailing lists