aboutsummaryrefslogtreecommitdiffstats
path: root/tools/bpf/bpftool/prog.c
diff options
context:
space:
mode:
authorJiong Wang <jiong.wang@netronome.com>2018-01-16 19:05:21 -0500
committerDaniel Borkmann <daniel@iogearbox.net>2018-01-17 19:26:15 -0500
commite65935969d0fac9df28d9c49bdbab5d8d8286a20 (patch)
tree173640edb8a446423ab1dd4e00add1c782c17048 /tools/bpf/bpftool/prog.c
parenteb1d7db927a9653f1402473c777839e0456a7836 (diff)
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/prog.c')
-rw-r--r--tools/bpf/bpftool/prog.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index 099e21cf1b5c..e8e2baaf93c2 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -776,7 +776,17 @@ static int do_dump(int argc, char **argv)
776 } 776 }
777 } else { 777 } else {
778 if (member_len == &info.jited_prog_len) { 778 if (member_len == &info.jited_prog_len) {
779 disasm_print_insn(buf, *member_len, opcodes); 779 const char *name = NULL;
780
781 if (info.ifindex) {
782 name = ifindex_to_bfd_name_ns(info.ifindex,
783 info.netns_dev,
784 info.netns_ino);
785 if (!name)
786 goto err_free;
787 }
788
789 disasm_print_insn(buf, *member_len, opcodes, name);
780 } else { 790 } else {
781 kernel_syms_load(&dd); 791 kernel_syms_load(&dd);
782 if (json_output) 792 if (json_output)