diff options
author | Daniel Borkmann <dxchgb@gmail.com> | 2012-11-08 06:41:39 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-17 22:12:47 -0500 |
commit | 5082dfb71600b4d227c3f0af630c0cd3158e1feb (patch) | |
tree | 11568d0bb1e82b280fb2a8d9af6a63eadc81bb0d /arch | |
parent | 02871903a1fcdf306a906c38566ca0d48a45a431 (diff) |
PPC: net: bpf_jit_comp: 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: Matt Evans <matt@ozlabs.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/net/bpf_jit_comp.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c index b9434de8222b..e834f1ec23c8 100644 --- a/arch/powerpc/net/bpf_jit_comp.c +++ b/arch/powerpc/net/bpf_jit_comp.c | |||
@@ -13,6 +13,8 @@ | |||
13 | #include <asm/cacheflush.h> | 13 | #include <asm/cacheflush.h> |
14 | #include <linux/netdevice.h> | 14 | #include <linux/netdevice.h> |
15 | #include <linux/filter.h> | 15 | #include <linux/filter.h> |
16 | #include <linux/if_vlan.h> | ||
17 | |||
16 | #include "bpf_jit.h" | 18 | #include "bpf_jit.h" |
17 | 19 | ||
18 | #ifndef __BIG_ENDIAN | 20 | #ifndef __BIG_ENDIAN |
@@ -89,6 +91,8 @@ static void bpf_jit_build_prologue(struct sk_filter *fp, u32 *image, | |||
89 | case BPF_S_ANC_IFINDEX: | 91 | case BPF_S_ANC_IFINDEX: |
90 | case BPF_S_ANC_MARK: | 92 | case BPF_S_ANC_MARK: |
91 | case BPF_S_ANC_RXHASH: | 93 | case BPF_S_ANC_RXHASH: |
94 | case BPF_S_ANC_VLAN_TAG: | ||
95 | case BPF_S_ANC_VLAN_TAG_PRESENT: | ||
92 | case BPF_S_ANC_CPU: | 96 | case BPF_S_ANC_CPU: |
93 | case BPF_S_ANC_QUEUE: | 97 | case BPF_S_ANC_QUEUE: |
94 | case BPF_S_LD_W_ABS: | 98 | case BPF_S_LD_W_ABS: |
@@ -382,6 +386,16 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, | |||
382 | PPC_LWZ_OFFS(r_A, r_skb, offsetof(struct sk_buff, | 386 | PPC_LWZ_OFFS(r_A, r_skb, offsetof(struct sk_buff, |
383 | rxhash)); | 387 | rxhash)); |
384 | break; | 388 | break; |
389 | case BPF_S_ANC_VLAN_TAG: | ||
390 | case BPF_S_ANC_VLAN_TAG_PRESENT: | ||
391 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2); | ||
392 | PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff, | ||
393 | vlan_tci)); | ||
394 | if (filter[i].code == BPF_S_ANC_VLAN_TAG) | ||
395 | PPC_ANDI(r_A, r_A, VLAN_VID_MASK); | ||
396 | else | ||
397 | PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT); | ||
398 | break; | ||
385 | case BPF_S_ANC_QUEUE: | 399 | case BPF_S_ANC_QUEUE: |
386 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, | 400 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, |
387 | queue_mapping) != 2); | 401 | queue_mapping) != 2); |