# BPF Features by Linux Kernel Version - bpf-developer-tutorial

# BPF Features by Linux Kernel Version

## eBPF support

Kernel version | Commit
--- | ---
3.15 | `bd4cf0ed331a`

## JIT compiling

The list of supported architectures for your kernel can be retrieved with:

    git grep HAVE_EBPF_JIT arch/

Feature / Architecture | Kernel version | Commit
--- | --- | ---
x86_64 | 3.16 | `622582786c9e`
ARM64 | 3.18 | `e54bcde3d69d`
s390 | 4.1 | `054623105728`
Constant blinding for JIT machines | 4.7 | `4f3446bb809f`
PowerPC64 | 4.8 | `156d0e290e96`
Constant blinding - PowerPC64 | 4.9 | `b7b7013cac55`
Sparc64 | 4.12 | `7a12b5031c6b`
MIPS | 4.13 | `f381bf6d82f0`
ARM32 | 4.14 | `39c13c204bb1`
x86_32 | 4.18 | `03f5781be2c7`
RISC-V RV64G | 5.1 | `2353ecc6f91f`
RISC-V RV32G | 5.7 | `5f316b65e99f`
PowerPC32 | 5.13 | `51c66ad849a7`
LoongArch | 6.1 | `5dc615520c4d`

## Main features

Several (but not all) of these main features translate to an eBPF program type. The list of such program types supported in your kernel can be found in file `include/uapi/linux/bpf.h`:

    git grep -W 'bpf_prog_type {' include/uapi/linux/bpf.h

Feature | Kernel version | Commit
--- | --- | ---
`AF_PACKET` (libpcap/tcpdump, `cls_bpf` classifier, netfilter's `xt_bpf`, team driver's load-balancing mode…) | 3.15 | `bd4cf0ed331a`
Kernel helpers | 3.15 | `bd4cf0ed331a`
`bpf()` syscall | 3.18 | `99c55f7d47c0`
Maps (a.k.a. Tables; details below) | 3.18 | `99c55f7d47c0`
BPF attached to sockets | 3.19 | `89aa075832b0`
BPF attached to `kprobes` | 4.1 | `2541517c32be`
`cls_bpf` / `act_bpf` for `tc` | 4.1 | `e2e9b6541dd4`
Tail calls | 4.2 | `04fd61ab36ec`
Non-root programs on sockets | 4.4 | `1be7f75d1668`
Persistent maps and programs (virtual FS) | 4.4 | `b2197755b263`
`tc`'s `direct-action` (`da`) mode | 4.4 | `045efa82ff56`
`tc`'s `clsact` qdisc | 4.5 | `1f211a1b929c`
BPF attached to tracepoints | 4.7 | `98b5c2c65c29`
Direct packet access | 4.7 | `969bf05eb3ce`
XDP (see below) | 4.8 | `6a773a15a1e8`
BPF attached to perf events | 4.9 | `0515e5999a46`
Hardware offload for `tc`'s `cls_bpf` | 4.9 | `332ae8e2f6ec`
Verifier exposure and internal hooks | 4.9 | `13a27dfc6697`
BPF attached to cgroups for socket filtering | 4.10 | `0e33661de493`
Lightweight tunnel encapsulation | 4.10 | `3a0af8fd61f9`
eBPF support for `xt_bpf` module (iptables) | 4.10 | `2c16d6033264`
BPF program tag | 4.10 | `7bd509e311f4`
Tracepoints to debug BPF | 4.11 (removed in 4.18) | `a67edbf4fb6d` `4d220ed0f814`
Testing / benchmarking BPF programs | 4.12 | `1cf1cae963c2`
BPF programs and maps IDs | 4.13 | `dc4bb0e23561`
BPF support for `sock_ops` | 4.13 | `40304b2a1567`
BPF support for skbs on sockets | 4.14 | `b005fd189cec`
bpftool utility in kernel sources | 4.15 | `71bb428fe2c1`
BPF attached to cgroups as device controller | 4.15 | `ebc614f68736`
bpf2bpf function calls | 4.16 | `cc8b0b92a169`
BPF used for monitoring socket RX/TX data | 4.17 | `4f738adba30a`
BPF attached to raw tracepoints | 4.17 | `c4f6699dfcb8`
BPF attached to `bind()` system call | 4.17 | `4fbac77d2d09` `aac3fc320d94`
BPF attached to `connect()` system call | 4.17 | `d74bad4e74ee`
BPF Type Format (BTF) | 4.18 | `69b693f0aefa`
AF_XDP | 4.18 | `fbfc504a24f5`
bpfilter | 4.18 | `d2ba09c17a06`
End.BPF action for seg6local LWT | 4.18 | `004d4b274e2a`
BPF attached to LIRC devices | 4.18 | `f4364dcfc86d`
Pass map values to map helpers | 4.18 | `d71962f3e627`
BPF socket reuseport | 4.19 | `2dbb9b9e6df6`
BPF flow dissector | 4.20 | `d58e468b1112`
BPF 1M insn limit | 5.2 | `c04c0d2b968a`
BPF cgroup sysctl | 5.2 | `7b146cebe30c`
BPF raw tracepoint writable | 5.2 | `9df1c28bb752`
BPF bounded loop | 5.3 | `2589726d12a1`
BPF trampoline | 5.5 | `fec56f5890d9`
BPF LSM hook | 5.7 | `fc611f47f218` `641cd7b06c91`
BPF iterator | 5.8 | `180139dca8b3`
BPF socket lookup hook | 5.9 | `e9ddbb7707ff`
Sleepable BPF programs | 5.10 | `1e6c62a88215`

### Program types

