aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/net/bpf_jit_comp.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/net/bpf_jit_comp.c')
-rw-r--r--arch/powerpc/net/bpf_jit_comp.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index dd1130642d07..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:
@@ -232,6 +236,17 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
232 if (K >= 65536) 236 if (K >= 65536)
233 PPC_ORIS(r_A, r_A, IMM_H(K)); 237 PPC_ORIS(r_A, r_A, IMM_H(K));
234 break; 238 break;
239 case BPF_S_ANC_ALU_XOR_X:
240 case BPF_S_ALU_XOR_X: /* A ^= X */
241 ctx->seen |= SEEN_XREG;
242 PPC_XOR(r_A, r_A, r_X);
243 break;
244 case BPF_S_ALU_XOR_K: /* A ^= K */
245 if (IMM_L(K))
246 PPC_XORI(r_A, r_A, IMM_L(K));
247 if (K >= 65536)
248 PPC_XORIS(r_A, r_A, IMM_H(K));
249 break;
235 case BPF_S_ALU_LSH_X: /* A <<= X; */ 250 case BPF_S_ALU_LSH_X: /* A <<= X; */
236 ctx->seen |= SEEN_XREG; 251 ctx->seen |= SEEN_XREG;
237 PPC_SLW(r_A, r_A, r_X); 252 PPC_SLW(r_A, r_A, r_X);
@@ -371,6 +386,16 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
371 PPC_LWZ_OFFS(r_A, r_skb, offsetof(struct sk_buff, 386 PPC_LWZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
372 rxhash)); 387 rxhash));
373 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;
374 case BPF_S_ANC_QUEUE: 399 case BPF_S_ANC_QUEUE:
375 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, 400 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
376 queue_mapping) != 2); 401 queue_mapping) != 2);