aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/net
diff options
context:
space:
mode:
authorMichael Holzheu <holzheu@linux.vnet.ibm.com>2015-07-29 15:15:16 -0400
committerDavid S. Miller <davem@davemloft.net>2015-07-29 17:59:58 -0400
commitce2b6ad9c1856fac5d5e8d3351b3dd5392e09b7a (patch)
tree5968043c4caa954889e0e343cb6fc02c1a485d15 /arch/s390/net
parent1df03ffdded54fbb6507ef494ece071f3501410e (diff)
s390/bpf: increase BPF_SIZE_MAX
Currently we have the restriction that jitted BPF programs can have a maximum size of one page. The reason is that we use short displacements for the literal pool. The 20 bit displacements are available since z990 and BPF requires z196 as minimum. Therefore we can remove this restriction and use everywhere 20 bit signed long displacements. Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/s390/net')
-rw-r--r--arch/s390/net/bpf_jit_comp.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index 66926ab244c1..04af36728a18 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -45,7 +45,7 @@ struct bpf_jit {
45 int labels[1]; /* Labels for local jumps */ 45 int labels[1]; /* Labels for local jumps */
46}; 46};
47 47
48#define BPF_SIZE_MAX 4096 /* Max size for program */ 48#define BPF_SIZE_MAX 0x7ffff /* Max size for program (20 bit signed displ) */
49 49
50#define SEEN_SKB 1 /* skb access */ 50#define SEEN_SKB 1 /* skb access */
51#define SEEN_MEM 2 /* use mem[] for temporary storage */ 51#define SEEN_MEM 2 /* use mem[] for temporary storage */
@@ -203,15 +203,6 @@ static inline void reg_set_seen(struct bpf_jit *jit, u32 b1)
203 _EMIT6(op1 | __disp, op2); \ 203 _EMIT6(op1 | __disp, op2); \
204}) 204})
205 205
206#define EMIT6_DISP(op1, op2, b1, b2, b3, disp) \
207({ \
208 _EMIT6_DISP(op1 | reg(b1, b2) << 16 | \
209 reg_high(b3) << 8, op2, disp); \
210 REG_SET_SEEN(b1); \
211 REG_SET_SEEN(b2); \
212 REG_SET_SEEN(b3); \
213})
214
215#define _EMIT6_DISP_LH(op1, op2, disp) \ 206#define _EMIT6_DISP_LH(op1, op2, disp) \
216({ \ 207({ \
217 u32 _disp = (u32) disp; \ 208 u32 _disp = (u32) disp; \
@@ -981,8 +972,8 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
981 REG_SET_SEEN(BPF_REG_5); 972 REG_SET_SEEN(BPF_REG_5);
982 jit->seen |= SEEN_FUNC; 973 jit->seen |= SEEN_FUNC;
983 /* lg %w1,<d(imm)>(%l) */ 974 /* lg %w1,<d(imm)>(%l) */
984 EMIT6_DISP(0xe3000000, 0x0004, REG_W1, REG_0, REG_L, 975 EMIT6_DISP_LH(0xe3000000, 0x0004, REG_W1, REG_0, REG_L,
985 EMIT_CONST_U64(func)); 976 EMIT_CONST_U64(func));
986 /* basr %r14,%w1 */ 977 /* basr %r14,%w1 */
987 EMIT2(0x0d00, REG_14, REG_W1); 978 EMIT2(0x0d00, REG_14, REG_W1);
988 /* lgr %b0,%r2: load return value into %b0 */ 979 /* lgr %b0,%r2: load return value into %b0 */