nfp: bpf: don't do ld/mask combination if mask is jump destination
authorJiong Wang <jiong.wang@netronome.com>
Fri, 1 Dec 2017 05:32:52 +0000 (21:32 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 1 Dec 2017 19:59:20 +0000 (20:59 +0100)
If the mask insn in the ld/mask pair is jump destination, then don't do
combination.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
drivers/net/ethernet/netronome/nfp/bpf/jit.c

index f76659ecb6544529c36eab61068bb26047171ad3..f2317b76422204694b68f70b678e72419b8976c4 100644 (file)
@@ -2142,6 +2142,9 @@ static void nfp_bpf_opt_ld_mask(struct nfp_prog *nfp_prog)
                if (next.src_reg || next.dst_reg)
                        continue;
 
+               if (meta2->flags & FLAG_INSN_IS_JUMP_DST)
+                       continue;
+
                meta2->skip = true;
        }
 }