Merge branch 'bpf_link-XDP'
authorAlexei Starovoitov <ast@kernel.org>
Sun, 26 Jul 2020 03:37:02 +0000 (20:37 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 26 Jul 2020 03:43:01 +0000 (20:43 -0700)
commit47960ad614d0c162e03f8ec10bca7086fde284ed
tree970b9373fc9ef7dcfdb3edb2a9948a842c5eb50f
parent2b9b305fcdda1810bdffeb599361174eb2cd0b7c
parente8407fdeb9a6866784e249881f6c786a0835faba
Merge branch 'bpf_link-XDP'

Andrii Nakryiko says:

====================
Following cgroup and netns examples, implement bpf_link support for XDP.

The semantics is described in patch #2. Program and link attachments are
mutually exclusive, in the sense that neither link can replace attached
program nor program can replace attached link. Link can't replace attached
link as well, as is the case for any other bpf_link implementation.

Patch #1 refactors existing BPF program-based attachment API and centralizes
high-level query/attach decisions in generic kernel code, while drivers are
kept simple and are instructed with low-level decisions about attaching and
detaching specific bpf_prog. This also makes QUERY command unnecessary, and
patch #8 removes support for it from all kernel drivers. If that's a bad idea,
we can drop that patch altogether.

With refactoring in patch #1, adding bpf_xdp_link is completely transparent to
drivers, they are still functioning at the level of "effective" bpf_prog, that
should be called in XDP data path.

Corresponding libbpf support for BPF XDP link is added in patch #5.

v3->v4:
- fix a compilation warning in one of drivers (Jakub);

v2->v3:
- fix build when CONFIG_BPF_SYSCALL=n (kernel test robot);

v1->v2:
- fix prog refcounting bug (David);
- split dev_change_xdp_fd() changes into 2 patches (David);
- add extack messages to all user-induced errors (David).
====================

Signed-off-by: Alexei Starovoitov <ast@kernel.org>