diff options
author | Jiong Wang <jiong.wang@netronome.com> | 2018-12-05 13:52:30 -0500 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2018-12-07 16:30:48 -0500 |
commit | ee94b90c8acaa593b627f5f3fe93e076e7779f5c (patch) | |
tree | 4448eaaafbb857abc286215b121f37ed7656aefb /arch/mips/net | |
parent | 17f6c83fb5ebf7db4fcc94a5be4c22d5a7bfe428 (diff) |
mips: bpf: implement jitting of BPF_ALU | BPF_ARSH | BPF_X
Jitting of BPF_K is supported already, but not BPF_X. This patch complete
the support for the latter on both MIPS and microMIPS.
Cc: Paul Burton <paul.burton@mips.com>
Cc: linux-mips@vger.kernel.org
Acked-by: Paul Burton <paul.burton@mips.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'arch/mips/net')
-rw-r--r-- | arch/mips/net/ebpf_jit.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/mips/net/ebpf_jit.c b/arch/mips/net/ebpf_jit.c index aeb7b1b0f202..b16710a8a9e7 100644 --- a/arch/mips/net/ebpf_jit.c +++ b/arch/mips/net/ebpf_jit.c | |||
@@ -854,6 +854,7 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, | |||
854 | case BPF_ALU | BPF_MOD | BPF_X: /* ALU_REG */ | 854 | case BPF_ALU | BPF_MOD | BPF_X: /* ALU_REG */ |
855 | case BPF_ALU | BPF_LSH | BPF_X: /* ALU_REG */ | 855 | case BPF_ALU | BPF_LSH | BPF_X: /* ALU_REG */ |
856 | case BPF_ALU | BPF_RSH | BPF_X: /* ALU_REG */ | 856 | case BPF_ALU | BPF_RSH | BPF_X: /* ALU_REG */ |
857 | case BPF_ALU | BPF_ARSH | BPF_X: /* ALU_REG */ | ||
857 | src = ebpf_to_mips_reg(ctx, insn, src_reg_no_fp); | 858 | src = ebpf_to_mips_reg(ctx, insn, src_reg_no_fp); |
858 | dst = ebpf_to_mips_reg(ctx, insn, dst_reg); | 859 | dst = ebpf_to_mips_reg(ctx, insn, dst_reg); |
859 | if (src < 0 || dst < 0) | 860 | if (src < 0 || dst < 0) |
@@ -913,6 +914,9 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, | |||
913 | case BPF_RSH: | 914 | case BPF_RSH: |
914 | emit_instr(ctx, srlv, dst, dst, src); | 915 | emit_instr(ctx, srlv, dst, dst, src); |
915 | break; | 916 | break; |
917 | case BPF_ARSH: | ||
918 | emit_instr(ctx, srav, dst, dst, src); | ||
919 | break; | ||
916 | default: | 920 | default: |
917 | pr_err("ALU_REG NOT HANDLED\n"); | 921 | pr_err("ALU_REG NOT HANDLED\n"); |
918 | return -EINVAL; | 922 | return -EINVAL; |