Program type | Kernel version | Commit | Enum
--- | --- | --- | ---
Socket filter | 3.19 | `ddd872bc3098` | BPF_PROG_TYPE_SOCKET_FILTER
Kprobe | 4.1 | `2541517c32be` | BPF_PROG_TYPE_KPROBE
traffic control (TC) | 4.1 | `96be4325f443` | BPF_PROG_TYPE_SCHED_CLS
traffic control (TC) | 4.1 | `94caee8c312d` | BPF_PROG_TYPE_SCHED_ACT
Tracepoint | 4.7 | `98b5c2c65c29` | BPF_PROG_TYPE_TRACEPOINT
XDP | 4.8 | `6a773a15a1e8` | BPF_PROG_TYPE_XDP
Perf event | 4.9 | `0515e5999a46` | BPF_PROG_TYPE_PERF_EVENT
cgroup socket filtering | 4.10 | `0e33661de493` | BPF_PROG_TYPE_CGROUP_SKB
cgroup sock modification | 4.10 | `610236587600` | BPF_PROG_TYPE_CGROUP_SOCK
lightweight tunnel (IN) | 4.10 | `3a0af8fd61f9` | BPF_PROG_TYPE_LWT_IN
lightweight tunnel (OUT) | 4.10 | `3a0af8fd61f9` | BPF_PROG_TYPE_LWT_OUT
lightweight tunnel (XMIT) | 4.10 | `3a0af8fd61f9` | BPF_PROG_TYPE_LWT_XMIT
cgroup sock ops (per conn) | 4.13 | `40304b2a1567` | BPF_PROG_TYPE_SOCK_OPS
stream parser / stream verdict | 4.14 | `b005fd189cec` | BPF_PROG_TYPE_SK_SKB
cgroup device manager | 4.15 | `ebc614f68736` | BPF_PROG_TYPE_CGROUP_DEVICE
socket msg verdict | 4.17 | `4f738adba30a` | BPF_PROG_TYPE_SK_MSG
Raw tracepoint | 4.17 | `c4f6699dfcb8` | BPF_PROG_TYPE_RAW_TRACEPOINT
socket binding | 4.17 | `4fbac77d2d09` | BPF_PROG_TYPE_CGROUP_SOCK_ADDR
LWT seg6local | 4.18 | `004d4b274e2a` | BPF_PROG_TYPE_LWT_SEG6LOCAL
lirc devices | 4.18 | `f4364dcfc86d` | BPF_PROG_TYPE_LIRC_MODE2
lookup SO_REUSEPORT socket | 4.19 | `2dbb9b9e6df6` | BPF_PROG_TYPE_SK_REUSEPORT
flow dissector | 4.20 | `d58e468b1112` | BPF_PROG_TYPE_FLOW_DISSECTOR
cgroup sysctl | 5.2 | `7b146cebe30c` | BPF_PROG_TYPE_CGROUP_SYSCTL
writable raw tracepoints | 5.2 | `9df1c28bb752` | BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE
cgroup getsockopt/setsockopt | 5.3 | `0d01da6afc54` | BPF_PROG_TYPE_CGROUP_SOCKOPT
Tracing (BTF/BPF trampoline) | 5.5 | `f1b9509c2fb0` | BPF_PROG_TYPE_TRACING
struct ops | 5.6 | `27ae7997a661` | BPF_PROG_TYPE_STRUCT_OPS
extensions | 5.6 | `be8704ff07d2` | BPF_PROG_TYPE_EXT
LSM | 5.7 | `fc611f47f218` | BPF_PROG_TYPE_LSM
lookup listening socket | 5.9 | `e9ddbb7707ff` | BPF_PROG_TYPE_SK_LOOKUP
Allow executing syscalls | 5.15 | `79a7f8bdb159` | BPF_PROG_TYPE_SYSCALL

## Maps (a.k.a. Tables, in BCC lingo)

### Map types

The list of map types supported in your kernel can be found in file `include/uapi/linux/bpf.h`:

    git grep -W 'bpf_map_type {' include/uapi/linux/bpf.h

Map type | Kernel version | Commit | Enum
--- | --- | --- | ---
Hash | 3.19 | `0f8e4bd8a1fc` | BPF_MAP_TYPE_HASH
Array | 3.19 | `28fbcfa08d8e` | BPF_MAP_TYPE_ARRAY
Prog array | 4.2 | `04fd61ab36ec` | BPF_MAP_TYPE_PROG_ARRAY
Perf events | 4.3 | `ea317b267e9d` | BPF_MAP_TYPE_PERF_EVENT_ARRAY
Per-CPU hash | 4.6 | `824bd0ce6c7c` | BPF_MAP_TYPE_PERCPU_HASH
Per-CPU array | 4.6 | `a10423b87a7e` | BPF_MAP_TYPE_PERCPU_ARRAY
Stack trace | 4.6 | `d5a3b1f69186` | BPF_MAP_TYPE_STACK_TRACE
cgroup array | 4.8 | `4ed8ec521ed5` | BPF_MAP_TYPE_CGROUP_ARRAY
LRU hash | 4.10 | `29ba732acbee` `3a08c2fd7634` | BPF_MAP_TYPE_LRU_HASH
LRU per-CPU hash | 4.10 | `8f8449384ec3` `961578b63474` | BPF_MAP_TYPE_LRU_PERCPU_HASH
LPM trie (longest-prefix match) | 4.11 | `b95a5c4db09b` | BPF_MAP_TYPE_LPM_TRIE
Array of maps | 4.12 | `56f668dfe00d` | BPF_MAP_TYPE_ARRAY_OF_MAPS
Hash of maps | 4.12 | `bcc6b1b7ebf8` | BPF_MAP_TYPE_HASH_OF_MAPS
Netdevice references (array) | 4.14 | `546ac1ffb70d` | BPF_MAP_TYPE_DEVMAP
Socket references (array) | 4.14 | `174a79ff9515` | BPF_MAP_TYPE_SOCKMAP
CPU references | 4.15 | `6710e1126934` | BPF_MAP_TYPE_CPUMAP
AF_XDP socket (XSK) references | 4.18 | `fbfc504a24f5` | BPF_MAP_TYPE_XSKMAP
Socket references (hashmap) | 4.18 | `81110384441a` | BPF_MAP_TYPE_SOCKHASH
cgroup storage | 4.19 | `de9cbbaadba5` | BPF_MAP_TYPE_CGROUP_STORAGE
reuseport sockarray | 4.19 | `5dc4c4b7d4e8` | BPF_MAP_TYPE_REUSEPORT_SOCKARRAY
precpu cgroup storage | 4.20 | `b741f1630346` | BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE
queue | 4.20 | `f1a2e44a3aec` | BPF_MAP_TYPE_QUEUE
stack | 4.20 | `f1a2e44a3aec` | BPF_MAP_TYPE_STACK
socket local storage | 5.2 | `6ac99e8f23d4` | BPF_MAP_TYPE_SK_STORAGE
Netdevice references (hashmap) | 5.4 | `6f9d451ab1a3` | BPF_MAP_TYPE_DEVMAP_HASH
struct ops | 5.6 | `85d33df357b6` | BPF_MAP_TYPE_STRUCT_OPS
ring buffer | 5.8 | `457f44363a88` | BPF_MAP_TYPE_RINGBUF
inode storage | 5.10 | `8ea636848aca` | BPF_MAP_TYPE_INODE_STORAGE
task storage | 5.11 | `4cf1bc1f1045` | BPF_MAP_TYPE_TASK_STORAGE
Bloom filter | 5.16 | `9330986c0300` | BPF_MAP_TYPE_BLOOM_FILTER
user ringbuf | 6.1 | `583c1f420173` | BPF_MAP_TYPE_USER_RINGBUF

