xref: /OK3568_Linux_fs/kernel/tools/bpf/bpftool/Documentation/bpftool-feature.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun===============
2*4882a593Smuzhiyunbpftool-feature
3*4882a593Smuzhiyun===============
4*4882a593Smuzhiyun-------------------------------------------------------------------------------
5*4882a593Smuzhiyuntool for inspection of eBPF-related parameters for Linux kernel or net device
6*4882a593Smuzhiyun-------------------------------------------------------------------------------
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun:Manual section: 8
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunSYNOPSIS
11*4882a593Smuzhiyun========
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun	**bpftool** [*OPTIONS*] **feature** *COMMAND*
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun	*OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] }
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun	*COMMANDS* := { **probe** | **help** }
18*4882a593Smuzhiyun
19*4882a593SmuzhiyunFEATURE COMMANDS
20*4882a593Smuzhiyun================
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun|	**bpftool** **feature probe** [*COMPONENT*] [**full**] [**unprivileged**] [**macros** [**prefix** *PREFIX*]]
23*4882a593Smuzhiyun|	**bpftool** **feature help**
24*4882a593Smuzhiyun|
25*4882a593Smuzhiyun|	*COMPONENT* := { **kernel** | **dev** *NAME* }
26*4882a593Smuzhiyun
27*4882a593SmuzhiyunDESCRIPTION
28*4882a593Smuzhiyun===========
29*4882a593Smuzhiyun	**bpftool feature probe** [**kernel**] [**full**] [**macros** [**prefix** *PREFIX*]]
30*4882a593Smuzhiyun		  Probe the running kernel and dump a number of eBPF-related
31*4882a593Smuzhiyun		  parameters, such as availability of the **bpf**\ () system call,
32*4882a593Smuzhiyun		  JIT status, eBPF program types availability, eBPF helper
33*4882a593Smuzhiyun		  functions availability, and more.
34*4882a593Smuzhiyun
35*4882a593Smuzhiyun		  By default, bpftool **does not run probes** for
36*4882a593Smuzhiyun		  **bpf_probe_write_user**\ () and **bpf_trace_printk**\()
37*4882a593Smuzhiyun		  helpers which print warnings to kernel logs. To enable them
38*4882a593Smuzhiyun		  and run all probes, the **full** keyword should be used.
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun		  If the **macros** keyword (but not the **-j** option) is
41*4882a593Smuzhiyun		  passed, a subset of the output is dumped as a list of
42*4882a593Smuzhiyun		  **#define** macros that are ready to be included in a C
43*4882a593Smuzhiyun		  header file, for example. If, additionally, **prefix** is
44*4882a593Smuzhiyun		  used to define a *PREFIX*, the provided string will be used
45*4882a593Smuzhiyun		  as a prefix to the names of the macros: this can be used to
46*4882a593Smuzhiyun		  avoid conflicts on macro names when including the output of
47*4882a593Smuzhiyun		  this command as a header file.
48*4882a593Smuzhiyun
49*4882a593Smuzhiyun		  Keyword **kernel** can be omitted. If no probe target is
50*4882a593Smuzhiyun		  specified, probing the kernel is the default behaviour.
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun		  When the **unprivileged** keyword is used, bpftool will dump
53*4882a593Smuzhiyun		  only the features available to a user who does not have the
54*4882a593Smuzhiyun		  **CAP_SYS_ADMIN** capability set. The features available in
55*4882a593Smuzhiyun		  that case usually represent a small subset of the parameters
56*4882a593Smuzhiyun		  supported by the system. Unprivileged users MUST use the
57*4882a593Smuzhiyun		  **unprivileged** keyword: This is to avoid misdetection if
58*4882a593Smuzhiyun		  bpftool is inadvertently run as non-root, for example. This
59*4882a593Smuzhiyun		  keyword is unavailable if bpftool was compiled without
60*4882a593Smuzhiyun		  libcap.
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun	**bpftool feature probe dev** *NAME* [**full**] [**macros** [**prefix** *PREFIX*]]
63*4882a593Smuzhiyun		  Probe network device for supported eBPF features and dump
64*4882a593Smuzhiyun		  results to the console.
65*4882a593Smuzhiyun
66*4882a593Smuzhiyun		  The keywords **full**, **macros** and **prefix** have the
67*4882a593Smuzhiyun		  same role as when probing the kernel.
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun	**bpftool feature help**
70*4882a593Smuzhiyun		  Print short help message.
71*4882a593Smuzhiyun
72*4882a593SmuzhiyunOPTIONS
73*4882a593Smuzhiyun=======
74*4882a593Smuzhiyun	.. include:: common_options.rst
75