aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/net/bpf_jit.h
diff options
context:
space:
mode:
authorDenis Kirjanov <kda@linux-powerpc.org>2015-02-17 10:04:42 +0300
committerDavid S. Miller <davem@davemloft.net>2015-02-20 15:19:43 -0500
commit022909482d1c97c0b70438f2727a4f286ef0d289 (patch)
treeeac6551ab43c924925e02057c4f9b413a88d214a /arch/powerpc/net/bpf_jit.h
parentppc: bpf: rename bpf_jit_64.S to bpf_jit_asm.S (diff)
downloadlinux-dev-022909482d1c97c0b70438f2727a4f286ef0d289.tar.xz
linux-dev-022909482d1c97c0b70438f2727a4f286ef0d289.zip
ppc: bpf: Add SKF_AD_CPU for ppc32
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/powerpc/net/bpf_jit.h')
-rw-r--r--arch/powerpc/net/bpf_jit.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
index 2d5e71577210..889fd199a821 100644
--- a/arch/powerpc/net/bpf_jit.h
+++ b/arch/powerpc/net/bpf_jit.h
@@ -154,6 +154,23 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
#define PPC_LL_OFFS(r, base, i) do { PPC_LWZ_OFFS(r, base, i); } while(0)
#endif
+#ifdef CONFIG_SMP
+#ifdef CONFIG_PPC64
+#define PPC_BPF_LOAD_CPU(r) \
+ do { BUILD_BUG_ON(FIELD_SIZEOF(struct paca_struct, paca_index) != 2); \
+ PPC_LHZ_OFFS(r, 13, offsetof(struct paca_struct, paca_index)); \
+ } while (0)
+#else
+#define PPC_BPF_LOAD_CPU(r) \
+ do { BUILD_BUG_ON(FIELD_SIZEOF(struct thread_info, cpu) != 4); \
+ PPC_LHZ_OFFS(r, (1 & ~(THREAD_SIZE - 1)), \
+ offsetof(struct thread_info, cpu)); \
+ } while(0)
+#endif
+#else
+#define PPC_BPF_LOAD_CPU(r) do { PPC_LI(r, 0); } while(0)
+#endif
+
#define PPC_CMPWI(a, i) EMIT(PPC_INST_CMPWI | ___PPC_RA(a) | IMM_L(i))
#define PPC_CMPDI(a, i) EMIT(PPC_INST_CMPDI | ___PPC_RA(a) | IMM_L(i))
#define PPC_CMPLWI(a, i) EMIT(PPC_INST_CMPLWI | ___PPC_RA(a) | IMM_L(i))