xref: /openbmc/linux/tools/bpf/bpftool/Documentation/bpftool-struct_ops.rst (revision 4344842836e9b9a7b695dc84956cdecd83ac02e9)
1*43448428SQuentin Monnet.. SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2*43448428SQuentin 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
1265c93628SMartin KaFai LauSYNOPSIS
1365c93628SMartin KaFai Lau========
1465c93628SMartin KaFai Lau
1565c93628SMartin KaFai Lau	**bpftool** [*OPTIONS*] **struct_ops** *COMMAND*
1665c93628SMartin KaFai Lau
17c07ba629SQuentin Monnet	*OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-d** | **--debug** } }
1865c93628SMartin KaFai Lau
1965c93628SMartin KaFai Lau	*COMMANDS* :=
2065c93628SMartin KaFai Lau	{ **show** | **list** | **dump** | **register** | **unregister** | **help** }
2165c93628SMartin KaFai Lau
2265c93628SMartin KaFai LauSTRUCT_OPS COMMANDS
2365c93628SMartin KaFai Lau===================
2465c93628SMartin KaFai Lau
2565c93628SMartin KaFai Lau|	**bpftool** **struct_ops { show | list }** [*STRUCT_OPS_MAP*]
2665c93628SMartin KaFai Lau|	**bpftool** **struct_ops dump** [*STRUCT_OPS_MAP*]
2765c93628SMartin KaFai Lau|	**bpftool** **struct_ops register** *OBJ*
2865c93628SMartin KaFai Lau|	**bpftool** **struct_ops unregister** *STRUCT_OPS_MAP*
2965c93628SMartin KaFai Lau|	**bpftool** **struct_ops help**
3065c93628SMartin KaFai Lau|
3165c93628SMartin KaFai Lau|	*STRUCT_OPS_MAP* := { **id** *STRUCT_OPS_MAP_ID* | **name** *STRUCT_OPS_MAP_NAME* }
3265c93628SMartin KaFai Lau|	*OBJ* := /a/file/of/bpf_struct_ops.o
3365c93628SMartin KaFai Lau
3465c93628SMartin KaFai Lau
3565c93628SMartin KaFai LauDESCRIPTION
3665c93628SMartin KaFai Lau===========
3765c93628SMartin KaFai Lau	**bpftool struct_ops { show | list }** [*STRUCT_OPS_MAP*]
3865c93628SMartin KaFai Lau		  Show brief information about the struct_ops in the system.
3965c93628SMartin KaFai Lau		  If *STRUCT_OPS_MAP* is specified, it shows information only
4065c93628SMartin KaFai Lau		  for the given struct_ops.  Otherwise, it lists all struct_ops
4165c93628SMartin KaFai Lau		  currently existing in the system.
4265c93628SMartin KaFai Lau
4365c93628SMartin KaFai Lau		  Output will start with struct_ops map ID, followed by its map
4465c93628SMartin KaFai Lau		  name and its struct_ops's kernel type.
4565c93628SMartin KaFai Lau
4665c93628SMartin KaFai Lau	**bpftool struct_ops dump** [*STRUCT_OPS_MAP*]
4765c93628SMartin KaFai Lau		  Dump details information about the struct_ops in the system.
4865c93628SMartin KaFai Lau		  If *STRUCT_OPS_MAP* is specified, it dumps information only
4965c93628SMartin KaFai Lau		  for the given struct_ops.  Otherwise, it dumps all struct_ops
5065c93628SMartin KaFai Lau		  currently existing in the system.
5165c93628SMartin KaFai Lau
5265c93628SMartin KaFai Lau	**bpftool struct_ops register** *OBJ*
5365c93628SMartin KaFai Lau		  Register bpf struct_ops from *OBJ*.  All struct_ops under
5465c93628SMartin KaFai Lau		  the ELF section ".struct_ops" will be registered to
5565c93628SMartin KaFai Lau		  its kernel subsystem.
5665c93628SMartin KaFai Lau
5765c93628SMartin KaFai Lau	**bpftool struct_ops unregister**  *STRUCT_OPS_MAP*
5865c93628SMartin KaFai Lau		  Unregister the *STRUCT_OPS_MAP* from the kernel subsystem.
5965c93628SMartin KaFai Lau
6065c93628SMartin KaFai Lau	**bpftool struct_ops help**
6165c93628SMartin KaFai Lau		  Print short help message.
6265c93628SMartin KaFai Lau
6365c93628SMartin KaFai LauOPTIONS
6465c93628SMartin KaFai Lau=======
65f28ef96dSQuentin Monnet	.. include:: common_options.rst
6665c93628SMartin KaFai Lau
6765c93628SMartin KaFai LauEXAMPLES
6865c93628SMartin KaFai Lau========
6965c93628SMartin KaFai Lau**# bpftool struct_ops show**
7065c93628SMartin KaFai Lau
7165c93628SMartin KaFai Lau::
7265c93628SMartin KaFai Lau
7365c93628SMartin KaFai Lau    100: dctcp           tcp_congestion_ops
7465c93628SMartin KaFai Lau    105: cubic           tcp_congestion_ops
7565c93628SMartin KaFai Lau
7665c93628SMartin KaFai Lau**# bpftool struct_ops unregister id 105**
7765c93628SMartin KaFai Lau
7865c93628SMartin KaFai Lau::
7965c93628SMartin KaFai Lau
8065c93628SMartin KaFai Lau   Unregistered tcp_congestion_ops cubic id 105
8165c93628SMartin KaFai Lau
8265c93628SMartin KaFai Lau**# bpftool struct_ops register bpf_cubic.o**
8365c93628SMartin KaFai Lau
8465c93628SMartin KaFai Lau::
8565c93628SMartin KaFai Lau
8665c93628SMartin KaFai Lau   Registered tcp_congestion_ops cubic id 110
87