aboutsummaryrefslogtreecommitdiff
path: root/tools/bpf/bpftool/prog.c
diff options
context:
space:
mode:
authorJiong Wang <jiong.wang@netronome.com>2018-07-06 15:13:22 -0700
committerDaniel Borkmann <daniel@iogearbox.net>2018-07-07 01:45:31 +0200
commit2a952b03d1a011e2e7ddc9ca59cbb21df7dc3525 (patch)
tree65fec3490f3538a15d1f35a89a806aec9cbe495b /tools/bpf/bpftool/prog.c
parentd3d23fdb4688de4421e94227c95b1d54b233f432 (diff)
downloadlinux-2a952b03d1a011e2e7ddc9ca59cbb21df7dc3525.tar.gz
linux-2a952b03d1a011e2e7ddc9ca59cbb21df7dc3525.tar.bz2
linux-2a952b03d1a011e2e7ddc9ca59cbb21df7dc3525.zip
nfp: bpf: support u32 divide using reciprocal_div.h
NFP doesn't have integer divide instruction, this patch use reciprocal algorithm (the basic one, reciprocal_div) to emulate it. For each u32 divide, we would need 11 instructions to finish the operation. 7 (for multiplication) + 4 (various ALUs) = 11 Given NFP only supports multiplication no bigger than u32, we'd require divisor and dividend no bigger than that as well. Also eBPF doesn't support signed divide and has enforced this on C language level by failing compilation. However LLVM assembler hasn't enforced this, so it is possible for negative constant to leak in as a BPF_K operand through assembly code, we reject such cases as well. Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com> Acked-by: Song Liu <songliubraving@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/bpf/bpftool/prog.c')
0 files changed, 0 insertions, 0 deletions