xref: /openbmc/linux/tools/bpf/bpftool/Documentation/bpftool-struct_ops.rst (revision 65c93628599dff4cd7cfb70130d1f6a2203731ea)
1*65c93628SMartin KaFai Lau==================
2*65c93628SMartin KaFai Laubpftool-struct_ops
3*65c93628SMartin KaFai Lau==================
4*65c93628SMartin KaFai Lau-------------------------------------------------------------------------------
5*65c93628SMartin KaFai Lautool to register/unregister/introspect BPF struct_ops
6*65c93628SMartin KaFai Lau-------------------------------------------------------------------------------
7*65c93628SMartin KaFai Lau
8*65c93628SMartin KaFai Lau:Manual section: 8
9*65c93628SMartin KaFai Lau
10*65c93628SMartin KaFai LauSYNOPSIS
11*65c93628SMartin KaFai Lau========
12*65c93628SMartin KaFai Lau
13*65c93628SMartin KaFai Lau	**bpftool** [*OPTIONS*] **struct_ops** *COMMAND*
14*65c93628SMartin KaFai Lau
15*65c93628SMartin KaFai Lau	*OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] }
16*65c93628SMartin KaFai Lau
17*65c93628SMartin KaFai Lau	*COMMANDS* :=
18*65c93628SMartin KaFai Lau	{ **show** | **list** | **dump** | **register** | **unregister** | **help** }
19*65c93628SMartin KaFai Lau
20*65c93628SMartin KaFai LauSTRUCT_OPS COMMANDS
21*65c93628SMartin KaFai Lau===================
22*65c93628SMartin KaFai Lau
23*65c93628SMartin KaFai Lau|	**bpftool** **struct_ops { show | list }** [*STRUCT_OPS_MAP*]
24*65c93628SMartin KaFai Lau|	**bpftool** **struct_ops dump** [*STRUCT_OPS_MAP*]
25*65c93628SMartin KaFai Lau|	**bpftool** **struct_ops register** *OBJ*
26*65c93628SMartin KaFai Lau|	**bpftool** **struct_ops unregister** *STRUCT_OPS_MAP*
27*65c93628SMartin KaFai Lau|	**bpftool** **struct_ops help**
28*65c93628SMartin KaFai Lau|
29*65c93628SMartin KaFai Lau|	*STRUCT_OPS_MAP* := { **id** *STRUCT_OPS_MAP_ID* | **name** *STRUCT_OPS_MAP_NAME* }
30*65c93628SMartin KaFai Lau|	*OBJ* := /a/file/of/bpf_struct_ops.o
31*65c93628SMartin KaFai Lau
32*65c93628SMartin KaFai Lau
33*65c93628SMartin KaFai LauDESCRIPTION
34*65c93628SMartin KaFai Lau===========
35*65c93628SMartin KaFai Lau	**bpftool struct_ops { show | list }** [*STRUCT_OPS_MAP*]
36*65c93628SMartin KaFai Lau		  Show brief information about the struct_ops in the system.
37*65c93628SMartin KaFai Lau		  If *STRUCT_OPS_MAP* is specified, it shows information only
38*65c93628SMartin KaFai Lau		  for the given struct_ops.  Otherwise, it lists all struct_ops
39*65c93628SMartin KaFai Lau		  currently existing in the system.
40*65c93628SMartin KaFai Lau
41*65c93628SMartin KaFai Lau		  Output will start with struct_ops map ID, followed by its map
42*65c93628SMartin KaFai Lau		  name and its struct_ops's kernel type.
43*65c93628SMartin KaFai Lau
44*65c93628SMartin KaFai Lau	**bpftool struct_ops dump** [*STRUCT_OPS_MAP*]
45*65c93628SMartin KaFai Lau		  Dump details information about the struct_ops in the system.
46*65c93628SMartin KaFai Lau		  If *STRUCT_OPS_MAP* is specified, it dumps information only
47*65c93628SMartin KaFai Lau		  for the given struct_ops.  Otherwise, it dumps all struct_ops
48*65c93628SMartin KaFai Lau		  currently existing in the system.
49*65c93628SMartin KaFai Lau
50*65c93628SMartin KaFai Lau	**bpftool struct_ops register** *OBJ*
51*65c93628SMartin KaFai Lau		  Register bpf struct_ops from *OBJ*.  All struct_ops under
52*65c93628SMartin KaFai Lau		  the ELF section ".struct_ops" will be registered to
53*65c93628SMartin KaFai Lau		  its kernel subsystem.
54*65c93628SMartin KaFai Lau
55*65c93628SMartin KaFai Lau	**bpftool struct_ops unregister**  *STRUCT_OPS_MAP*
56*65c93628SMartin KaFai Lau		  Unregister the *STRUCT_OPS_MAP* from the kernel subsystem.
57*65c93628SMartin KaFai Lau
58*65c93628SMartin KaFai Lau	**bpftool struct_ops help**
59*65c93628SMartin KaFai Lau		  Print short help message.
60*65c93628SMartin KaFai Lau
61*65c93628SMartin KaFai LauOPTIONS
62*65c93628SMartin KaFai Lau=======
63*65c93628SMartin KaFai Lau	-h, --help
64*65c93628SMartin KaFai Lau		  Print short generic help message (similar to **bpftool help**).
65*65c93628SMartin KaFai Lau
66*65c93628SMartin KaFai Lau	-V, --version
67*65c93628SMartin KaFai Lau		  Print version number (similar to **bpftool version**).
68*65c93628SMartin KaFai Lau
69*65c93628SMartin KaFai Lau	-j, --json
70*65c93628SMartin KaFai Lau		  Generate JSON output. For commands that cannot produce JSON, this
71*65c93628SMartin KaFai Lau		  option has no effect.
72*65c93628SMartin KaFai Lau
73*65c93628SMartin KaFai Lau	-p, --pretty
74*65c93628SMartin KaFai Lau		  Generate human-readable JSON output. Implies **-j**.
75*65c93628SMartin KaFai Lau
76*65c93628SMartin KaFai Lau	-d, --debug
77*65c93628SMartin KaFai Lau		  Print all logs available, even debug-level information. This
78*65c93628SMartin KaFai Lau		  includes logs from libbpf as well as from the verifier, when
79*65c93628SMartin KaFai Lau		  attempting to load programs.
80*65c93628SMartin KaFai Lau
81*65c93628SMartin KaFai LauEXAMPLES
82*65c93628SMartin KaFai Lau========
83*65c93628SMartin KaFai Lau**# bpftool struct_ops show**
84*65c93628SMartin KaFai Lau
85*65c93628SMartin KaFai Lau::
86*65c93628SMartin KaFai Lau
87*65c93628SMartin KaFai Lau    100: dctcp           tcp_congestion_ops
88*65c93628SMartin KaFai Lau    105: cubic           tcp_congestion_ops
89*65c93628SMartin KaFai Lau
90*65c93628SMartin KaFai Lau**# bpftool struct_ops unregister id 105**
91*65c93628SMartin KaFai Lau
92*65c93628SMartin KaFai Lau::
93*65c93628SMartin KaFai Lau
94*65c93628SMartin KaFai Lau   Unregistered tcp_congestion_ops cubic id 105
95*65c93628SMartin KaFai Lau
96*65c93628SMartin KaFai Lau**# bpftool struct_ops register bpf_cubic.o**
97*65c93628SMartin KaFai Lau
98*65c93628SMartin KaFai Lau::
99*65c93628SMartin KaFai Lau
100*65c93628SMartin KaFai Lau   Registered tcp_congestion_ops cubic id 110
101*65c93628SMartin KaFai Lau
102*65c93628SMartin KaFai Lau
103*65c93628SMartin KaFai LauSEE ALSO
104*65c93628SMartin KaFai Lau========
105*65c93628SMartin KaFai Lau	**bpf**\ (2),
106*65c93628SMartin KaFai Lau	**bpf-helpers**\ (7),
107*65c93628SMartin KaFai Lau	**bpftool**\ (8),
108*65c93628SMartin KaFai Lau	**bpftool-prog**\ (8),
109*65c93628SMartin KaFai Lau	**bpftool-map**\ (8),
110*65c93628SMartin KaFai Lau	**bpftool-cgroup**\ (8),
111*65c93628SMartin KaFai Lau	**bpftool-feature**\ (8),
112*65c93628SMartin KaFai Lau	**bpftool-net**\ (8),
113*65c93628SMartin KaFai Lau	**bpftool-perf**\ (8),
114*65c93628SMartin KaFai Lau	**bpftool-btf**\ (8)
115*65c93628SMartin KaFai Lau	**bpftool-gen**\ (8)
116*65c93628SMartin KaFai Lau
117