Re: [PATCH bpf-next v5 08/17] bpf: Support consuming XDP HW metadata from fext programs

Stanislav Fomichev
2023-01-04T03:59:25Z

On Tue, Jan 3, 2023 at 5:51 PM Martin KaFai Lau <martin.lau@linux.dev> wrote:
>
> On 12/22/22 8:06 PM, Stanislav Fomichev wrote:
> >>> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> >>> index 11c558be4992..64a68e8fb072 100644
> >>> --- a/kernel/bpf/syscall.c
> >>> +++ b/kernel/bpf/syscall.c
> >>> @@ -2605,6 +2605,12 @@ static int bpf_prog_load(union bpf_attr *attr, bpfptr_t uattr)
> >>> goto free_prog_sec;
> >>> }
> >>>
> >>> + if (type == BPF_PROG_TYPE_EXT && dst_prog) {
> >> Does it also need to test the bpf_prog_is_dev_bound(dst_prog->aux)? Otherwise,
> >> the bpf_prog_dev_bound_inherit() below will fail on everything for !CONFIG_NET.
> > We do the following in bpf_prog_dev_bound_inherit which should be enough?
> >
> > if (!bpf_prog_is_dev_bound(old_prog->aux))
> > return 0;
> >
> > Or am I missing something?
>
> The inline one in include/linux/bpf.h will be called instead when CONFIG_NET is
> not set:
>
> static inline int bpf_prog_dev_bound_inherit(struct bpf_prog *new_prog,
> struct bpf_prog *old_prog)
> {
> return -EOPNOTSUPP;
> }

Ah, I totally missed the fact you were talking about !CONFIG_NET,
thanks for clarifying.
Yeah, will add that extra bpf_prog_is_dev_bound(dst_prog->aux) you've
mentioned, thx!