### Map userspace API

Some (but not all) of these API features translate to a subcommand beginning with `BPF_MAP_`. The list of subcommands supported in your kernel can be found in file `include/uapi/linux/bpf.h`:

    git grep -W 'bpf_cmd {' include/uapi/linux/bpf.h

Feature | Kernel version | Commit
--- | --- | ---
Basic operations (lookup, update, delete, `GET_NEXT_KEY`) | 3.18 | `db20fd2b0108`
Pass flags to `UPDATE_ELEM` | 3.19 | `3274f52073d8`
Pre-alloc map memory by default | 4.6 | `6c9059817432`
Pass `NULL` to `GET_NEXT_KEY` | 4.12 | `8fe45924387b`
Creation: select NUMA node | 4.14 | `96eabe7a40aa`
Restrict access from syscall side | 4.15 | `6e71b04a8224`
Creation: specify map name | 4.15 | `ad5b177bd73f`
`LOOKUP_AND_DELETE_ELEM` | 4.20 | `bd513cd08f10`
Creation: `BPF_F_ZERO_SEED` | 5.0 | `96b3b6c9091d`
`BPF_F_LOCK` flag for lookup / update | 5.1 | `96049f3afd50`
Restrict access from BPF side | 5.2 | `591fe9888d78`
`FREEZE` | 5.2 | `87df15de441b`
mmap() support for array maps | 5.5 | `fc9702273e2e`
`LOOKUP_BATCH` | 5.6 | `cb4d03ab499d`
`UPDATE_BATCH`, `DELETE_BATCH` | 5.6 | `aa2e93b8e58e`
`LOOKUP_AND_DELETE_BATCH` | 5.6 | `057996380a42`
`LOOKUP_AND_DELETE_ELEM` support for hash maps | 5.14 | `3e87f192b405`

## XDP

An approximate list of drivers or components supporting XDP programs for your kernel can be retrieved with:

    git grep -l XDP_SETUP_PROG drivers/

Feature / Driver | Kernel version | Commit
--- | --- | ---
XDP core architecture | 4.8 | `6a773a15a1e8`
Action: drop | 4.8 | `6a773a15a1e8`
Action: pass on to stack | 4.8 | `6a773a15a1e8`
Action: direct forwarding (on same port) | 4.8 | `6ce96ca348a9`
Direct packet data write | 4.8 | `4acf6c0b84c9`
Mellanox `mlx4` driver | 4.8 | `47a38e155037`
Mellanox `mlx5` driver | 4.9 | `86994156c736`
Netronome `nfp` driver | 4.10 | `ecd63a0217d5`
QLogic (Cavium) `qed*` drivers | 4.10 | `496e05170958`
`virtio_net` driver | 4.10 | `f600b6905015`
Broadcom `bnxt_en` driver | 4.11 | `c6d30e8391b8`
Intel `ixgbe*` drivers | 4.12 | `924708081629`
Cavium `thunderx` driver | 4.12 | `05c773f52b96`
Generic XDP | 4.12 | `b5cdae3291f7`
Intel `i40e` driver | 4.13 | `0c8493d90b6b`
Action: redirect | 4.14 | `6453073987ba`
Support for tap | 4.14 | `761876c857cb`
Support for veth | 4.14 | `d445516966dc`
Intel `ixgbevf` driver | 4.17 | `c7aec59657b6`
Freescale `dpaa2` driver | 5.0 | `7e273a8ebdd3`
Socionext `netsec` driver | 5.3 | `ba2b232108d3`
TI `cpsw` driver | 5.3 | `9ed4050c0d75`
Intel `ice` driver | 5.5 | `efc2214b6047`
Solarflare `sfc` driver | 5.5 | `eb9a36be7f3e`
Marvell `mvneta` driver | 5.5 | `0db51da7a8e9`
Microsoft `hv_netvsc` driver | 5.6 | `351e1581395f`
Amazon `ena` driver | 5.6 | `838c93dc5449`
`xen-netfront` driver | 5.9 | `6c5aa6fc4def`
Intel `igb` driver | 5.10 | `9cbc948b5a20`

## Helpers

The list of helpers supported in your kernel can be found in file `include/uapi/linux/bpf.h`:

    git grep '	FN(' include/uapi/linux/bpf.h

Alphabetical order

