From: Jakub Kicinski Date: Tue, 17 Jul 2018 17:53:28 +0000 (-0700) Subject: nfp: bpf: allow program sharing within ASIC X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=b5faa20d6fb28144a71885720a436e2297e26e9b;p=openwrt%2Fstaging%2Fblogic.git nfp: bpf: allow program sharing within ASIC Allow program sharing between netdevs of the same NFP ASIC. Signed-off-by: Jakub Kicinski Reviewed-by: Quentin Monnet Signed-off-by: Daniel Borkmann --- diff --git a/drivers/net/ethernet/netronome/nfp/bpf/offload.c b/drivers/net/ethernet/netronome/nfp/bpf/offload.c index 78f44c4d95b4..49b03f7dbf46 100644 --- a/drivers/net/ethernet/netronome/nfp/bpf/offload.c +++ b/drivers/net/ethernet/netronome/nfp/bpf/offload.c @@ -566,14 +566,8 @@ int nfp_net_bpf_offload(struct nfp_net *nn, struct bpf_prog *prog, { int err; - if (prog) { - struct bpf_prog_offload *offload = prog->aux->offload; - - if (!offload) - return -EINVAL; - if (offload->netdev != nn->dp.netdev) - return -EINVAL; - } + if (prog && !bpf_offload_dev_match(prog, nn->dp.netdev)) + return -EINVAL; if (prog && old_prog) { u8 cap;