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>
This commit is contained in:
Quentin Monnet
2018-11-10 15:39:54 -08:00
committed by Alexei Starovoitov
parent a40a26322a
commit 16a8cb5cff
4 changed files with 11 additions and 13 deletions
+2 -2
View File
@@ -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;