Helper | Kernel version | License | Commit
--- | --- | --- | ---
`BPF_FUNC_bind()` | 4.17 |  | `d74bad4e74ee`
`BPF_FUNC_bprm_opts_set()` | 5.11 |  | `3f6719c7b62f`
`BPF_FUNC_btf_find_by_name_kind()` | 5.14 |  | `3d78417b60fb`
`BPF_FUNC_cgrp_storage_delete()` | 6.2 |  | `c4bcfb38a95e`
`BPF_FUNC_cgrp_storage_get()` | 6.2 |  | `c4bcfb38a95e`
`BPF_FUNC_check_mtu()` | 5.12 |  | `34b2021cc616`
`BPF_FUNC_clone_redirect()` | 4.2 |  | `3896d655f4d4`
`BPF_FUNC_copy_from_user()` | 5.10 |  | `07be4c4a3e7a`
`BPF_FUNC_copy_from_user_task()` | 5.18 | GPL | `376040e47334`
`BPF_FUNC_csum_diff()` | 4.6 |  | `7d672345ed29`
`BPF_FUNC_csum_level()` | 5.7 |  | `7cdec54f9713`
`BPF_FUNC_csum_update()` | 4.9 |  | `36bbef52c7eb`
`BPF_FUNC_current_task_under_cgroup()` | 4.9 |  | `60d20f9195b2`
`BPF_FUNC_d_path()` | 5.10 |  | `6e22ab9da793`
`BPF_FUNC_dynptr_data()` | 5.19 |  | `34d4ef5775f7`
`BPF_FUNC_dynptr_from_mem()` | 5.19 |  | `263ae152e962`
`BPF_FUNC_dynptr_read()` | 5.19 |  | `13bbbfbea759`
`BPF_FUNC_dynptr_write()` | 5.19 |  | `13bbbfbea759`
`BPF_FUNC_fib_lookup()` | 4.18 | GPL | `87f5fc7e48dd`
`BPF_FUNC_find_vma()` | 5.17 |  | `7c7e3d31e785`
`BPF_FUNC_for_each_map_elem()` | 5.13 |  | `69c087ba6225`
`BPF_FUNC_get_attach_cookie()` | 5.15 |  | `7adfc6c9b315`
`BPF_FUNC_get_branch_snapshot()` | 5.16 | GPL | `856c02dbce4f`
`BPF_FUNC_get_current_ancestor_cgroup_id()` | 5.6 |  | `b4490c5c4e02`
`BPF_FUNC_get_cgroup_classid()` | 4.3 |  | `8d20aabe1c76`
`BPF_FUNC_get_current_cgroup_id()` | 4.18 |  | `bf6fa2c893c5`
`BPF_FUNC_get_current_comm()` | 4.2 |  | `ffeedafbf023`
`BPF_FUNC_get_current_pid_tgid()` | 4.2 |  | `ffeedafbf023`
`BPF_FUNC_get_current_task()` | 4.8 | GPL | `606274c5abd8`
`BPF_FUNC_get_current_task_btf()` | 5.11 | GPL | `3ca1032ab7ab`
`BPF_FUNC_get_current_uid_gid()` | 4.2 |  | `ffeedafbf023`
`BPF_FUNC_get_func_arg()` | 5.17 |  | `f92c1e183604`
`BPF_FUNC_get_func_arg_cnt()` | 5.17 |  | `f92c1e183604`
`BPF_FUNC_get_func_ip()` | 5.15 |  | `5d8b583d04ae`
`BPF_FUNC_get_func_ret()` | 5.17 |  | `f92c1e183604`
`BPF_FUNC_get_retval()` | 5.18 |  | `b44123b4a3dc`
`BPF_FUNC_get_hash_recalc()` | 4.8 |  | `13c5c240f789`
`BPF_FUNC_get_listener_sock()` | 5.1 |  | `dbafd7ddd623`
`BPF_FUNC_get_local_storage()` | 4.19 |  | `cd3394317653`
`BPF_FUNC_get_netns_cookie()` | 5.7 |  | `f318903c0bf4`
`BPF_FUNC_get_ns_current_pid_tgid()` | 5.7 |  | `b4490c5c4e02`
`BPF_FUNC_get_numa_node_id()` | 4.10 |  | `2d0e30c30f84`
`BPF_FUNC_get_prandom_u32()` | 4.1 |  | `03e69b508b6f`
`BPF_FUNC_get_route_realm()` | 4.4 |  | `c46646d0484f`
`BPF_FUNC_get_smp_processor_id()` | 4.1 |  | `c04167ce2ca0`
`BPF_FUNC_get_socket_cookie()` | 4.12 |  | `91b8270f2a4d`
`BPF_FUNC_get_socket_uid()` | 4.12 |  | `6acc5c291068`
`BPF_FUNC_get_stack()` | 4.18 | GPL | `de2ff05f48af`
`BPF_FUNC_get_stackid()` | 4.6 | GPL | `d5a3b1f69186`
`BPF_FUNC_get_task_stack()` | 5.9 |  | `fa28dcb82a38`
`BPF_FUNC_getsockopt()` | 4.15 |  | `cd86d1fd2102`
`BPF_FUNC_ima_file_hash()` | 5.18 |  | `174b16946e39`
`BPF_FUNC_ima_inode_hash()` | 5.11 |  | `27672f0d280a`
`BPF_FUNC_inode_storage_delete()` | 5.10 |  | `8ea636848aca`
`BPF_FUNC_inode_storage_get()` | 5.10 |  | `8ea636848aca`
`BPF_FUNC_jiffies64()` | 5.5 |  | `5576b991e9c1`
`BPF_FUNC_kallsyms_lookup_name()` | 5.16 |  | `d6aef08a872b`
`BPF_FUNC_kptr_xchg()` | 5.19 |  | `c0a5a21c25f3`
`BPF_FUNC_ktime_get_boot_ns()` | 5.8 |  | `71d19214776e`
`BPF_FUNC_ktime_get_coarse_ns()` | 5.11 |  | `d05512618056`
`BPF_FUNC_ktime_get_ns()` | 4.1 |  | `d9847d310ab4`
`BPF_FUNC_ktime_get_tai_ns()` | 6.1 |  | `c8996c98f703`
`BPF_FUNC_l3_csum_replace()` | 4.1 |  | `91bc4822c3d6`
`BPF_FUNC_l4_csum_replace()` | 4.1 |  | `91bc4822c3d6`
`BPF_FUNC_load_hdr_opt()` | 5.10 |  | `0813a841566f`
`BPF_FUNC_loop()` | 5.17 |  | `e6f2dd0f8067`
`BPF_FUNC_lwt_push_encap()` | 4.18 |  | `fe94cc290f53`
`BPF_FUNC_lwt_seg6_action()` | 4.18 |  | `fe94cc290f53`
`BPF_FUNC_lwt_seg6_adjust_srh()` | 4.18 |  | `fe94cc290f53`
`BPF_FUNC_lwt_seg6_store_bytes()` | 4.18 |  | `fe94cc290f53`
`BPF_FUNC_map_delete_elem()` | 3.19 |  | `d0003ec01c66`
`BPF_FUNC_map_lookup_elem()` | 3.19 |  | `d0003ec01c66`
`BPF_FUNC_map_lookup_percpu_elem()` | 5.19 |  | `07343110b293`
`BPF_FUNC_map_peek_elem()` | 4.20 |  | `f1a2e44a3aec`
`BPF_FUNC_map_pop_elem()` | 4.20 |  | `f1a2e44a3aec`
`BPF_FUNC_map_push_elem()` | 4.20 |  | `f1a2e44a3aec`
`BPF_FUNC_map_update_elem()` | 3.19 |  | `d0003ec01c66`
`BPF_FUNC_msg_apply_bytes()` | 4.17 |  | `2a100317c9eb`
`BPF_FUNC_msg_cork_bytes()` | 4.17 |  | `91843d540a13`
`BPF_FUNC_msg_pop_data()` | 5.0 |  | `7246d8ed4dcc`
`BPF_FUNC_msg_pull_data()` | 4.17 |  | `015632bb30da`
`BPF_FUNC_msg_push_data()` | 4.20 |  | `6fff607e2f14`
`BPF_FUNC_msg_redirect_hash()` | 4.18 |  | `81110384441a`
`BPF_FUNC_msg_redirect_map()` | 4.17 |  | `4f738adba30a`
`BPF_FUNC_per_cpu_ptr()` | 5.10 |  | `eaa6bcb71ef6`
`BPF_FUNC_perf_event_output()` | 4.4 | GPL | `a43eec304259`
`BPF_FUNC_perf_event_read()` | 4.3 | GPL | `35578d798400`
`BPF_FUNC_perf_event_read_value()` | 4.15 | GPL | `908432ca84fc`
`BPF_FUNC_perf_prog_read_value()` | 4.15 | GPL | `4bebdc7a85aa`
`BPF_FUNC_probe_read()` | 4.1 | GPL | `2541517c32be`
`BPF_FUNC_probe_read_kernel()` | 5.5 | GPL | `6ae08ae3dea2`
`BPF_FUNC_probe_read_kernel_str()` | 5.5 | GPL | `6ae08ae3dea2`
`BPF_FUNC_probe_read_user()` | 5.5 | GPL | `6ae08ae3dea2`
`BPF_FUNC_probe_read_user_str()` | 5.5 | GPL | `6ae08ae3dea2`
`BPF_FUNC_probe_read_str()` | 4.11 | GPL | `a5e8c07059d0`
`BPF_FUNC_probe_write_user()` | 4.8 | GPL | `96ae52279594`
`BPF_FUNC_rc_keydown()` | 4.18 | GPL | `f4364dcfc86d`
`BPF_FUNC_rc_pointer_rel()` | 5.0 | GPL | `01d3240a04f4`
`BPF_FUNC_rc_repeat()` | 4.18 | GPL | `f4364dcfc86d`
`BPF_FUNC_read_branch_records()` | 5.6 | GPL | `fff7b64355ea`
`BPF_FUNC_redirect()` | 4.4 |  | `27b29f63058d`
`BPF_FUNC_redirect_map()` | 4.14 |  | `97f91a7cf04f`
`BPF_FUNC_redirect_neigh()` | 5.10 |  | `b4ab31414970`
`BPF_FUNC_redirect_peer()` | 5.10 |  | `9aa1206e8f48`
`BPF_FUNC_reserve_hdr_opt()` | 5.10 |  | `0813a841566f`
`BPF_FUNC_ringbuf_discard()` | 5.8 |  | `457f44363a88`
`BPF_FUNC_ringbuf_discard_dynptr()` | 5.19 |  | `bc34dee65a65`
`BPF_FUNC_ringbuf_output()` | 5.8 |  | `457f44363a88`
`BPF_FUNC_ringbuf_query()` | 5.8 |  | `457f44363a88`
`BPF_FUNC_ringbuf_reserve()` | 5.8 |  | `457f44363a88`
`BPF_FUNC_ringbuf_reserve_dynptr()` | 5.19 |  | `bc34dee65a65`
`BPF_FUNC_ringbuf_submit()` | 5.8 |  | `457f44363a88`
`BPF_FUNC_ringbuf_submit_dynptr()` | 5.19 |  | `bc34dee65a65`
`BPF_FUNC_send_signal()` | 5.3 |  | `8b401f9ed244`
`BPF_FUNC_send_signal_thread()` | 5.5 |  | `8482941f0906`
`BPF_FUNC_seq_printf()` | 5.7 | GPL | `492e639f0c22`
`BPF_FUNC_seq_printf_btf()` | 5.10 |  | `eb411377aed9`
`BPF_FUNC_seq_write()` | 5.7 | GPL | `492e639f0c22`
`BPF_FUNC_set_hash()` | 4.13 |  | `ded092cd73c2`
`BPF_FUNC_set_hash_invalid()` | 4.9 |  | `7a4b28c6cc9f`
`BPF_FUNC_set_retval()` | 5.18 |  | `b44123b4a3dc`
`BPF_FUNC_setsockopt()` | 4.13 |  | `8c4b4c7e9ff0`
`BPF_FUNC_sk_ancestor_cgroup_id()` | 5.7 |  | `f307fa2cb4c9`
`BPF_FUNC_sk_assign()` | 5.6 |  | `cf7fbe660f2d`
`BPF_FUNC_sk_cgroup_id()` | 5.7 |  | `f307fa2cb4c9`
`BPF_FUNC_sk_fullsock()` | 5.1 |  | `46f8bc92758c`
`BPF_FUNC_sk_lookup_tcp()` | 4.20 |  | `6acc9b432e67`
`BPF_FUNC_sk_lookup_udp()` | 4.20 |  | `6acc9b432e67`
`BPF_FUNC_sk_redirect_hash()` | 4.18 |  | `81110384441a`
`BPF_FUNC_sk_redirect_map()` | 4.14 |  | `174a79ff9515`
`BPF_FUNC_sk_release()` | 4.20 |  | `6acc9b432e67`
`BPF_FUNC_sk_select_reuseport()` | 4.19 |  | `2dbb9b9e6df6`
`BPF_FUNC_sk_storage_delete()` | 5.2 |  | `6ac99e8f23d4`
`BPF_FUNC_sk_storage_get()` | 5.2 |  | `6ac99e8f23d4`
`BPF_FUNC_skb_adjust_room()` | 4.13 |  | `2be7e212d541`
`BPF_FUNC_skb_ancestor_cgroup_id()` | 4.19 |  | `7723628101aa`
`BPF_FUNC_skb_change_head()` | 4.10 |  | `3a0af8fd61f9`
`BPF_FUNC_skb_change_proto()` | 4.8 |  | `6578171a7ff0`
`BPF_FUNC_skb_change_tail()` | 4.9 |  | `5293efe62df8`
`BPF_FUNC_skb_change_type()` | 4.8 |  | `d2485c4242a8`
`BPF_FUNC_skb_cgroup_classid()` | 5.10 |  | `b426ce83baa7`
`BPF_FUNC_skb_cgroup_id()` | 4.18 |  | `cb20b08ead40`
`BPF_FUNC_skb_ecn_set_ce()` | 5.1 |  | `f7c917ba11a6`
`BPF_FUNC_skb_get_tunnel_key()` | 4.3 |  | `d3aa45ce6b94`
`BPF_FUNC_skb_get_tunnel_opt()` | 4.6 |  | `14ca0751c96f`
`BPF_FUNC_skb_get_xfrm_state()` | 4.18 |  | `12bed760a78d`
`BPF_FUNC_skb_load_bytes()` | 4.5 |  | `05c74e5e53f6`
`BPF_FUNC_skb_load_bytes_relative()` | 4.18 |  | `4e1ec56cdc59`
`BPF_FUNC_skb_output()` | 5.5 |  | `a7658e1a4164`
`BPF_FUNC_skb_pull_data()` | 4.9 |  | `36bbef52c7eb`
`BPF_FUNC_skb_set_tstamp()` | 5.18 |  | `9bb984f28d5b`
`BPF_FUNC_skb_set_tunnel_key()` | 4.3 |  | `d3aa45ce6b94`
`BPF_FUNC_skb_set_tunnel_opt()` | 4.6 |  | `14ca0751c96f`
`BPF_FUNC_skb_store_bytes()` | 4.1 |  | `91bc4822c3d6`
`BPF_FUNC_skb_under_cgroup()` | 4.8 |  | `4a482f34afcc`
`BPF_FUNC_skb_vlan_pop()` | 4.3 |  | `4e10df9a60d9`
`BPF_FUNC_skb_vlan_push()` | 4.3 |  | `4e10df9a60d9`
`BPF_FUNC_skc_lookup_tcp()` | 5.2 |  | `edbf8c01de5a`
`BPF_FUNC_skc_to_mctcp_sock()` | 5.19 |  | `3bc253c2e652`
`BPF_FUNC_skc_to_tcp_sock()` | 5.9 |  | `478cfbdf5f13`
`BPF_FUNC_skc_to_tcp_request_sock()` | 5.9 |  | `478cfbdf5f13`
`BPF_FUNC_skc_to_tcp_timewait_sock()` | 5.9 |  | `478cfbdf5f13`
`BPF_FUNC_skc_to_tcp6_sock()` | 5.9 |  | `af7ec1383361`
`BPF_FUNC_skc_to_udp6_sock()` | 5.9 |  | `0d4fad3e57df`
`BPF_FUNC_skc_to_unix_sock()` | 5.16 |  | `9eeb3aa33ae0`
`BPF_FUNC_snprintf()` | 5.13 |  | `7b15523a989b`
`BPF_FUNC_snprintf_btf()` | 5.10 |  | `c4d0bfb45068`
`BPF_FUNC_sock_from_file()` | 5.11 |  | `4f19cab76136`
`BPF_FUNC_sock_hash_update()` | 4.18 |  | `81110384441a`
`BPF_FUNC_sock_map_update()` | 4.14 |  | `174a79ff9515`
`BPF_FUNC_spin_lock()` | 5.1 |  | `d83525ca62cf`
`BPF_FUNC_spin_unlock()` | 5.1 |  | `d83525ca62cf`
`BPF_FUNC_store_hdr_opt()` | 5.10 |  | `0813a841566f`
`BPF_FUNC_strncmp()` | 5.17 |  | `c5fb19937455`
`BPF_FUNC_strtol()` | 5.2 |  | `d7a4cb9b6705`
`BPF_FUNC_strtoul()` | 5.2 |  | `d7a4cb9b6705`
`BPF_FUNC_sys_bpf()` | 5.14 |  | `79a7f8bdb159`
`BPF_FUNC_sys_close()` | 5.14 |  | `3abea089246f`
`BPF_FUNC_sysctl_get_current_value()` | 5.2 |  | `1d11b3016cec`
`BPF_FUNC_sysctl_get_name()` | 5.2 |  | `808649fb787d`
`BPF_FUNC_sysctl_get_new_value()` | 5.2 |  | `4e63acdff864`
`BPF_FUNC_sysctl_set_new_value()` | 5.2 |  | `4e63acdff864`
`BPF_FUNC_tail_call()` | 4.2 |  | `04fd61ab36ec`
`BPF_FUNC_task_pt_regs()` | 5.15 | GPL | `dd6e10fbd9f`
`BPF_FUNC_task_storage_delete()` | 5.11 |  | `4cf1bc1f1045`
`BPF_FUNC_task_storage_get()` | 5.11 |  | `4cf1bc1f1045`
`BPF_FUNC_tcp_check_syncookie()` | 5.2 |  | `399040847084`
`BPF_FUNC_tcp_gen_syncookie()` | 5.3 |  | `70d66244317e`
`BPF_FUNC_tcp_raw_check_syncookie_ipv4()` | 6.0 |  | `33bf9885040c`
`BPF_FUNC_tcp_raw_check_syncookie_ipv6()` | 6.0 |  | `33bf9885040c`
`BPF_FUNC_tcp_raw_gen_syncookie_ipv4()` | 6.0 |  | `33bf9885040c`
`BPF_FUNC_tcp_raw_gen_syncookie_ipv6()` | 6.0 |  | `33bf9885040c`
`BPF_FUNC_tcp_send_ack()` | 5.5 |  | `206057fe020a`
`BPF_FUNC_tcp_sock()` | 5.1 |  | `655a51e536c0`
`BPF_FUNC_this_cpu_ptr()` | 5.10 |  | `63d9b80dcf2c`
`BPF_FUNC_timer_init()` | 5.15 |  | `b00628b1c7d5`
`BPF_FUNC_timer_set_callback()` | 5.15 |  | `b00628b1c7d5`
`BPF_FUNC_timer_start()` | 5.15 |  | `b00628b1c7d5`
`BPF_FUNC_timer_cancel()` | 5.15 |  | `b00628b1c7d5`
`BPF_FUNC_trace_printk()` | 4.1 | GPL | `9c959c863f82`
`BPF_FUNC_trace_vprintk()` | 5.16 | GPL | `10aceb629e19`
`BPF_FUNC_user_ringbuf_drain()` | 6.1 |  | `205715673844`
`BPF_FUNC_xdp_adjust_head()` | 4.10 |  | `17bedab27231`
`BPF_FUNC_xdp_adjust_meta()` | 4.15 |  | `de8f3a83b0a0`
`BPF_FUNC_xdp_adjust_tail()` | 4.18 |  | `b32cc5b9a346`
`BPF_FUNC_xdp_get_buff_len()` | 5.18 |  | `0165cc817075`
`BPF_FUNC_xdp_load_bytes()` | 5.18 |  | `3f364222d032`
`BPF_FUNC_xdp_store_bytes()` | 5.18 |  | `3f364222d032`
`BPF_FUNC_xdp_output()` | 5.6 | GPL | `d831ee84bfc9`
`BPF_FUNC_override_return()` | 4.16 | GPL | `9802d86585db`
`BPF_FUNC_sock_ops_cb_flags_set()` | 4.16 |  | `b13d88072172`

