tools: bpftool: mark offloaded programs more explicitly in plain output
authorQuentin Monnet <[email protected]>
Fri, 30 Nov 2018 16:25:47 +0000 (16:25 +0000)
committerAlexei Starovoitov <[email protected]>
Fri, 30 Nov 2018 22:06:06 +0000 (14:06 -0800)
In bpftool (plain) output for "bpftool prog show" or "bpftool map show",
an offloaded BPF object is simply denoted with "dev ifname", which is
not really explicit. Change it with something that clearly shows the
program is offloaded.

While at it also add an additional space, as done between other
information fields.

Example output, before:

    # bpftool prog show
    1337: xdp  tag a04f5eef06a7f555 dev foo
            loaded_at 2018-10-19T16:40:36+0100  uid 0
            xlated 16B  not jited  memlock 4096B

After:

    # bpftool prog show
    1337: xdp  tag a04f5eef06a7f555  offloaded_to foo
            loaded_at 2018-10-19T16:40:36+0100  uid 0
            xlated 16B  not jited  memlock 4096B

Suggested-by: Daniel Borkmann <[email protected]>
Signed-off-by: Quentin Monnet <[email protected]>
Acked-by: Jakub Kicinski <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
tools/bpf/bpftool/common.c

index 4349b6683ca85ff0f939e50df3f410f0f0e86e2a..172d3761d9abe18d80cd219aab2d5d0ac821495b 100644 (file)
@@ -604,7 +604,7 @@ void print_dev_plain(__u32 ifindex, __u64 ns_dev, __u64 ns_inode)
        if (!ifindex)
                return;
 
-       printf(" dev ");
+       printf("  offloaded_to ");
        if (ifindex_to_name_ns(ifindex, ns_dev, ns_inode, name))
                printf("%s", name);
        else