2019-01-16 16:42 UTC-0800 ~ Jakub Kicinski <jakub.kicin...@netronome.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.

Reply via email to