s390/bpf: Implement unconditional byte swap
authorIlya Leoshkevich <iii@linux.ibm.com>
Tue, 19 Sep 2023 10:09:08 +0000 (12:09 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 21 Sep 2023 21:22:00 +0000 (14:22 -0700)
Implement the cpuv4 unconditional byte swap, which is encoded as
BPF_ALU64 | BPF_END | BPF_FROM_LE. Since s390x is big-endian, it's
the same as the existing BPF_ALU | BPF_END | BPF_FROM_LE.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Link: https://lore.kernel.org/r/20230919101336.2223655-7-iii@linux.ibm.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
arch/s390/net/bpf_jit_comp.c

index 957f5cbba4d8f8990d4539e611504c5e1e55815e..77362dc9229b017efcafa54dec850b60f04d1ca2 100644 (file)
@@ -1253,6 +1253,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp,
                }
                break;
        case BPF_ALU | BPF_END | BPF_FROM_LE:
+       case BPF_ALU64 | BPF_END | BPF_FROM_LE:
                switch (imm) {
                case 16: /* dst = (u16) cpu_to_le16(dst) */
                        /* lrvr %dst,%dst */