diff options
author | Jiong Wang <jiong.wang@netronome.com> | 2018-01-17 01:05:21 +0100 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-01-18 01:26:15 +0100 |
commit | e65935969d0fac9df28d9c49bdbab5d8d8286a20 (patch) | |
tree | 173640edb8a446423ab1dd4e00add1c782c17048 /tools/bpf/bpftool/main.h | |
parent | nfp: bpf: set new jit info fields (diff) | |
download | linux-e65935969d0fac9df28d9c49bdbab5d8d8286a20.tar.xz linux-e65935969d0fac9df28d9c49bdbab5d8d8286a20.zip |
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>
Diffstat (limited to 'tools/bpf/bpftool/main.h')
-rw-r--r-- | tools/bpf/bpftool/main.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/bpf/bpftool/main.h b/tools/bpf/bpftool/main.h index 65b526fe6e7e..b8e9584d6246 100644 --- a/tools/bpf/bpftool/main.h +++ b/tools/bpf/bpftool/main.h @@ -121,7 +121,10 @@ int do_cgroup(int argc, char **arg); int prog_parse_fd(int *argc, char ***argv); -void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes); +void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes, + const char *arch); void print_hex_data_json(uint8_t *data, size_t len); +const char *ifindex_to_bfd_name_ns(__u32 ifindex, __u64 ns_dev, __u64 ns_ino); + #endif |