1*858ea5e5SAndroid Build Coastguard Worker.. SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2*858ea5e5SAndroid Build Coastguard Worker 3*858ea5e5SAndroid Build Coastguard Worker================== 4*858ea5e5SAndroid Build Coastguard Workerbpftool-struct_ops 5*858ea5e5SAndroid Build Coastguard Worker================== 6*858ea5e5SAndroid Build Coastguard Worker------------------------------------------------------------------------------- 7*858ea5e5SAndroid Build Coastguard Workertool to register/unregister/introspect BPF struct_ops 8*858ea5e5SAndroid Build Coastguard Worker------------------------------------------------------------------------------- 9*858ea5e5SAndroid Build Coastguard Worker 10*858ea5e5SAndroid Build Coastguard Worker:Manual section: 8 11*858ea5e5SAndroid Build Coastguard Worker 12*858ea5e5SAndroid Build Coastguard Worker.. include:: substitutions.rst 13*858ea5e5SAndroid Build Coastguard Worker 14*858ea5e5SAndroid Build Coastguard WorkerSYNOPSIS 15*858ea5e5SAndroid Build Coastguard Worker======== 16*858ea5e5SAndroid Build Coastguard Worker 17*858ea5e5SAndroid Build Coastguard Worker **bpftool** [*OPTIONS*] **struct_ops** *COMMAND* 18*858ea5e5SAndroid Build Coastguard Worker 19*858ea5e5SAndroid Build Coastguard Worker *OPTIONS* := { |COMMON_OPTIONS| } 20*858ea5e5SAndroid Build Coastguard Worker 21*858ea5e5SAndroid Build Coastguard Worker *COMMANDS* := 22*858ea5e5SAndroid Build Coastguard Worker { **show** | **list** | **dump** | **register** | **unregister** | **help** } 23*858ea5e5SAndroid Build Coastguard Worker 24*858ea5e5SAndroid Build Coastguard WorkerSTRUCT_OPS COMMANDS 25*858ea5e5SAndroid Build Coastguard Worker=================== 26*858ea5e5SAndroid Build Coastguard Worker 27*858ea5e5SAndroid Build Coastguard Worker| **bpftool** **struct_ops { show | list }** [*STRUCT_OPS_MAP*] 28*858ea5e5SAndroid Build Coastguard Worker| **bpftool** **struct_ops dump** [*STRUCT_OPS_MAP*] 29*858ea5e5SAndroid Build Coastguard Worker| **bpftool** **struct_ops register** *OBJ* [*LINK_DIR*] 30*858ea5e5SAndroid Build Coastguard Worker| **bpftool** **struct_ops unregister** *STRUCT_OPS_MAP* 31*858ea5e5SAndroid Build Coastguard Worker| **bpftool** **struct_ops help** 32*858ea5e5SAndroid Build Coastguard Worker| 33*858ea5e5SAndroid Build Coastguard Worker| *STRUCT_OPS_MAP* := { **id** *STRUCT_OPS_MAP_ID* | **name** *STRUCT_OPS_MAP_NAME* } 34*858ea5e5SAndroid Build Coastguard Worker| *OBJ* := /a/file/of/bpf_struct_ops.o 35*858ea5e5SAndroid Build Coastguard Worker 36*858ea5e5SAndroid Build Coastguard Worker 37*858ea5e5SAndroid Build Coastguard WorkerDESCRIPTION 38*858ea5e5SAndroid Build Coastguard Worker=========== 39*858ea5e5SAndroid Build Coastguard Worker **bpftool struct_ops { show | list }** [*STRUCT_OPS_MAP*] 40*858ea5e5SAndroid Build Coastguard Worker Show brief information about the struct_ops in the system. 41*858ea5e5SAndroid Build Coastguard Worker If *STRUCT_OPS_MAP* is specified, it shows information only 42*858ea5e5SAndroid Build Coastguard Worker for the given struct_ops. Otherwise, it lists all struct_ops 43*858ea5e5SAndroid Build Coastguard Worker currently existing in the system. 44*858ea5e5SAndroid Build Coastguard Worker 45*858ea5e5SAndroid Build Coastguard Worker Output will start with struct_ops map ID, followed by its map 46*858ea5e5SAndroid Build Coastguard Worker name and its struct_ops's kernel type. 47*858ea5e5SAndroid Build Coastguard Worker 48*858ea5e5SAndroid Build Coastguard Worker **bpftool struct_ops dump** [*STRUCT_OPS_MAP*] 49*858ea5e5SAndroid Build Coastguard Worker Dump details information about the struct_ops in the system. 50*858ea5e5SAndroid Build Coastguard Worker If *STRUCT_OPS_MAP* is specified, it dumps information only 51*858ea5e5SAndroid Build Coastguard Worker for the given struct_ops. Otherwise, it dumps all struct_ops 52*858ea5e5SAndroid Build Coastguard Worker currently existing in the system. 53*858ea5e5SAndroid Build Coastguard Worker 54*858ea5e5SAndroid Build Coastguard Worker **bpftool struct_ops register** *OBJ* [*LINK_DIR*] 55*858ea5e5SAndroid Build Coastguard Worker Register bpf struct_ops from *OBJ*. All struct_ops under 56*858ea5e5SAndroid Build Coastguard Worker the ELF section ".struct_ops" and ".struct_ops.link" will 57*858ea5e5SAndroid Build Coastguard Worker be registered to its kernel subsystem. For each 58*858ea5e5SAndroid Build Coastguard Worker struct_ops in the ".struct_ops.link" section, a link 59*858ea5e5SAndroid Build Coastguard Worker will be created. You can give *LINK_DIR* to provide a 60*858ea5e5SAndroid Build Coastguard Worker directory path where these links will be pinned with the 61*858ea5e5SAndroid Build Coastguard Worker same name as their corresponding map name. 62*858ea5e5SAndroid Build Coastguard Worker 63*858ea5e5SAndroid Build Coastguard Worker **bpftool struct_ops unregister** *STRUCT_OPS_MAP* 64*858ea5e5SAndroid Build Coastguard Worker Unregister the *STRUCT_OPS_MAP* from the kernel subsystem. 65*858ea5e5SAndroid Build Coastguard Worker 66*858ea5e5SAndroid Build Coastguard Worker **bpftool struct_ops help** 67*858ea5e5SAndroid Build Coastguard Worker Print short help message. 68*858ea5e5SAndroid Build Coastguard Worker 69*858ea5e5SAndroid Build Coastguard WorkerOPTIONS 70*858ea5e5SAndroid Build Coastguard Worker======= 71*858ea5e5SAndroid Build Coastguard Worker .. include:: common_options.rst 72*858ea5e5SAndroid Build Coastguard Worker 73*858ea5e5SAndroid Build Coastguard WorkerEXAMPLES 74*858ea5e5SAndroid Build Coastguard Worker======== 75*858ea5e5SAndroid Build Coastguard Worker**# bpftool struct_ops show** 76*858ea5e5SAndroid Build Coastguard Worker 77*858ea5e5SAndroid Build Coastguard Worker:: 78*858ea5e5SAndroid Build Coastguard Worker 79*858ea5e5SAndroid Build Coastguard Worker 100: dctcp tcp_congestion_ops 80*858ea5e5SAndroid Build Coastguard Worker 105: cubic tcp_congestion_ops 81*858ea5e5SAndroid Build Coastguard Worker 82*858ea5e5SAndroid Build Coastguard Worker**# bpftool struct_ops unregister id 105** 83*858ea5e5SAndroid Build Coastguard Worker 84*858ea5e5SAndroid Build Coastguard Worker:: 85*858ea5e5SAndroid Build Coastguard Worker 86*858ea5e5SAndroid Build Coastguard Worker Unregistered tcp_congestion_ops cubic id 105 87*858ea5e5SAndroid Build Coastguard Worker 88*858ea5e5SAndroid Build Coastguard Worker**# bpftool struct_ops register bpf_cubic.o** 89*858ea5e5SAndroid Build Coastguard Worker 90*858ea5e5SAndroid Build Coastguard Worker:: 91*858ea5e5SAndroid Build Coastguard Worker 92*858ea5e5SAndroid Build Coastguard Worker Registered tcp_congestion_ops cubic id 110 93