xref: /openbmc/linux/tools/bpf/bpftool/Documentation/bpftool-struct_ops.rst (revision b623181520404ef48f7421333561bd294c6c6b11)
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
12*b6231815SQuentin Monnet.. include:: substitutions.rst
13*b6231815SQuentin Monnet
1465c93628SMartin KaFai LauSYNOPSIS
1565c93628SMartin KaFai Lau========
1665c93628SMartin KaFai Lau
1765c93628SMartin KaFai Lau	**bpftool** [*OPTIONS*] **struct_ops** *COMMAND*
1865c93628SMartin KaFai Lau
19*b6231815SQuentin 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*]
2965c93628SMartin KaFai Lau|	**bpftool** **struct_ops register** *OBJ*
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
5465c93628SMartin KaFai Lau	**bpftool struct_ops register** *OBJ*
5565c93628SMartin KaFai Lau		  Register bpf struct_ops from *OBJ*.  All struct_ops under
5665c93628SMartin KaFai Lau		  the ELF section ".struct_ops" will be registered to
5765c93628SMartin KaFai Lau		  its kernel subsystem.
5865c93628SMartin KaFai Lau
5965c93628SMartin KaFai Lau	**bpftool struct_ops unregister**  *STRUCT_OPS_MAP*
6065c93628SMartin KaFai Lau		  Unregister the *STRUCT_OPS_MAP* from the kernel subsystem.
6165c93628SMartin KaFai Lau
6265c93628SMartin KaFai Lau	**bpftool struct_ops help**
6365c93628SMartin KaFai Lau		  Print short help message.
6465c93628SMartin KaFai Lau
6565c93628SMartin KaFai LauOPTIONS
6665c93628SMartin KaFai Lau=======
67f28ef96dSQuentin Monnet	.. include:: common_options.rst
6865c93628SMartin KaFai Lau
6965c93628SMartin KaFai LauEXAMPLES
7065c93628SMartin KaFai Lau========
7165c93628SMartin KaFai Lau**# bpftool struct_ops show**
7265c93628SMartin KaFai Lau
7365c93628SMartin KaFai Lau::
7465c93628SMartin KaFai Lau
7565c93628SMartin KaFai Lau    100: dctcp           tcp_congestion_ops
7665c93628SMartin KaFai Lau    105: cubic           tcp_congestion_ops
7765c93628SMartin KaFai Lau
7865c93628SMartin KaFai Lau**# bpftool struct_ops unregister id 105**
7965c93628SMartin KaFai Lau
8065c93628SMartin KaFai Lau::
8165c93628SMartin KaFai Lau
8265c93628SMartin KaFai Lau   Unregistered tcp_congestion_ops cubic id 105
8365c93628SMartin KaFai Lau
8465c93628SMartin KaFai Lau**# bpftool struct_ops register bpf_cubic.o**
8565c93628SMartin KaFai Lau
8665c93628SMartin KaFai Lau::
8765c93628SMartin KaFai Lau
8865c93628SMartin KaFai Lau   Registered tcp_congestion_ops cubic id 110
89