diff options
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/include/uapi/asm/socket.h | 1 | ||||
-rw-r--r-- | arch/sparc/net/bpf_jit_comp.c | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/arch/sparc/include/uapi/asm/socket.h b/arch/sparc/include/uapi/asm/socket.h index bea1568ae4a..c83a937ead0 100644 --- a/arch/sparc/include/uapi/asm/socket.h +++ b/arch/sparc/include/uapi/asm/socket.h | |||
@@ -41,6 +41,7 @@ | |||
41 | 41 | ||
42 | #define SO_ATTACH_FILTER 0x001a | 42 | #define SO_ATTACH_FILTER 0x001a |
43 | #define SO_DETACH_FILTER 0x001b | 43 | #define SO_DETACH_FILTER 0x001b |
44 | #define SO_GET_FILTER SO_ATTACH_FILTER | ||
44 | 45 | ||
45 | #define SO_PEERNAME 0x001c | 46 | #define SO_PEERNAME 0x001c |
46 | #define SO_TIMESTAMP 0x001d | 47 | #define SO_TIMESTAMP 0x001d |
diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c index 28368701ef7..3109ca684a9 100644 --- a/arch/sparc/net/bpf_jit_comp.c +++ b/arch/sparc/net/bpf_jit_comp.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/netdevice.h> | 3 | #include <linux/netdevice.h> |
4 | #include <linux/filter.h> | 4 | #include <linux/filter.h> |
5 | #include <linux/cache.h> | 5 | #include <linux/cache.h> |
6 | #include <linux/if_vlan.h> | ||
6 | 7 | ||
7 | #include <asm/cacheflush.h> | 8 | #include <asm/cacheflush.h> |
8 | #include <asm/ptrace.h> | 9 | #include <asm/ptrace.h> |
@@ -312,6 +313,12 @@ do { *prog++ = BR_OPC | WDISP22(OFF); \ | |||
312 | #define emit_addi(R1, IMM, R3) \ | 313 | #define emit_addi(R1, IMM, R3) \ |
313 | *prog++ = (ADD | IMMED | RS1(R1) | S13(IMM) | RD(R3)) | 314 | *prog++ = (ADD | IMMED | RS1(R1) | S13(IMM) | RD(R3)) |
314 | 315 | ||
316 | #define emit_and(R1, R2, R3) \ | ||
317 | *prog++ = (AND | RS1(R1) | RS2(R2) | RD(R3)) | ||
318 | |||
319 | #define emit_andi(R1, IMM, R3) \ | ||
320 | *prog++ = (AND | IMMED | RS1(R1) | S13(IMM) | RD(R3)) | ||
321 | |||
315 | #define emit_alloc_stack(SZ) \ | 322 | #define emit_alloc_stack(SZ) \ |
316 | *prog++ = (SUB | IMMED | RS1(SP) | S13(SZ) | RD(SP)) | 323 | *prog++ = (SUB | IMMED | RS1(SP) | S13(SZ) | RD(SP)) |
317 | 324 | ||
@@ -415,6 +422,8 @@ void bpf_jit_compile(struct sk_filter *fp) | |||
415 | case BPF_S_ANC_IFINDEX: | 422 | case BPF_S_ANC_IFINDEX: |
416 | case BPF_S_ANC_MARK: | 423 | case BPF_S_ANC_MARK: |
417 | case BPF_S_ANC_RXHASH: | 424 | case BPF_S_ANC_RXHASH: |
425 | case BPF_S_ANC_VLAN_TAG: | ||
426 | case BPF_S_ANC_VLAN_TAG_PRESENT: | ||
418 | case BPF_S_ANC_CPU: | 427 | case BPF_S_ANC_CPU: |
419 | case BPF_S_ANC_QUEUE: | 428 | case BPF_S_ANC_QUEUE: |
420 | case BPF_S_LD_W_ABS: | 429 | case BPF_S_LD_W_ABS: |
@@ -600,6 +609,16 @@ void bpf_jit_compile(struct sk_filter *fp) | |||
600 | case BPF_S_ANC_RXHASH: | 609 | case BPF_S_ANC_RXHASH: |
601 | emit_skb_load32(rxhash, r_A); | 610 | emit_skb_load32(rxhash, r_A); |
602 | break; | 611 | break; |
612 | case BPF_S_ANC_VLAN_TAG: | ||
613 | case BPF_S_ANC_VLAN_TAG_PRESENT: | ||
614 | emit_skb_load16(vlan_tci, r_A); | ||
615 | if (filter[i].code == BPF_S_ANC_VLAN_TAG) { | ||
616 | emit_andi(r_A, VLAN_VID_MASK, r_A); | ||
617 | } else { | ||
618 | emit_loadimm(VLAN_TAG_PRESENT, r_TMP); | ||
619 | emit_and(r_A, r_TMP, r_A); | ||
620 | } | ||
621 | break; | ||
603 | 622 | ||
604 | case BPF_S_LD_IMM: | 623 | case BPF_S_LD_IMM: |
605 | emit_loadimm(K, r_A); | 624 | emit_loadimm(K, r_A); |