tools: bpftool: improve architecture detection by using ifindex
authorJiong Wang <jiong.wang@netronome.com>
Wed, 17 Jan 2018 00:05:21 +0000 (16:05 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 18 Jan 2018 00:26:15 +0000 (01:26 +0100)
commite65935969d0fac9df28d9c49bdbab5d8d8286a20
tree173640edb8a446423ab1dd4e00add1c782c17048
parenteb1d7db927a9653f1402473c777839e0456a7836
tools: bpftool: improve architecture detection by using ifindex

The current architecture detection method in bpftool is designed for host
case.

For offload case, we can't use the architecture of "bpftool" itself.
Instead, we could call the existing "ifindex_to_name_ns" to get DEVNAME,
then read pci id from /sys/class/dev/DEVNAME/device/vendor, finally we map
vendor id to bfd arch name which will finally be used to select bfd backend
for the disassembler.

Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/bpf/bpftool/common.c
tools/bpf/bpftool/jit_disasm.c
tools/bpf/bpftool/main.h
tools/bpf/bpftool/prog.c