mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-13 22:25:03 +00:00
nfp: bpf: byte swap the instructions
Device expects the instructions in little endian. Make sure we byte swap on big endian hosts. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1c03e03f9b
commit
2e85d3884f
1 changed files with 4 additions and 2 deletions
|
@ -1725,7 +1725,7 @@ static int nfp_bpf_optimize(struct nfp_prog *nfp_prog)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nfp_bpf_ustore_calc(struct nfp_prog *nfp_prog)
|
static int nfp_bpf_ustore_calc(struct nfp_prog *nfp_prog, __le64 *ustore)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -1737,6 +1737,8 @@ static int nfp_bpf_ustore_calc(struct nfp_prog *nfp_prog)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
nfp_prog->prog[i] = nfp_ustore_calc_ecc_insn(nfp_prog->prog[i]);
|
nfp_prog->prog[i] = nfp_ustore_calc_ecc_insn(nfp_prog->prog[i]);
|
||||||
|
|
||||||
|
ustore[i] = cpu_to_le64(nfp_prog->prog[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1796,7 +1798,7 @@ nfp_bpf_jit(struct bpf_prog *filter, void *prog_mem,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = nfp_bpf_ustore_calc(nfp_prog);
|
ret = nfp_bpf_ustore_calc(nfp_prog, (__force __le64 *)prog_mem);
|
||||||
|
|
||||||
res->n_instr = nfp_prog->prog_len;
|
res->n_instr = nfp_prog->prog_len;
|
||||||
res->dense_mode = false;
|
res->dense_mode = false;
|
||||||
|
|
Loading…
Reference in a new issue