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:
committed by
Alexei Starovoitov
parent
a40a26322a
commit
16a8cb5cff
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user