[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190606180253.36f6d2ae@cakuba.netronome.com>
Date: Thu, 6 Jun 2019 18:02:53 -0700
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: Alexei Starovoitov <ast@...com>
Cc: Andrii Nakryiko <andrii.nakryiko@...il.com>,
Daniel Borkmann <daniel@...earbox.net>,
Stanislav Fomichev <sdf@...ichev.me>,
Andrii Nakryiko <andriin@...com>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Kernel Team <Kernel-team@...com>, Yonghong Song <yhs@...com>
Subject: Re: [RFC PATCH bpf-next 6/8] libbpf: allow specifying map
definitions using BTF
On Fri, 7 Jun 2019 00:27:52 +0000, Alexei Starovoitov wrote:
> the solution we're discussing should solve BPF_ANNOTATE_KV_PAIR too.
> That hack must go.
I see.
> If I understood your objections to Andrii's format is that
> you don't like pointer part of key/value while Andrii explained
> why we picked the pointer, right?
>
> So how about:
>
> struct {
> int type;
> int max_entries;
> struct {
> __u32 key;
> struct my_value value;
> } types[];
> } ...
My objection is that k/v fields are never initialized, so they're
"metafields", mixed with real fields which hold parameters - like
type, max_entries etc.
But I thought about this 3 times now, and I see no better solution.
FWIW my best shot was relos:
extern struct my_key my_key;
extern int type_int;
struct map_def {
int type;
int max_entries;
void *btf_key_ref;
void *btf_val_ref;
} = {
...
.btf_key_ref = &my_key,
.btf_val_ref = &type_int,
};
The advantage being that map_def is no longer modified for each
instance and k/v combination. And I get my assignment to k/v members :)
But really, I give up, I can't come up with anything better :)
Powered by blists - more mailing lists