xref: /OK3568_Linux_fs/kernel/tools/bpf/bpftool/Documentation/bpftool-struct_ops.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun==================
2*4882a593Smuzhiyunbpftool-struct_ops
3*4882a593Smuzhiyun==================
4*4882a593Smuzhiyun-------------------------------------------------------------------------------
5*4882a593Smuzhiyuntool to register/unregister/introspect BPF struct_ops
6*4882a593Smuzhiyun-------------------------------------------------------------------------------
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun:Manual section: 8
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunSYNOPSIS
11*4882a593Smuzhiyun========
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun	**bpftool** [*OPTIONS*] **struct_ops** *COMMAND*
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun	*OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] }
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun	*COMMANDS* :=
18*4882a593Smuzhiyun	{ **show** | **list** | **dump** | **register** | **unregister** | **help** }
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunSTRUCT_OPS COMMANDS
21*4882a593Smuzhiyun===================
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun|	**bpftool** **struct_ops { show | list }** [*STRUCT_OPS_MAP*]
24*4882a593Smuzhiyun|	**bpftool** **struct_ops dump** [*STRUCT_OPS_MAP*]
25*4882a593Smuzhiyun|	**bpftool** **struct_ops register** *OBJ*
26*4882a593Smuzhiyun|	**bpftool** **struct_ops unregister** *STRUCT_OPS_MAP*
27*4882a593Smuzhiyun|	**bpftool** **struct_ops help**
28*4882a593Smuzhiyun|
29*4882a593Smuzhiyun|	*STRUCT_OPS_MAP* := { **id** *STRUCT_OPS_MAP_ID* | **name** *STRUCT_OPS_MAP_NAME* }
30*4882a593Smuzhiyun|	*OBJ* := /a/file/of/bpf_struct_ops.o
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun
33*4882a593SmuzhiyunDESCRIPTION
34*4882a593Smuzhiyun===========
35*4882a593Smuzhiyun	**bpftool struct_ops { show | list }** [*STRUCT_OPS_MAP*]
36*4882a593Smuzhiyun		  Show brief information about the struct_ops in the system.
37*4882a593Smuzhiyun		  If *STRUCT_OPS_MAP* is specified, it shows information only
38*4882a593Smuzhiyun		  for the given struct_ops.  Otherwise, it lists all struct_ops
39*4882a593Smuzhiyun		  currently existing in the system.
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun		  Output will start with struct_ops map ID, followed by its map
42*4882a593Smuzhiyun		  name and its struct_ops's kernel type.
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun	**bpftool struct_ops dump** [*STRUCT_OPS_MAP*]
45*4882a593Smuzhiyun		  Dump details information about the struct_ops in the system.
46*4882a593Smuzhiyun		  If *STRUCT_OPS_MAP* is specified, it dumps information only
47*4882a593Smuzhiyun		  for the given struct_ops.  Otherwise, it dumps all struct_ops
48*4882a593Smuzhiyun		  currently existing in the system.
49*4882a593Smuzhiyun
50*4882a593Smuzhiyun	**bpftool struct_ops register** *OBJ*
51*4882a593Smuzhiyun		  Register bpf struct_ops from *OBJ*.  All struct_ops under
52*4882a593Smuzhiyun		  the ELF section ".struct_ops" will be registered to
53*4882a593Smuzhiyun		  its kernel subsystem.
54*4882a593Smuzhiyun
55*4882a593Smuzhiyun	**bpftool struct_ops unregister**  *STRUCT_OPS_MAP*
56*4882a593Smuzhiyun		  Unregister the *STRUCT_OPS_MAP* from the kernel subsystem.
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun	**bpftool struct_ops help**
59*4882a593Smuzhiyun		  Print short help message.
60*4882a593Smuzhiyun
61*4882a593SmuzhiyunOPTIONS
62*4882a593Smuzhiyun=======
63*4882a593Smuzhiyun	.. include:: common_options.rst
64*4882a593Smuzhiyun
65*4882a593SmuzhiyunEXAMPLES
66*4882a593Smuzhiyun========
67*4882a593Smuzhiyun**# bpftool struct_ops show**
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun::
70*4882a593Smuzhiyun
71*4882a593Smuzhiyun    100: dctcp           tcp_congestion_ops
72*4882a593Smuzhiyun    105: cubic           tcp_congestion_ops
73*4882a593Smuzhiyun
74*4882a593Smuzhiyun**# bpftool struct_ops unregister id 105**
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun::
77*4882a593Smuzhiyun
78*4882a593Smuzhiyun   Unregistered tcp_congestion_ops cubic id 105
79*4882a593Smuzhiyun
80*4882a593Smuzhiyun**# bpftool struct_ops register bpf_cubic.o**
81*4882a593Smuzhiyun
82*4882a593Smuzhiyun::
83*4882a593Smuzhiyun
84*4882a593Smuzhiyun   Registered tcp_congestion_ops cubic id 110
85