diff options
author | 2017-11-05 22:26:20 +0900 | |
---|---|---|
committer | 2017-11-05 22:26:20 +0900 | |
commit | 8a3b718ac2c29abcba8e12636710cff3cee8c01b (patch) | |
tree | 8993f6c89d54cc54d2fb083635abe832d4f3b5bb /kernel/bpf/core.c | |
parent | mISDN: l1oip_core: replace _manual_ swap with swap macro (diff) | |
parent | bpf: remove old offload/analyzer (diff) | |
download | wireguard-linux-8a3b718ac2c29abcba8e12636710cff3cee8c01b.tar.xz wireguard-linux-8a3b718ac2c29abcba8e12636710cff3cee8c01b.zip |
Merge branch 'bpf-add-offload-as-a-first-class-citizen'
Jakub Kicinski says:
====================
bpf: add offload as a first class citizen
This series is my stab at what was discussed at a recent IOvisor
bi-weekly call. The idea is to make the device translator run at
the program load time. This makes the offload more explicit to
the user space. It also makes it easy for the device translator
to insert information into the original verifier log.
v2:
- include linux/bug.h instead of asm/bug.h;
- rebased on top of Craig's verifier fix (no changes, the last patch
just removes more code now). I checked the set doesn't conflict
with Jiri's, Josef's or Roman's patches, but missed Craig's fix :(
v1:
- rename the ifindex member on load;
- improve commit messages;
- split nfp patches more.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/bpf/core.c')
-rw-r--r-- | kernel/bpf/core.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 7fe448799d76..8a6c37762330 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -1380,7 +1380,13 @@ struct bpf_prog *bpf_prog_select_runtime(struct bpf_prog *fp, int *err) * valid program, which in this case would simply not * be JITed, but falls back to the interpreter. */ - fp = bpf_int_jit_compile(fp); + if (!bpf_prog_is_dev_bound(fp->aux)) { + fp = bpf_int_jit_compile(fp); + } else { + *err = bpf_prog_offload_compile(fp); + if (*err) + return fp; + } bpf_prog_lock_ro(fp); /* The tail call compatibility check can only be done at @@ -1549,6 +1555,8 @@ static void bpf_prog_free_deferred(struct work_struct *work) struct bpf_prog_aux *aux; aux = container_of(work, struct bpf_prog_aux, work); + if (bpf_prog_is_dev_bound(aux)) + bpf_prog_offload_destroy(aux->prog); bpf_jit_free(aux->prog); } |