summaryrefslogtreecommitdiffstats
path: root/kernel/bpf/offload.c
diff options
context:
space:
mode:
authorQuentin Monnet <quentin.monnet@netronome.com>2018-11-09 14:03:32 +0100
committerAlexei Starovoitov <ast@kernel.org>2018-11-11 00:39:54 +0100
commit16a8cb5cffd0a2929ae97bc258d2d9c92a4e7f6d (patch)
tree76ea924a47f2bb58bb2caf5d5ae5464b7dbbab55 /kernel/bpf/offload.c
parentbpf: pass prog instead of env to bpf_prog_offload_verifier_prep() (diff)
downloadlinux-16a8cb5cffd0a2929ae97bc258d2d9c92a4e7f6d.tar.xz
linux-16a8cb5cffd0a2929ae97bc258d2d9c92a4e7f6d.zip
bpf: do not pass netdev to translate() and prepare() offload callbacks
The kernel functions to prepare verifier and translate for offloaded program retrieve "offload" from "prog", and "netdev" from "offload". Then both "prog" and "netdev" are passed to the callbacks. Simplify this by letting the drivers retrieve the net device themselves from the offload object attached to prog - if they need it at all. There is currently no need to pass the netdev as an argument to those functions. Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/bpf/offload.c')
-rw-r--r--kernel/bpf/offload.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/bpf/offload.c b/kernel/bpf/offload.c
index 397d206e184b..52c5617e3716 100644
--- a/kernel/bpf/offload.c
+++ b/kernel/bpf/offload.c
@@ -131,7 +131,7 @@ int bpf_prog_offload_verifier_prep(struct bpf_prog *prog)
down_read(&bpf_devs_lock);
offload = prog->aux->offload;
if (offload)
- ret = offload->offdev->ops->prepare(offload->netdev, prog);
+ ret = offload->offdev->ops->prepare(prog);
offload->dev_state = !ret;
up_read(&bpf_devs_lock);
@@ -203,7 +203,7 @@ static int bpf_prog_offload_translate(struct bpf_prog *prog)
down_read(&bpf_devs_lock);
offload = prog->aux->offload;
if (offload)
- ret = offload->offdev->ops->translate(offload->netdev, prog);
+ ret = offload->offdev->ops->translate(prog);
up_read(&bpf_devs_lock);
return ret;