diff options
| author | Markos Chandras <markos.chandras@imgtec.com> | 2015-06-04 06:56:12 -0400 |
|---|---|---|
| committer | Ralf Baechle <ralf@linux-mips.org> | 2015-06-21 15:54:23 -0400 |
| commit | 5e0c5610ea9debc019b631b022529c8cf1d225bd (patch) | |
| tree | c1623b39b5c25892ce70ec9e95dbb3e2d894db91 /arch/mips/net | |
| parent | ad152bd69823fbca63fff9ac3fbe448251eef11b (diff) | |
MIPS: net: BPF: Replace RSIZE with SZREG
The RSZIE was used to determine the register width but MIPS
already defines SZREG so use that instead.
Cc: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Daniel Borkmann <dborkman@redhat.com>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: netdev@vger.kernel.org
Patchwork: http://patchwork.linux-mips.org/patch/10526/
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/net')
| -rw-r--r-- | arch/mips/net/bpf_jit.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c index 73a473c5bdd6..84cd09ba230a 100644 --- a/arch/mips/net/bpf_jit.c +++ b/arch/mips/net/bpf_jit.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/string.h> | 20 | #include <linux/string.h> |
| 21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
| 22 | #include <linux/types.h> | 22 | #include <linux/types.h> |
| 23 | #include <asm/asm.h> | ||
| 23 | #include <asm/bitops.h> | 24 | #include <asm/bitops.h> |
| 24 | #include <asm/cacheflush.h> | 25 | #include <asm/cacheflush.h> |
| 25 | #include <asm/cpu-features.h> | 26 | #include <asm/cpu-features.h> |
| @@ -60,7 +61,6 @@ | |||
| 60 | * ---------------------------------------------------- | 61 | * ---------------------------------------------------- |
| 61 | */ | 62 | */ |
| 62 | 63 | ||
| 63 | #define RSIZE (sizeof(unsigned long)) | ||
| 64 | #define ptr typeof(unsigned long) | 64 | #define ptr typeof(unsigned long) |
| 65 | 65 | ||
| 66 | /* ABI specific return values */ | 66 | /* ABI specific return values */ |
| @@ -576,12 +576,12 @@ static void save_bpf_jit_regs(struct jit_ctx *ctx, unsigned offset) | |||
| 576 | /* Argument save area */ | 576 | /* Argument save area */ |
| 577 | if (config_enabled(CONFIG_64BIT)) | 577 | if (config_enabled(CONFIG_64BIT)) |
| 578 | /* Bottom of current frame */ | 578 | /* Bottom of current frame */ |
| 579 | real_off = align_sp(offset) - RSIZE; | 579 | real_off = align_sp(offset) - SZREG; |
| 580 | else | 580 | else |
| 581 | /* Top of previous frame */ | 581 | /* Top of previous frame */ |
| 582 | real_off = align_sp(offset) + RSIZE; | 582 | real_off = align_sp(offset) + SZREG; |
| 583 | emit_store_stack_reg(MIPS_R_A0, r_sp, real_off, ctx); | 583 | emit_store_stack_reg(MIPS_R_A0, r_sp, real_off, ctx); |
| 584 | emit_store_stack_reg(MIPS_R_A1, r_sp, real_off + RSIZE, ctx); | 584 | emit_store_stack_reg(MIPS_R_A1, r_sp, real_off + SZREG, ctx); |
| 585 | 585 | ||
| 586 | real_off = 0; | 586 | real_off = 0; |
| 587 | } | 587 | } |
| @@ -592,7 +592,7 @@ static void save_bpf_jit_regs(struct jit_ctx *ctx, unsigned offset) | |||
| 592 | if ((sflags >> i) & 0x1) { | 592 | if ((sflags >> i) & 0x1) { |
| 593 | emit_store_stack_reg(MIPS_R_S0 + i, r_sp, real_off, | 593 | emit_store_stack_reg(MIPS_R_S0 + i, r_sp, real_off, |
| 594 | ctx); | 594 | ctx); |
| 595 | real_off += RSIZE; | 595 | real_off += SZREG; |
| 596 | } | 596 | } |
| 597 | i++; | 597 | i++; |
| 598 | tmp_flags >>= 1; | 598 | tmp_flags >>= 1; |
| @@ -601,13 +601,13 @@ static void save_bpf_jit_regs(struct jit_ctx *ctx, unsigned offset) | |||
| 601 | /* save return address */ | 601 | /* save return address */ |
| 602 | if (ctx->flags & SEEN_CALL) { | 602 | if (ctx->flags & SEEN_CALL) { |
| 603 | emit_store_stack_reg(r_ra, r_sp, real_off, ctx); | 603 | emit_store_stack_reg(r_ra, r_sp, real_off, ctx); |
| 604 | real_off += RSIZE; | 604 | real_off += SZREG; |
| 605 | } | 605 | } |
| 606 | 606 | ||
| 607 | /* Setup r_M leaving the alignment gap if necessary */ | 607 | /* Setup r_M leaving the alignment gap if necessary */ |
| 608 | if (ctx->flags & SEEN_MEM) { | 608 | if (ctx->flags & SEEN_MEM) { |
| 609 | if (real_off % (RSIZE * 2)) | 609 | if (real_off % (SZREG * 2)) |
| 610 | real_off += RSIZE; | 610 | real_off += SZREG; |
| 611 | emit_long_instr(ctx, ADDIU, r_M, r_sp, real_off); | 611 | emit_long_instr(ctx, ADDIU, r_M, r_sp, real_off); |
| 612 | } | 612 | } |
| 613 | } | 613 | } |
| @@ -621,12 +621,12 @@ static void restore_bpf_jit_regs(struct jit_ctx *ctx, | |||
| 621 | if (ctx->flags & SEEN_CALL) { | 621 | if (ctx->flags & SEEN_CALL) { |
| 622 | if (config_enabled(CONFIG_64BIT)) | 622 | if (config_enabled(CONFIG_64BIT)) |
| 623 | /* Bottom of current frame */ | 623 | /* Bottom of current frame */ |
| 624 | real_off = align_sp(offset) - RSIZE; | 624 | real_off = align_sp(offset) - SZREG; |
| 625 | else | 625 | else |
| 626 | /* Top of previous frame */ | 626 | /* Top of previous frame */ |
| 627 | real_off = align_sp(offset) + RSIZE; | 627 | real_off = align_sp(offset) + SZREG; |
| 628 | emit_load_stack_reg(MIPS_R_A0, r_sp, real_off, ctx); | 628 | emit_load_stack_reg(MIPS_R_A0, r_sp, real_off, ctx); |
| 629 | emit_load_stack_reg(MIPS_R_A1, r_sp, real_off + RSIZE, ctx); | 629 | emit_load_stack_reg(MIPS_R_A1, r_sp, real_off + SZREG, ctx); |
| 630 | 630 | ||
| 631 | real_off = 0; | 631 | real_off = 0; |
| 632 | } | 632 | } |
| @@ -638,7 +638,7 @@ static void restore_bpf_jit_regs(struct jit_ctx *ctx, | |||
| 638 | if ((sflags >> i) & 0x1) { | 638 | if ((sflags >> i) & 0x1) { |
| 639 | emit_load_stack_reg(MIPS_R_S0 + i, r_sp, real_off, | 639 | emit_load_stack_reg(MIPS_R_S0 + i, r_sp, real_off, |
| 640 | ctx); | 640 | ctx); |
| 641 | real_off += RSIZE; | 641 | real_off += SZREG; |
| 642 | } | 642 | } |
| 643 | i++; | 643 | i++; |
| 644 | tmp_flags >>= 1; | 644 | tmp_flags >>= 1; |
| @@ -658,7 +658,7 @@ static unsigned int get_stack_depth(struct jit_ctx *ctx) | |||
| 658 | 658 | ||
| 659 | 659 | ||
| 660 | /* How may s* regs do we need to preserved? */ | 660 | /* How may s* regs do we need to preserved? */ |
| 661 | sp_off += hweight32(ctx->flags >> SEEN_SREG_SFT) * RSIZE; | 661 | sp_off += hweight32(ctx->flags >> SEEN_SREG_SFT) * SZREG; |
| 662 | 662 | ||
| 663 | if (ctx->flags & SEEN_MEM) | 663 | if (ctx->flags & SEEN_MEM) |
| 664 | sp_off += 4 * BPF_MEMWORDS; /* BPF_MEMWORDS are 32-bit */ | 664 | sp_off += 4 * BPF_MEMWORDS; /* BPF_MEMWORDS are 32-bit */ |
| @@ -674,7 +674,7 @@ static unsigned int get_stack_depth(struct jit_ctx *ctx) | |||
| 674 | * this space ourselves. We need to preserve $ra as well. | 674 | * this space ourselves. We need to preserve $ra as well. |
| 675 | */ | 675 | */ |
| 676 | sp_off += config_enabled(CONFIG_64BIT) ? | 676 | sp_off += config_enabled(CONFIG_64BIT) ? |
| 677 | (ARGS_USED_BY_JIT + 1) * RSIZE : RSIZE; | 677 | (ARGS_USED_BY_JIT + 1) * SZREG : SZREG; |
| 678 | 678 | ||
| 679 | return sp_off; | 679 | return sp_off; |
| 680 | } | 680 | } |
