[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190116164218.5dab8478@cakuba.netronome.com>
Date: Wed, 16 Jan 2019 16:42:18 -0800
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: Quentin Monnet <quentin.monnet@...ronome.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, netdev@...r.kernel.org,
oss-drivers@...ronome.com,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Stanislav Fomichev <sdf@...gle.com>
Subject: Re: [PATCH bpf-next v4 4/9] tools: bpftool: add probes for eBPF
program types
On Wed, 16 Jan 2019 14:21:14 +0000, Quentin Monnet wrote:
> diff --git a/tools/lib/bpf/libbpf.map b/tools/lib/bpf/libbpf.map
> index cd02cd4e2cc3..6355e4c80a86 100644
> --- a/tools/lib/bpf/libbpf.map
> +++ b/tools/lib/bpf/libbpf.map
> @@ -56,6 +56,7 @@ LIBBPF_0.0.1 {
> bpf_object__unpin_maps;
> bpf_object__unpin_programs;
> bpf_perf_event_read_simple;
> + bpf_probe_prog_type;
I think you have to start a new 0.0.2 section now, no?
> bpf_prog_attach;
> bpf_prog_detach;
> bpf_prog_detach2;
> +bool bpf_probe_prog_type(enum bpf_prog_type prog_type, __u32 ifindex)
> +{
> + struct bpf_insn insns[2] = {
> + BPF_MOV64_IMM(BPF_REG_0, 0),
> + BPF_EXIT_INSN()
> + };
> +
> + if (ifindex && prog_type == BPF_PROG_TYPE_SCHED_CLS)
> + /* nfp returns -EINVAL on exit(0) with TC offload */
> + insns[0].imm = 2;
> +
> + errno = 0;
> + prog_load(prog_type, insns, ARRAY_SIZE(insns), NULL, 0, ifindex);
> +
> + return errno != EINVAL && errno != EOPNOTSUPP;
nit: could you check that errno in the function doing the load? :|
also perhaps name that function probe_load()?
> +}
Powered by blists - more mailing lists