ARM: net: support BPF_ALU | BPF_MOD instructions in the BPF JIT.
authorNicolas Schichan <nschichan@freebox.fr>
Fri, 2 Oct 2015 15:06:47 +0000 (17:06 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 5 Oct 2015 14:02:42 +0000 (07:02 -0700)
commit4560cdff03a76348ee5fae48e3c7914e4de2db5b
treebf49e0f4eeecaf5be9af85af14b203978e54b9ba
parentdf7b6015421babdf0fe7c0061dcc0bddf8ebab09
ARM: net: support BPF_ALU | BPF_MOD instructions in the BPF JIT.

For ARMv7 with UDIV instruction support, generate an UDIV instruction
followed by an MLS instruction.

For other ARM variants, generate code calling a C wrapper similar to
the jit_udiv() function used for BPF_ALU | BPF_DIV instructions.

Some performance numbers reported by the test_bpf module (the duration
per filter run is reported in nanoseconds, between "jitted:<x>" and
"PASS":

ARMv7 QEMU nojit: test_bpf: #3 DIV_MOD_KX jited:0 2196 PASS
ARMv7 QEMU jit: test_bpf: #3 DIV_MOD_KX jited:1 104 PASS
ARMv5 QEMU nojit: test_bpf: #3 DIV_MOD_KX jited:0 2176 PASS
ARMv5 QEMU jit: test_bpf: #3 DIV_MOD_KX jited:1 1104 PASS
ARMv5 kirkwood nojit: test_bpf: #3 DIV_MOD_KX jited:0 1103 PASS
ARMv5 kirkwood jit: test_bpf: #3 DIV_MOD_KX jited:1 311 PASS

Signed-off-by: Nicolas Schichan <nschichan@freebox.fr>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/arm/net/bpf_jit_32.c
arch/arm/net/bpf_jit_32.h