Skip to content

Commit

Permalink
LoongArch: BPF: Support unconditional bswap instructions
Browse files Browse the repository at this point in the history
Add support for unconditional bswap instruction. Since LoongArch is
always little-endian, just treat unconditional bswap the same as big-
endian conversion.

Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
  • Loading branch information
chenhengqi authored and chenhuacai committed Nov 8, 2023
1 parent f48012f commit 4ebf921
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions arch/loongarch/net/bpf_jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext
break;

case BPF_ALU | BPF_END | BPF_FROM_BE:
case BPF_ALU64 | BPF_END | BPF_FROM_LE:
switch (imm) {
case 16:
emit_insn(ctx, revb2h, dst, dst);
Expand Down

0 comments on commit 4ebf921

Please sign in to comment.