Note: GPL-only BPF helpers require a GPL-compatible license. The current licenses considered GPL-compatible by the kernel are:

- GPL
- GPL v2
- GPL and additional rights
- Dual BSD/GPL
- Dual MIT/GPL
- Dual MPL/GPL

Check the list of GPL-compatible licenses in your kernel source code.

## Program Types

The list of program types and supported helper functions can be retrieved with:

    git grep -W 'func_proto(enum bpf_func_id func_id' kernel/ net/ drivers/

Program Type | Helper Functions
--- | ---
`BPF_PROG_TYPE_SOCKET_FILTER` | `BPF_FUNC_skb_load_bytes()` `BPF_FUNC_skb_load_bytes_relative()` `BPF_FUNC_get_socket_cookie()` `BPF_FUNC_get_socket_uid()` `BPF_FUNC_perf_event_output()` `Base functions`
`BPF_PROG_TYPE_KPROBE` | `BPF_FUNC_perf_event_output()` `BPF_FUNC_get_stackid()` `BPF_FUNC_get_stack()` `BPF_FUNC_perf_event_read_value()` `BPF_FUNC_override_return()` `Tracing functions`

`BPF_PROG_TYPE_SCHED_CLS`
`BPF_PROG_TYPE_SCHED_ACT`

`BPF_FUNC_skb_store_bytes()`
`BPF_FUNC_skb_load_bytes()`
`BPF_FUNC_skb_load_bytes_relative()`
`BPF_FUNC_skb_pull_data()`
`BPF_FUNC_csum_diff()`
`BPF_FUNC_csum_update()`
`BPF_FUNC_l3_csum_replace()`
`BPF_FUNC_l4_csum_replace()`
`BPF_FUNC_clone_redirect()`
`BPF_FUNC_get_cgroup_classid()`
`BPF_FUNC_skb_vlan_push()`
`BPF_FUNC_skb_vlan_pop()`
`BPF_FUNC_skb_change_proto()`
`BPF_FUNC_skb_change_type()`
`BPF_FUNC_skb_adjust_room()`
`BPF_FUNC_skb_change_tail()`
`BPF_FUNC_skb_get_tunnel_key()`
`BPF_FUNC_skb_set_tunnel_key()`
`BPF_FUNC_skb_get_tunnel_opt()`
`BPF_FUNC_skb_set_tunnel_opt()`
`BPF_FUNC_redirect()`
`BPF_FUNC_get_route_realm()`
`BPF_FUNC_get_hash_recalc()`
`BPF_FUNC_set_hash_invalid()`
`BPF_FUNC_set_hash()`
`BPF_FUNC_perf_event_output()`
`BPF_FUNC_get_smp_processor_id()`
`BPF_FUNC_skb_under_cgroup()`
`BPF_FUNC_get_socket_cookie()`
`BPF_FUNC_get_socket_uid()`
`BPF_FUNC_fib_lookup()`
`BPF_FUNC_skb_get_xfrm_state()`
`BPF_FUNC_skb_cgroup_id()`
`Base functions`

