• Quentin Monnet's avatar
    tools: bpftool: add basic probe capability, probe syscall availability · 49eb7ab3
    Quentin Monnet authored
    Add a new component and command for bpftool, in order to probe the
    system to dump a set of eBPF-related parameters so that users can know
    what features are available on the system.
    
    Parameters are dumped in plain or JSON output (with -j/-p options).
    
    The current patch introduces probing of one simple parameter:
    availability of the bpf() system call. Later commits
    will add other probes.
    
    Sample output:
    
        # bpftool feature probe kernel
        Scanning system call availability...
        bpf() syscall is available
    
        # bpftool --json --pretty feature probe kernel
        {
            "syscall_config": {
                "have_bpf_syscall": true
            }
        }
    
    The optional "kernel" keyword enforces probing of the current system,
    which is the only possible behaviour at this stage. It can be safely
    omitted.
    
    The feature comes with the relevant man page, but bash completion will
    come in a dedicated commit.
    
    v3:
    - Do not probe kernel version. Contrarily to what is written below for
      v2, we can have the kernel version retrieved in libbpf instead of
      bpftool (in the patch adding probing for program types).
    
    v2:
    - Remove C-style macros output from this patch.
    - Even though kernel version is no longer needed for testing kprobes
      availability, note that we still collect it in this patch so that
      bpftool gets able to probe (in next patches) older kernels as well.
    Signed-off-by: default avatarQuentin Monnet <quentin.monnet@netronome.com>
    Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
    Reviewed-by: default avatarStanislav Fomichev <sdf@google.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    49eb7ab3
bpftool-net.rst 4.52 KB