Skip to content

Commit cec0831

Browse files
Alexei Starovoitovdavem330
authored andcommitted
sparc: bpf_jit: add support for BPF_LD(X) | BPF_LEN instructions
BPF_LD | BPF_W | BPF_LEN instruction is occasionally used by tcpdump and present in 11 tests in lib/test_bpf.c Teach sparc JIT compiler to emit it. Signed-off-by: Alexei Starovoitov <ast@plumgrid.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0a29b3d commit cec0831

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

arch/sparc/net/bpf_jit_comp.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,12 @@ void bpf_jit_compile(struct bpf_prog *fp)
624624
emit_and(r_A, r_TMP, r_A);
625625
}
626626
break;
627-
627+
case BPF_LD | BPF_W | BPF_LEN:
628+
emit_skb_load32(len, r_A);
629+
break;
630+
case BPF_LDX | BPF_W | BPF_LEN:
631+
emit_skb_load32(len, r_X);
632+
break;
628633
case BPF_LD | BPF_IMM:
629634
emit_loadimm(K, r_A);
630635
break;

0 commit comments

Comments
 (0)