`BPF_PROG_TYPE_TRACEPOINT` | `BPF_FUNC_perf_event_output()` `BPF_FUNC_get_stackid()` `BPF_FUNC_get_stack()` `BPF_FUNC_d_path()` `Tracing functions`
`BPF_PROG_TYPE_XDP` | `BPF_FUNC_perf_event_output()` `BPF_FUNC_get_smp_processor_id()` `BPF_FUNC_csum_diff()` `BPF_FUNC_xdp_adjust_head()` `BPF_FUNC_xdp_adjust_meta()` `BPF_FUNC_redirect()` `BPF_FUNC_redirect_map()` `BPF_FUNC_xdp_adjust_tail()` `BPF_FUNC_fib_lookup()` `Base functions`
`BPF_PROG_TYPE_PERF_EVENT` | `BPF_FUNC_perf_event_output()` `BPF_FUNC_get_stackid()` `BPF_FUNC_get_stack()` `BPF_FUNC_perf_prog_read_value()` `Tracing functions`
`BPF_PROG_TYPE_CGROUP_SKB` | `BPF_FUNC_skb_load_bytes()` `BPF_FUNC_skb_load_bytes_relative()` `BPF_FUNC_get_socket_cookie()` `BPF_FUNC_get_socket_uid()` `Base functions`
`BPF_PROG_TYPE_CGROUP_SOCK` | `BPF_FUNC_get_current_uid_gid()` `Base functions`
`BPF_PROG_TYPE_LWT_IN` | `BPF_FUNC_lwt_push_encap()` `LWT functions` `Base functions`
`BPF_PROG_TYPE_LWT_OUT` | `LWT functions` `Base functions`

