[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEfhGixoRM_wRy_e9reCGq69XUM1w-1kKGErCUty=gEB8DbzfA@mail.gmail.com>
Date: Wed, 4 Oct 2017 09:59:05 -0400
From: Craig Gallek <kraigatgoog@...il.com>
To: Daniel Borkmann <daniel@...earbox.net>
Cc: Alexei Starovoitov <ast@...com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
"David S . Miller" <davem@...emloft.net>,
Chonggang Li <chonggangli@...gle.com>,
netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next v2 1/2] libbpf: parse maps sections of varying size
On Tue, Oct 3, 2017 at 10:39 AM, Daniel Borkmann <daniel@...earbox.net> wrote:
> On 10/03/2017 01:07 AM, Alexei Starovoitov wrote:
>>
>> On 10/2/17 9:41 AM, Craig Gallek wrote:
>>>
>>> + /* Assume equally sized map definitions */
>>> + map_def_sz = data->d_size / nr_maps;
>>> + if (!data->d_size || (data->d_size % nr_maps) != 0) {
>>> + pr_warning("unable to determine map definition size "
>>> + "section %s, %d maps in %zd bytes\n",
>>> + obj->path, nr_maps, data->d_size);
>>> + return -EINVAL;
>>> + }
>>
>>
>> this approach is not as flexible as done by samples/bpf/bpf_load.c
>> where it looks at every map independently by walking symtab,
>> but I guess it's ok.
>
>
> Regarding different map spec structs in a single prog: unless
> we have a good use case why we would need it (and I'm not aware
> of anything in particular), I would just go with a fixed size.
> I did kind of similar sanity checks in bpf_fetch_maps_end() in
> iproute2 loader as well.
Split vote? I'm happy to try to make this work with varying sizes,
but I agree the usefulness seems low. It would imply building map
sections with different definition structures and we would then need a
way to differentiate them. If the goal is to allow for different map
definition structures, I don't think size alone is a sufficient
differentiator.
Powered by blists - more mailing lists