bpftool-struct_ops(8)

πŸ’– bpftool-struct_ops(8) β€” the manual page, but make it cute πŸ’–

okay bestie so this is the page for bpftool-struct_ops, from the System Manager's Manual ✨ it's the lil corner of bpftool that registers, unregisters and introspects BPF struct_ops, and honestly? it's giving backstage-pass energy πŸŽ€


🌸 Name 🌸

bpftool-struct_ops β€” a tool to register / unregister / introspect BPF struct_ops πŸ’…


✨ SYNOPSIS ✨

bpftool [OPTIONS] struct_ops COMMAND

OPTIONS := { { -j | --json } [{ -p | --pretty }] | { -d | --debug } }

COMMANDS := { show | list | dump | register | unregister | help }

so like. bpftool, then your options, then struct_ops, then whichever command you're feeling today 🫢


πŸ¦‹ STRUCT_OPS COMMANDS πŸ¦‹

the whole menu, laid out for u:

bpftool struct_ops { show | list } [STRUCT_OPS_MAP]
bpftool struct_ops dump [STRUCT_OPS_MAP]
bpftool struct_ops register OBJ [LINK_DIR]
bpftool struct_ops unregister STRUCT_OPS_MAP
bpftool struct_ops help

STRUCT_OPS_MAP := { id STRUCT_OPS_MAP_ID | name STRUCT_OPS_MAP_NAME }
OBJ := /a/file/of/bpf_struct_ops.o

not me defining the grammar mid-command 😭 anyway. your struct_ops map can be identified either by its id or by its name, and your OBJ is just a path to a .o file like /a/file/of/bpf_struct_ops.o ✨


πŸ‘‘ DESCRIPTION πŸ‘‘

bpftool struct_ops { show | list } [STRUCT_OPS_MAP]

Show brief information about the struct_ops in the system πŸ’« If you pass a STRUCT_OPS_MAP, it shows info for only that one given struct_ops. Otherwise? It lists all the struct_ops currently existing in the system, no cap πŸ”₯

the output starts with the struct_ops map ID, then its map name, then its struct_ops's kernel type. iconic little trio πŸŽ€

bpftool struct_ops dump [STRUCT_OPS_MAP]

Dump detail information about the struct_ops in the system πŸ¦‹ If STRUCT_OPS_MAP is specified, it dumps info only for the given struct_ops. Otherwise, it dumps all struct_ops currently existing in the system. same energy as show, just. more. lowkey extra in the best way πŸ’…

Register bpf struct_ops from OBJ 🫢 All struct_ops under the ELF section .struct_ops and .struct_ops.link will be registered to its kernel subsystem. And for each struct_ops in the .struct_ops.link section, a link will be created ✨ You can hand over LINK_DIR to provide a directory path where these links will be pinned with the same name as their corresponding map name πŸ“Œ

bpftool struct_ops unregister STRUCT_OPS_MAP

Unregister the STRUCT_OPS_MAP from the kernel subsystem. bye bestie πŸ‘‹πŸ’œ

bpftool struct_ops help

Print a short help message. ur lil safety net πŸ™ˆ


πŸ’… OPTIONS πŸ’…

  • -h, --help β€” Print short help message (similar to bpftool help). ur friendly lil reminder 🌸
  • -V, --version β€” Print bpftool's version number (similar to bpftool version), the number of the libbpf version in use, and optional features that were included when bpftool was compiled πŸ‘‘ Those optional features include linking against LLVM or libbfd to provide the disassembler for JIT-ted programs (bpftool prog dump jited) and usage of BPF skeletons (some features like bpftool prog profile or showing pids associated to BPF objects may rely on it). receipts, basically 🧾
  • -j, --json β€” Generate JSON output ✨ For commands that cannot produce JSON, this option has no effect. soz πŸ’€
  • -p, --pretty β€” Generate human-readable JSON output. Implies -j. it brings a friend, always 🌈
  • -d, --debug β€” Print all logs available, even debug-level information πŸ› This includes logs from libbpf as well as from the verifier, when attempting to load programs. it's giving nosy in the most useful way fr fr

πŸ“ EXAMPLES πŸ“

the show, run, slay sequence πŸ’–

# bpftool struct_ops show

   100: dctcp           tcp_congestion_ops
   105: cubic           tcp_congestion_ops

look at them. two lil congestion control girlies living their best life πŸ˜­πŸ’•

# bpftool struct_ops unregister id 105

   Unregistered tcp_congestion_ops cubic id 105

gone. not me. she left the group chat πŸ’€

# bpftool struct_ops register bpf_cubic.o

   Registered tcp_congestion_ops cubic id 110

and she's BACK ✨ reincarnated with a new id, main character energy only πŸ‘‘


🌈 SEE ALSO 🌈

bpf(2), bpf-helpers(7), bpftool(8), bpftool-btf(8), bpftool-cgroup(8), bpftool-feature(8), bpftool-gen(8), bpftool-iter(8), bpftool-link(8), bpftool-map(8), bpftool-net(8), bpftool-perf(8), bpftool-prog(8), bpftool-token(8)

the whole friend group 🫢 go read them too, iykyk ✨


reminder bestie: this page lives in the System Manager's Manual, and its page name is bpftool-struct_ops(8) πŸŽ€ that's the one to look up when u need it manually πŸ’…

and that's a wrap on bpftool-struct_ops(8) from the System Manager's Manual πŸ’– go forth, register ur struct_ops, unregister them politely, and always introspect with love πŸŒΈπŸ¦‹βœ¨

πŸ“¦ where this page comes from