diff options
85 files changed, 828 insertions, 355 deletions
diff --git a/Documentation/networking/filter.txt b/Documentation/networking/filter.txt index c48a9704bda8..d16f424c5e8d 100644 --- a/Documentation/networking/filter.txt +++ b/Documentation/networking/filter.txt | |||
| @@ -462,9 +462,9 @@ JIT compiler | |||
| 462 | ------------ | 462 | ------------ |
| 463 | 463 | ||
| 464 | The Linux kernel has a built-in BPF JIT compiler for x86_64, SPARC, PowerPC, | 464 | The Linux kernel has a built-in BPF JIT compiler for x86_64, SPARC, PowerPC, |
| 465 | ARM and s390 and can be enabled through CONFIG_BPF_JIT. The JIT compiler is | 465 | ARM, MIPS and s390 and can be enabled through CONFIG_BPF_JIT. The JIT compiler |
| 466 | transparently invoked for each attached filter from user space or for internal | 466 | is transparently invoked for each attached filter from user space or for |
| 467 | kernel users if it has been previously enabled by root: | 467 | internal kernel users if it has been previously enabled by root: |
| 468 | 468 | ||
| 469 | echo 1 > /proc/sys/net/core/bpf_jit_enable | 469 | echo 1 > /proc/sys/net/core/bpf_jit_enable |
| 470 | 470 | ||
diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c index 1f76c22a6a75..51ae87b483e0 100644 --- a/arch/sparc/net/bpf_jit_comp.c +++ b/arch/sparc/net/bpf_jit_comp.c | |||
| @@ -234,12 +234,18 @@ do { BUILD_BUG_ON(FIELD_SIZEOF(STRUCT, FIELD) != sizeof(u8)); \ | |||
| 234 | __emit_load8(BASE, STRUCT, FIELD, DEST); \ | 234 | __emit_load8(BASE, STRUCT, FIELD, DEST); \ |
| 235 | } while (0) | 235 | } while (0) |
| 236 | 236 | ||
| 237 | #define emit_ldmem(OFF, DEST) \ | 237 | #ifdef CONFIG_SPARC64 |
| 238 | do { *prog++ = LD32I | RS1(FP) | S13(-(OFF)) | RD(DEST); \ | 238 | #define BIAS (STACK_BIAS - 4) |
| 239 | #else | ||
| 240 | #define BIAS (-4) | ||
| 241 | #endif | ||
| 242 | |||
| 243 | #define emit_ldmem(OFF, DEST) \ | ||
| 244 | do { *prog++ = LD32I | RS1(SP) | S13(BIAS - (OFF)) | RD(DEST); \ | ||
| 239 | } while (0) | 245 | } while (0) |
| 240 | 246 | ||
| 241 | #define emit_stmem(OFF, SRC) \ | 247 | #define emit_stmem(OFF, SRC) \ |
| 242 | do { *prog++ = LD32I | RS1(FP) | S13(-(OFF)) | RD(SRC); \ | 248 | do { *prog++ = ST32I | RS1(SP) | S13(BIAS - (OFF)) | RD(SRC); \ |
| 243 | } while (0) | 249 | } while (0) |
| 244 | 250 | ||
| 245 | #ifdef CONFIG_SMP | 251 | #ifdef CONFIG_SMP |
| @@ -615,10 +621,11 @@ void bpf_jit_compile(struct bpf_prog *fp) | |||
| 615 | case BPF_ANC | SKF_AD_VLAN_TAG: | 621 | case BPF_ANC | SKF_AD_VLAN_TAG: |
| 616 | case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT: | 622 | case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT: |
| 617 | emit_skb_load16(vlan_tci, r_A); | 623 | emit_skb_load16(vlan_tci, r_A); |
| 618 | if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) { | 624 | if (code != (BPF_ANC | SKF_AD_VLAN_TAG)) { |
| 619 | emit_andi(r_A, VLAN_VID_MASK, r_A); | 625 | emit_alu_K(SRL, 12); |
| 626 | emit_andi(r_A, 1, r_A); | ||
| 620 | } else { | 627 | } else { |
| 621 | emit_loadimm(VLAN_TAG_PRESENT, r_TMP); | 628 | emit_loadimm(~VLAN_TAG_PRESENT, r_TMP); |
| 622 | emit_and(r_A, r_TMP, r_A); | 629 | emit_and(r_A, r_TMP, r_A); |
| 623 | } | ||
