diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2017-12-27 21:39:04 -0500 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2017-12-31 10:12:22 -0500 |
commit | 9a18eedb145d080d542766af1d7513ebfccd1604 (patch) | |
tree | 088372c4392d04fc95231543f338c8a1cc73cb9b /kernel/bpf/syscall.c | |
parent | e0d3974ac77b0d581b92affe5851fc40ad2f42a4 (diff) |
bpf: offload: don't use prog->aux->offload as boolean
We currently use aux->offload to indicate that program is bound
to a specific device. This forces us to keep the offload structure
around even after the device is gone. Add a bool member to
struct bpf_prog_aux to indicate if offload was requested.
Suggested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'kernel/bpf/syscall.c')
-rw-r--r-- | kernel/bpf/syscall.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 007802c5ca7d..e0afc2e39fd5 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c | |||
@@ -1157,6 +1157,8 @@ static int bpf_prog_load(union bpf_attr *attr) | |||
1157 | if (!prog) | 1157 | if (!prog) |
1158 | return -ENOMEM; | 1158 | return -ENOMEM; |
1159 | 1159 | ||
1160 | prog->aux->offload_requested = !!attr->prog_ifindex; | ||
1161 | |||
1160 | err = security_bpf_prog_alloc(prog->aux); | 1162 | err = security_bpf_prog_alloc(prog->aux); |
1161 | if (err) | 1163 | if (err) |
1162 | goto free_prog_nouncharge; | 1164 | goto free_prog_nouncharge; |
@@ -1178,7 +1180,7 @@ static int bpf_prog_load(union bpf_attr *attr) | |||
1178 | atomic_set(&prog->aux->refcnt, 1); | 1180 | atomic_set(&prog->aux->refcnt, 1); |
1179 | prog->gpl_compatible = is_gpl ? 1 : 0; | 1181 | prog->gpl_compatible = is_gpl ? 1 : 0; |
1180 | 1182 | ||
1181 | if (attr->prog_ifindex) { | 1183 | if (bpf_prog_is_dev_bound(prog->aux)) { |
1182 | err = bpf_prog_offload_init(prog, attr); | 1184 | err = bpf_prog_offload_init(prog, attr); |
1183 | if (err) | 1185 | if (err) |
1184 | goto free_prog; | 1186 | goto free_prog; |