diff options
author | Quentin Monnet <quentin.monnet@netronome.com> | 2018-11-09 13:03:32 +0000 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2018-11-10 15:39:54 -0800 |
commit | 16a8cb5cffd0a2929ae97bc258d2d9c92a4e7f6d (patch) | |
tree | 76ea924a47f2bb58bb2caf5d5ae5464b7dbbab55 /drivers/net/netdevsim | |
parent | a40a26322a83d4a26a99ad2616cbd77394c19587 (diff) | |
download | blackbird-obmc-linux-16a8cb5cffd0a2929ae97bc258d2d9c92a4e7f6d.tar.gz blackbird-obmc-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 'drivers/net/netdevsim')
-rw-r--r-- | drivers/net/netdevsim/bpf.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/netdevsim/bpf.c b/drivers/net/netdevsim/bpf.c index 560bdaf1c98b..6a5b7bd9a1f9 100644 --- a/drivers/net/netdevsim/bpf.c +++ b/drivers/net/netdevsim/bpf.c @@ -258,10 +258,9 @@ static int nsim_bpf_create_prog(struct netdevsim *ns, struct bpf_prog *prog) return 0; } -static int -nsim_bpf_verifier_prep(struct net_device *dev, struct bpf_prog *prog) +static int nsim_bpf_verifier_prep(struct bpf_prog *prog) { - struct netdevsim *ns = netdev_priv(dev); + struct netdevsim *ns = netdev_priv(prog->aux->offload->netdev); if (!ns->bpf_bind_accept) return -EOPNOTSUPP; @@ -269,7 +268,7 @@ nsim_bpf_verifier_prep(struct net_device *dev, struct bpf_prog *prog) return nsim_bpf_create_prog(ns, prog); } -static int nsim_bpf_translate(struct net_device *dev, struct bpf_prog *prog) +static int nsim_bpf_translate(struct bpf_prog *prog) { struct nsim_bpf_bound_prog *state = prog->aux->offload->dev_priv; |