diff --git a/docs/kernel-versions.md b/docs/kernel-versions.md index 9d6213467d5d..ab9982aeae86 100644 --- a/docs/kernel-versions.md +++ b/docs/kernel-versions.md @@ -232,3 +232,36 @@ Note: GPL-only BPF helpers require a GPL-compatible license. The current license * Dual MPL/GPL Check the list of GPL-compatible licenses in your [kernel source code](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/license.h). + +## 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_get_current_uid_gid()`
`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()`
`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()`
`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()`
`Base functions`| +|`BPF_PROG_TYPE_RAW_TRACEPOINT`|`BPF_FUNC_perf_event_output()`
`BPF_FUNC_get_stackid()`
`BPF_FUNC_get_stack()`
`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_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()`| + +|Function Group| Functions| +|------------------|-------| +|`Base functions`| `BPF_FUNC_map_lookup_elem()`
`BPF_FUNC_map_update_elem()`
`BPF_FUNC_map_delete_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_ns()`
`BPF_FUNC_trace_printk()`| +|`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_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()` | +|`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()`|