[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <287e972c-44f0-2a9e-ebd7-6c5948db486e@netronome.com>
Date: Thu, 17 Jan 2019 14:11:25 +0000
From: Quentin Monnet <quentin.monnet@...ronome.com>
To: Jakub Kicinski <jakub.kicinski@...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
2019-01-16 16:42 UTC-0800 ~ Jakub Kicinski <jakub.kicinski@...ronome.com>
> On Wed, 16 Jan 2019 14:21:14 +0000, Quentin Monnet wrote:
>> +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? :|
No, the prog_load() function is also used in patch 6 in
bpf_probe_helper() to load the probes, but the check to assess the
success or failure of the probes is not the same for helpers and program
types. So checking the result does not belong to prog_load(), in my opinion.
Powered by blists - more mailing lists