nfp: bpf: allow program sharing within ASIC
authorJakub Kicinski <jakub.kicinski@netronome.com>
Tue, 17 Jul 2018 17:53:28 +0000 (10:53 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 18 Jul 2018 13:10:34 +0000 (15:10 +0200)
Allow program sharing between netdevs of the same NFP ASIC.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
drivers/net/ethernet/netronome/nfp/bpf/offload.c

index 78f44c4d95b4914755dfeb806c8d5e85f5463e65..49b03f7dbf4625de7cd1d03eb0d5bc448da9de14 100644 (file)
@@ -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;