Skip to contentSkip to conversation

ARM: net: JIT compiler for packet filters

PATCH New Mircea Gherzan 1 participant 1 message Dec 18, 2011

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: net: JIT compiler for packet filters

Based of Matt Evans's PPC64 implementation.

Supports only ARM mode with EABI.

Supports both little and big endian. Depends on the support for unaligned loads on ARMv7. Does not support all the BPF opcodes that deal with ancillary data. The scratch memory of the filter lives on the stack.

Enabled in the same way as for x86-64 and PPC64:

echo 1 > /proc/sys/net/core/bpf_jit_enable

A value greater than 1 enables opcode output.

---
 arch/arm/Kconfig          |    1 +
 arch/arm/Makefile         |    1 +
 arch/arm/net/Makefile     |    3 +
 arch/arm/net/bpf_jit_32.c |  840 +++++++++++++++++++++++++++++++++++++++++++++
 arch/arm/net/bpf_jit_32.h |  174 ++++++++++
 5 files changed, 1019 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/net/Makefile
 create mode 100644 arch/arm/net/bpf_jit_32.c
 create mode 100644 arch/arm/net/bpf_jit_32.h
arch/arm/Kconfig +1 -0
index abba5b8..ea65c41 100644
@@ -30,6 +30,7 @@ config ARM
 	select HAVE_SPARSE_IRQ
 	select GENERIC_IRQ_SHOW
 	select CPU_PM if (SUSPEND || CPU_IDLE)
+	select HAVE_BPF_JIT if (!THUMB2_KERNEL && AEABI)
 	help
 	  The ARM series is a line of low-power-consumption RISC chip designs
 	  licensed by ARM Ltd and targeted at embedded applications and
arch/arm/Makefile +1 -0
index dfcf3b0..8810a10 100644
@@ -255,6 +255,7 @@ core-$(CONFIG_VFP)		+= arch/arm/vfp/
 
 # If we have a machine-specific directory, then include it in the build.
 core-y				+= arch/arm/kernel/ arch/arm/mm/ arch/arm/common/
+core-y				+= arch/arm/net/
 core-y				+= $(machdirs) $(platdirs)
 
 drivers-$(CONFIG_OPROFILE)      += arch/arm/oprofile/
arch/arm/net/Makefile new file +3 -0
new file mode 100644
index 0000000..c2c1084
@@ -0,0 +1,3 @@
+# ARM-specific networking code
+
+obj-$(CONFIG_BPF_JIT) += bpf_jit_32.o
arch/arm/net/bpf_jit_32.c new file +840 -0

840 lines not on this page · raw message

arch/arm/net/bpf_jit_32.h new file +174 -0

174 lines not on this page · raw message

Signature · 1 line
1.7.7.3