diff options
author | Daniel Borkmann <dxchgb@gmail.com> | 2012-11-07 10:31:02 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-13 18:21:10 -0500 |
commit | bf0098f22ca7b59e8844ac6882bbae230d34b98d (patch) | |
tree | 49fae869dbfb6fd61f989faca3c54431df258958 | |
parent | 3cbe20412ef4656169e09ea40ec47f973ad99a92 (diff) |
ARM: net: bpf_jit_32: add VLAN instructions for BPF JIT
This patch is a follow-up for patch "net: filter: add vlan tag access"
to support the new VLAN_TAG/VLAN_TAG_PRESENT accessors in BPF JIT.
Signed-off-by: Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch>
Cc: Mircea Gherzan <mgherzan@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mircea Gherzan <mgherzan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/arm/net/bpf_jit_32.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c index 8be702de34f9..9af9a690dbda 100644 --- a/arch/arm/net/bpf_jit_32.c +++ b/arch/arm/net/bpf_jit_32.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/netdevice.h> | 16 | #include <linux/netdevice.h> |
17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/if_vlan.h> | ||
19 | #include <asm/cacheflush.h> | 20 | #include <asm/cacheflush.h> |
20 | #include <asm/hwcap.h> | 21 | #include <asm/hwcap.h> |
21 | 22 | ||
@@ -168,6 +169,8 @@ static inline bool is_load_to_a(u16 inst) | |||
168 | case BPF_S_ANC_MARK: | 169 | case BPF_S_ANC_MARK: |
169 | case BPF_S_ANC_PROTOCOL: | 170 | case BPF_S_ANC_PROTOCOL: |
170 | case BPF_S_ANC_RXHASH: | 171 | case BPF_S_ANC_RXHASH: |
172 | case BPF_S_ANC_VLAN_TAG: | ||
173 | case BPF_S_ANC_VLAN_TAG_PRESENT: | ||
171 | case BPF_S_ANC_QUEUE: | 174 | case BPF_S_ANC_QUEUE: |
172 | return true; | 175 | return true; |
173 | default: | 176 | default: |
@@ -815,6 +818,17 @@ b_epilogue: | |||
815 | off = offsetof(struct sk_buff, rxhash); | 818 | off = offsetof(struct sk_buff, rxhash); |
816 | emit(ARM_LDR_I(r_A, r_skb, off), ctx); | 819 | emit(ARM_LDR_I(r_A, r_skb, off), ctx); |
817 | break; | 820 | break; |
821 | case BPF_S_ANC_VLAN_TAG: | ||
822 | case BPF_S_ANC_VLAN_TAG_PRESENT: | ||
823 | ctx->seen |= SEEN_SKB; | ||
824 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2); | ||
825 | off = offsetof(struct sk_buff, vlan_tci); | ||
826 | emit(ARM_LDRH_I(r_A, r_skb, off), ctx); | ||
827 | if (inst->code == BPF_S_ANC_VLAN_TAG) | ||
828 | OP_IMM3(ARM_AND, r_A, r_A, VLAN_VID_MASK, ctx); | ||
829 | else | ||
830 | OP_IMM3(ARM_AND, r_A, r_A, VLAN_TAG_PRESENT, ctx); | ||
831 | break; | ||
818 | case BPF_S_ANC_QUEUE: | 832 | case BPF_S_ANC_QUEUE: |
819 | ctx->seen |= SEEN_SKB; | 833 | ctx->seen |= SEEN_SKB; |
820 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, | 834 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, |