[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211219021922.2jhnvuhcg4zzcp32@ast-mbp>
Date: Sat, 18 Dec 2021 18:19:22 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Kumar Kartikeya Dwivedi <memxor@...il.com>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org,
netfilter-devel@...r.kernel.org,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
Maxim Mikityanskiy <maximmi@...dia.com>,
Pablo Neira Ayuso <pablo@...filter.org>,
Florian Westphal <fw@...len.de>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Toke Høiland-Jørgensen <toke@...hat.com>
Subject: Re: [PATCH bpf-next v4 04/10] bpf: Introduce mem, size argument pair
support for kfunc
On Fri, Dec 17, 2021 at 07:20:25AM +0530, Kumar Kartikeya Dwivedi wrote:
> +static bool is_kfunc_arg_mem_size(const struct btf *btf,
> + const struct btf_param *arg,
> + const struct bpf_reg_state *reg)
> +{
> + const struct btf_type *t;
> + const char *param_name;
> +
> + t = btf_type_skip_modifiers(btf, arg->type, NULL);
> + if (!btf_type_is_scalar(t) || reg->type != SCALAR_VALUE)
> + return false;
> +
> + /* In the future, this can be ported to use BTF tagging */
> + param_name = btf_name_by_offset(btf, arg->name_off);
> + if (strncmp(param_name, "len__", sizeof("len__") - 1))
> + return false;
I like the feature and approach, but have a suggestion:
The "__sz" suffix would be shorter and more readable.
wdyt?
Powered by blists - more mailing lists