`BPF_PROG_TYPE_LWT_XMIT`

`BPF_FUNC_skb_get_tunnel_key()`
`BPF_FUNC_skb_set_tunnel_key()`
`BPF_FUNC_skb_get_tunnel_opt()`
`BPF_FUNC_skb_set_tunnel_opt()`
`BPF_FUNC_redirect()`
`BPF_FUNC_clone_redirect()`
`BPF_FUNC_skb_change_tail()`
`BPF_FUNC_skb_change_head()`
`BPF_FUNC_skb_store_bytes()`
`BPF_FUNC_csum_update()`
`BPF_FUNC_l3_csum_replace()`
`BPF_FUNC_l4_csum_replace()`
`BPF_FUNC_set_hash_invalid()`
`LWT functions`

`BPF_PROG_TYPE_SOCK_OPS` | `BPF_FUNC_setsockopt()` `BPF_FUNC_getsockopt()` `BPF_FUNC_sock_ops_cb_flags_set()` `BPF_FUNC_sock_map_update()` `BPF_FUNC_sock_hash_update()` `BPF_FUNC_get_socket_cookie()` `Base functions`
`BPF_PROG_TYPE_SK_SKB` | `BPF_FUNC_skb_store_bytes()` `BPF_FUNC_skb_load_bytes()` `BPF_FUNC_skb_pull_data()` `BPF_FUNC_skb_change_tail()` `BPF_FUNC_skb_change_head()` `BPF_FUNC_get_socket_cookie()` `BPF_FUNC_get_socket_uid()` `BPF_FUNC_sk_redirect_map()` `BPF_FUNC_sk_redirect_hash()` `BPF_FUNC_sk_lookup_tcp()` `BPF_FUNC_sk_lookup_udp()` `BPF_FUNC_sk_release()` `Base functions`
`BPF_PROG_TYPE_CGROUP_DEVICE` | `BPF_FUNC_map_lookup_elem()` `BPF_FUNC_map_update_elem()` `BPF_FUNC_map_delete_elem()` `BPF_FUNC_get_current_uid_gid()` `BPF_FUNC_trace_printk()`
`BPF_PROG_TYPE_SK_MSG` | `BPF_FUNC_msg_redirect_map()` `BPF_FUNC_msg_redirect_hash()` `BPF_FUNC_msg_apply_bytes()` `BPF_FUNC_msg_cork_bytes()` `BPF_FUNC_msg_pull_data()` `BPF_FUNC_msg_push_data()` `BPF_FUNC_msg_pop_data()` `Base functions`
`BPF_PROG_TYPE_RAW_TRACEPOINT` | `BPF_FUNC_perf_event_output()` `BPF_FUNC_get_stackid()` `BPF_FUNC_get_stack()` `BPF_FUNC_skb_output()` `Tracing functions`
`BPF_PROG_TYPE_CGROUP_SOCK_ADDR` | `BPF_FUNC_get_current_uid_gid()` `BPF_FUNC_bind()` `BPF_FUNC_get_socket_cookie()` `Base functions`
`BPF_PROG_TYPE_LWT_SEG6LOCAL` | `BPF_FUNC_lwt_seg6_store_bytes()` `BPF_FUNC_lwt_seg6_action()` `BPF_FUNC_lwt_seg6_adjust_srh()` `LWT functions`
`BPF_PROG_TYPE_LIRC_MODE2` | `BPF_FUNC_rc_repeat()` `BPF_FUNC_rc_keydown()` `BPF_FUNC_rc_pointer_rel()` `BPF_FUNC_map_lookup_elem()` `BPF_FUNC_map_update_elem()` `BPF_FUNC_map_delete_elem()` `BPF_FUNC_ktime_get_ns()` `BPF_FUNC_tail_call()` `BPF_FUNC_get_prandom_u32()` `BPF_FUNC_trace_printk()`
`BPF_PROG_TYPE_SK_REUSEPORT` | `BPF_FUNC_sk_select_reuseport()` `BPF_FUNC_skb_load_bytes()` `BPF_FUNC_load_bytes_relative()` `Base functions`
`BPF_PROG_TYPE_FLOW_DISSECTOR` | `BPF_FUNC_skb_load_bytes()` `Base functions`

