[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c58f11be-af67-baff-bd70-753ca84de0dd@gmail.com>
Date: Wed, 27 May 2020 07:56:25 -0600
From: David Ahern <dsahern@...il.com>
To: Jesper Dangaard Brouer <brouer@...hat.com>,
David Ahern <dsahern@...nel.org>
Cc: netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
toke@...hat.com, daniel@...earbox.net, john.fastabend@...il.com,
ast@...nel.org, kafai@...com, songliubraving@...com, yhs@...com,
andriin@...com
Subject: Re: [PATCH bpf-next 1/5] bpf: Handle 8-byte values in DEVMAP and
DEVMAP_HASH
On 5/27/20 4:26 AM, Jesper Dangaard Brouer wrote:
>> @@ -108,9 +118,13 @@ static int dev_map_init_map(struct bpf_dtab *dtab, union bpf_attr *attr)
>> u64 cost = 0;
>> int err;
>>
>> - /* check sanity of attributes */
>> + /* check sanity of attributes. 2 value sizes supported:
>> + * 4 bytes: ifindex
>> + * 8 bytes: ifindex + prog fd
>> + */
>> if (attr->max_entries == 0 || attr->key_size != 4 ||
>> - attr->value_size != 4 || attr->map_flags & ~DEV_CREATE_FLAG_MASK)
>> + (attr->value_size != 4 && attr->value_size != 8) ||
>
> IMHO we really need to leverage BTF here, as I'm sure we need to do more
> extensions, and this size matching will get more and more unmaintainable.
>
> With BTF in place, dumping the map via bpftool, will also make the
> fields "self-documenting".
>
> I will try to implement something that uses BTF for this case (and cpumap).
>
as mentioned in a past response, BTF does not make any fields special
and this code should not assume it either. You need to know precisely
which 4 bytes is the program fd that needs to be looked up, and that
AFAIK is beyond the scope of BTF.
Powered by blists - more mailing lists