xref: /openbmc/linux/tools/bpf/bpftool/Documentation/bpftool-struct_ops.rst (revision 45cea721ea36d83969473d2abd29bcc2321cacdd)
143448428SQuentin Monnet.. SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
243448428SQuentin Monnet
365c93628SMartin KaFai Lau==================
465c93628SMartin KaFai Laubpftool-struct_ops
565c93628SMartin KaFai Lau==================
665c93628SMartin KaFai Lau-------------------------------------------------------------------------------
765c93628SMartin KaFai Lautool to register/unregister/introspect BPF struct_ops
865c93628SMartin KaFai Lau-------------------------------------------------------------------------------
965c93628SMartin KaFai Lau
1065c93628SMartin KaFai Lau:Manual section: 8
1165c93628SMartin KaFai Lau
12b6231815SQuentin Monnet.. include:: substitutions.rst
13b6231815SQuentin Monnet
1465c93628SMartin KaFai LauSYNOPSIS
1565c93628SMartin KaFai Lau========
1665c93628SMartin KaFai Lau
1765c93628SMartin KaFai Lau	**bpftool** [*OPTIONS*] **struct_ops** *COMMAND*
1865c93628SMartin KaFai Lau
19b6231815SQuentin Monnet	*OPTIONS* := { |COMMON_OPTIONS| }
2065c93628SMartin KaFai Lau
2165c93628SMartin KaFai Lau	*COMMANDS* :=
2265c93628SMartin KaFai Lau	{ **show** | **list** | **dump** | **register** | **unregister** | **help** }
2365c93628SMartin KaFai Lau
2465c93628SMartin KaFai LauSTRUCT_OPS COMMANDS
2565c93628SMartin KaFai Lau===================
2665c93628SMartin KaFai Lau
2765c93628SMartin KaFai Lau|	**bpftool** **struct_ops { show | list }** [*STRUCT_OPS_MAP*]
2865c93628SMartin KaFai Lau|	**bpftool** **struct_ops dump** [*STRUCT_OPS_MAP*]
29*45cea721SKui-Feng Lee|	**bpftool** **struct_ops register** *OBJ* [*LINK_DIR*]
3065c93628SMartin KaFai Lau|	**bpftool** **struct_ops unregister** *STRUCT_OPS_MAP*
3165c93628SMartin KaFai Lau|	**bpftool** **struct_ops help**
3265c93628SMartin KaFai Lau|
3365c93628SMartin KaFai Lau|	*STRUCT_OPS_MAP* := { **id** *STRUCT_OPS_MAP_ID* | **name** *STRUCT_OPS_MAP_NAME* }
3465c93628SMartin KaFai Lau|	*OBJ* := /a/file/of/bpf_struct_ops.o
3565c93628SMartin KaFai Lau
3665c93628SMartin KaFai Lau
3765c93628SMartin KaFai LauDESCRIPTION
3865c93628SMartin KaFai Lau===========
3965c93628SMartin KaFai Lau	**bpftool struct_ops { show | list }** [*STRUCT_OPS_MAP*]
4065c93628SMartin KaFai Lau		  Show brief information about the struct_ops in the system.
4165c93628SMartin KaFai Lau		  If *STRUCT_OPS_MAP* is specified, it shows information only
4265c93628SMartin KaFai Lau		  for the given struct_ops.  Otherwise, it lists all struct_ops
4365c93628SMartin KaFai Lau		  currently existing in the system.
4465c93628SMartin KaFai Lau
4565c93628SMartin KaFai Lau		  Output will start with struct_ops map ID, followed by its map
4665c93628SMartin KaFai Lau		  name and its struct_ops's kernel type.
4765c93628SMartin KaFai Lau
4865c93628SMartin KaFai Lau	**bpftool struct_ops dump** [*STRUCT_OPS_MAP*]
4965c93628SMartin KaFai Lau		  Dump details information about the struct_ops in the system.
5065c93628SMartin KaFai Lau		  If *STRUCT_OPS_MAP* is specified, it dumps information only
5165c93628SMartin KaFai Lau		  for the given struct_ops.  Otherwise, it dumps all struct_ops
5265c93628SMartin KaFai Lau		  currently existing in the system.
5365c93628SMartin KaFai Lau
54*45cea721SKui-Feng Lee	**bpftool struct_ops register** *OBJ* [*LINK_DIR*]
5565c93628SMartin KaFai Lau		  Register bpf struct_ops from *OBJ*.  All struct_ops under
56*45cea721SKui-Feng Lee		  the ELF section ".struct_ops" and ".struct_ops.link" will
57*45cea721SKui-Feng Lee		  be registered to its kernel subsystem.  For each
58*45cea721SKui-Feng Lee		  struct_ops in the ".struct_ops.link" section, a link
59*45cea721SKui-Feng Lee		  will be created.  You can give *LINK_DIR* to provide a
60*45cea721SKui-Feng Lee		  directory path where these links will be pinned with the
61*45cea721SKui-Feng Lee		  same name as their corresponding map name.
6265c93628SMartin KaFai Lau
6365c93628SMartin KaFai Lau	**bpftool struct_ops unregister**  *STRUCT_OPS_MAP*
6465c93628SMartin KaFai Lau		  Unregister the *STRUCT_OPS_MAP* from the kernel subsystem.
6565c93628SMartin KaFai Lau
6665c93628SMartin KaFai Lau	**bpftool struct_ops help**
6765c93628SMartin KaFai Lau		  Print short help message.
6865c93628SMartin KaFai Lau
6965c93628SMartin KaFai LauOPTIONS
7065c93628SMartin KaFai Lau=======
71f28ef96dSQuentin Monnet	.. include:: common_options.rst
7265c93628SMartin KaFai Lau
7365c93628SMartin KaFai LauEXAMPLES
7465c93628SMartin KaFai Lau========
7565c93628SMartin KaFai Lau**# bpftool struct_ops show**
7665c93628SMartin KaFai Lau
7765c93628SMartin KaFai Lau::
7865c93628SMartin KaFai Lau
7965c93628SMartin KaFai Lau    100: dctcp           tcp_congestion_ops
8065c93628SMartin KaFai Lau    105: cubic           tcp_congestion_ops
8165c93628SMartin KaFai Lau
8265c93628SMartin KaFai Lau**# bpftool struct_ops unregister id 105**
8365c93628SMartin KaFai Lau
8465c93628SMartin KaFai Lau::
8565c93628SMartin KaFai Lau
8665c93628SMartin KaFai Lau   Unregistered tcp_congestion_ops cubic id 105
8765c93628SMartin KaFai Lau
8865c93628SMartin KaFai Lau**# bpftool struct_ops register bpf_cubic.o**
8965c93628SMartin KaFai Lau
9065c93628SMartin KaFai Lau::
9165c93628SMartin KaFai Lau
9265c93628SMartin KaFai Lau   Registered tcp_congestion_ops cubic id 110
93