Function Group | Functions
--- | ---

`Base functions`

`BPF_FUNC_map_lookup_elem()`
`BPF_FUNC_map_update_elem()`
`BPF_FUNC_map_delete_elem()`
`BPF_FUNC_map_peek_elem()`
`BPF_FUNC_map_pop_elem()`
`BPF_FUNC_map_push_elem()`
`BPF_FUNC_get_prandom_u32()`
`BPF_FUNC_get_smp_processor_id()`
`BPF_FUNC_get_numa_node_id()`
`BPF_FUNC_tail_call()`
`BPF_FUNC_ktime_get_boot_ns()`
`BPF_FUNC_ktime_get_ns()`
`BPF_FUNC_trace_printk()`
`BPF_FUNC_spin_lock()`
`BPF_FUNC_spin_unlock()`

`Tracing functions`

`BPF_FUNC_map_lookup_elem()`
`BPF_FUNC_map_update_elem()`
`BPF_FUNC_map_delete_elem()`
`BPF_FUNC_probe_read()`
`BPF_FUNC_ktime_get_boot_ns()`
`BPF_FUNC_ktime_get_ns()`
`BPF_FUNC_tail_call()`
`BPF_FUNC_get_current_pid_tgid()`
`BPF_FUNC_get_current_task()`
`BPF_FUNC_get_current_uid_gid()`
`BPF_FUNC_get_current_comm()`
`BPF_FUNC_trace_printk()`
`BPF_FUNC_get_smp_processor_id()`
`BPF_FUNC_get_numa_node_id()`
`BPF_FUNC_perf_event_read()`
`BPF_FUNC_probe_write_user()`
`BPF_FUNC_current_task_under_cgroup()`
`BPF_FUNC_get_prandom_u32()`
`BPF_FUNC_probe_read_str()`
`BPF_FUNC_get_current_cgroup_id()`
`BPF_FUNC_send_signal()`
`BPF_FUNC_probe_read_kernel()`
`BPF_FUNC_probe_read_kernel_str()`
`BPF_FUNC_probe_read_user()`
`BPF_FUNC_probe_read_user_str()`
`BPF_FUNC_send_signal_thread()`
`BPF_FUNC_get_ns_current_pid_tgid()`
`BPF_FUNC_xdp_output()`
`BPF_FUNC_get_task_stack()`

`LWT functions` | `BPF_FUNC_skb_load_bytes()` `BPF_FUNC_skb_pull_data()` `BPF_FUNC_csum_diff()` `BPF_FUNC_get_cgroup_classid()` `BPF_FUNC_get_route_realm()` `BPF_FUNC_get_hash_recalc()` `BPF_FUNC_perf_event_output()` `BPF_FUNC_get_smp_processor_id()` `BPF_FUNC_skb_under_cgroup()`