diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2018-10-08 10:24:14 +0200 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-10-08 10:24:15 +0200 |
commit | a2046de99193efd870eee4f2055c33bb4e5b4fe2 (patch) | |
tree | 805eb07081b6db781ecd45da99bec51e242d512a /kernel/bpf/offload.c | |
parent | 31ce8c4a1ad26852c91de900ebf6888a4d53fc1a (diff) | |
parent | e4052d06a5195b29271a7af262711d69f9ecfd04 (diff) |
Merge branch 'bpf-to-bpf-calls-nfp'
Quentin Monnet says:
====================
This patch series adds support for hardware offload of programs containing
BPF-to-BPF function calls. First, a new callback is added to the kernel
verifier, to collect information after the main part of the verification
has been performed. Then support for BPF-to-BPF calls is incrementally
added to the nfp driver, before offloading programs containing such calls
is eventually allowed by lifting the restriction in the kernel verifier, in
the last patch. Please refer to individual patches for details.
Many thanks to Jiong and Jakub for their precious help and contribution on
the main patches for the JIT-compiler, and everything related to stack
accesses.
====================
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'kernel/bpf/offload.c')
-rw-r--r-- | kernel/bpf/offload.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/kernel/bpf/offload.c b/kernel/bpf/offload.c index 177a52436394..8e93c47f0779 100644 --- a/kernel/bpf/offload.c +++ b/kernel/bpf/offload.c @@ -172,6 +172,24 @@ int bpf_prog_offload_verify_insn(struct bpf_verifier_env *env, return ret; } +int bpf_prog_offload_finalize(struct bpf_verifier_env *env) +{ + struct bpf_prog_offload *offload; + int ret = -ENODEV; + + down_read(&bpf_devs_lock); + offload = env->prog->aux->offload; + if (offload) { + if (offload->dev_ops->finalize) + ret = offload->dev_ops->finalize(env); + else + ret = 0; + } + up_read(&bpf_devs_lock); + + return ret; +} + static void __bpf_prog_offload_destroy(struct bpf_prog *prog) { struct bpf_prog_offload *offload = prog->aux->offload; |