diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2013-02-09 08:07:50 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-02-14 09:55:20 -0500 |
commit | 5303a0fe8ce8c7493025a3b60a403439edb4159a (patch) | |
tree | b6a4899f1fe2c3b5b8f7b758b751b2f58c4396e5 /arch/s390 | |
parent | a1dd7e4ef784a2c3d997d68b9321b6d115f19b20 (diff) |
s390/bpf,jit: add vlan tag support
s390 version of 855ddb56 "x86: bpf_jit_comp: add vlan tag support".
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/net/bpf_jit_comp.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index bb284419b0fd..0972e91cced2 100644 --- a/arch/s390/net/bpf_jit_comp.c +++ b/arch/s390/net/bpf_jit_comp.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | #include <linux/moduleloader.h> | 8 | #include <linux/moduleloader.h> |
9 | #include <linux/netdevice.h> | 9 | #include <linux/netdevice.h> |
10 | #include <linux/if_vlan.h> | ||
10 | #include <linux/filter.h> | 11 | #include <linux/filter.h> |
11 | #include <asm/cacheflush.h> | 12 | #include <asm/cacheflush.h> |
12 | #include <asm/processor.h> | 13 | #include <asm/processor.h> |
@@ -254,6 +255,8 @@ static void bpf_jit_noleaks(struct bpf_jit *jit, struct sock_filter *filter) | |||
254 | case BPF_S_ANC_HATYPE: | 255 | case BPF_S_ANC_HATYPE: |
255 | case BPF_S_ANC_RXHASH: | 256 | case BPF_S_ANC_RXHASH: |
256 | case BPF_S_ANC_CPU: | 257 | case BPF_S_ANC_CPU: |
258 | case BPF_S_ANC_VLAN_TAG: | ||
259 | case BPF_S_ANC_VLAN_TAG_PRESENT: | ||
257 | case BPF_S_RET_K: | 260 | case BPF_S_RET_K: |
258 | /* first instruction sets A register */ | 261 | /* first instruction sets A register */ |
259 | break; | 262 | break; |
@@ -699,6 +702,24 @@ call_fn: /* lg %r1,<d(function)>(%r13) */ | |||
699 | /* l %r5,<d(rxhash)>(%r2) */ | 702 | /* l %r5,<d(rxhash)>(%r2) */ |
700 | EMIT4_DISP(0x58502000, offsetof(struct sk_buff, rxhash)); | 703 | EMIT4_DISP(0x58502000, offsetof(struct sk_buff, rxhash)); |
701 | break; | 704 | break; |
705 | case BPF_S_ANC_VLAN_TAG: | ||
706 | case BPF_S_ANC_VLAN_TAG_PRESENT: | ||
707 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2); | ||
708 | BUILD_BUG_ON(VLAN_TAG_PRESENT != 0x1000); | ||
709 | /* lhi %r5,0 */ | ||
710 | EMIT4(0xa7580000); | ||
711 | /* icm %r5,3,<d(vlan_tci)>(%r2) */ | ||
712 | EMIT4_DISP(0xbf532000, offsetof(struct sk_buff, vlan_tci)); | ||
713 | if (filter->code == BPF_S_ANC_VLAN_TAG) { | ||
714 | /* nill %r5,0xefff */ | ||
715 | EMIT4_IMM(0xa5570000, ~VLAN_TAG_PRESENT); | ||
716 | } else { | ||
717 | /* nill %r5,0x1000 */ | ||
718 | EMIT4_IMM(0xa5570000, VLAN_TAG_PRESENT); | ||
719 | /* srl %r5,12 */ | ||
720 | EMIT4_DISP(0x88500000, 12); | ||
721 | } | ||
722 | break; | ||
702 | case BPF_S_ANC_CPU: /* A = smp_processor_id() */ | 723 | case BPF_S_ANC_CPU: /* A = smp_processor_id() */ |
703 | #ifdef CONFIG_SMP | 724 | #ifdef CONFIG_SMP |
704 | /* l %r5,<d(cpu_nr)> */ | 725 | /* l %r5,<d(cpu_nr)> */ |