Commit 7ca1faa5 authored by Jiong Wang's avatar Jiong Wang Committed by Greg Kroah-Hartman

nfp: bpf: fix code-gen bug on BPF_ALU | BPF_XOR | BPF_K

[ Upstream commit 71c19024 ]

The intended optimization should be A ^ 0 = A, not A ^ -1 = A.

Fixes: cd7df56e ("nfp: add BPF to NFP code translator")
Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarJiong Wang <jiong.wang@netronome.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 4523507c
...@@ -2306,7 +2306,7 @@ static int xor_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta) ...@@ -2306,7 +2306,7 @@ static int xor_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
static int xor_imm(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta) static int xor_imm(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
{ {
return wrp_alu32_imm(nfp_prog, meta, ALU_OP_XOR, !~meta->insn.imm); return wrp_alu32_imm(nfp_prog, meta, ALU_OP_XOR, !meta->insn.imm);
} }
static int and_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta) static int and_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment