Lines Matching +full:fn +full:- +full:keymap
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com
21 #define BPF_DW 0x18 /* double word (64-bit) */
22 #define BPF_ATOMIC 0xc0 /* atomic memory ops - op type in immediate */
23 #define BPF_XADD 0xc0 /* exclusive add - legacy name */
31 #define BPF_TO_LE 0x00 /* convert to little-endian */
32 #define BPF_TO_BE 0x08 /* convert to big-endian */
50 #define BPF_CMPXCHG (0xf0 | BPF_FETCH) /* atomic compare-and-write */
68 /* BPF has 10 general purpose 64-bit registers and stack frame. */
93 BPF_CGROUP_ITER_DESCENDANTS_PRE, /* walk descendants in pre-order. */
94 BPF_CGROUP_ITER_DESCENDANTS_POST, /* walk descendants in post-order. */
105 /* At most one of cgroup_fd and cgroup_id can be non-zero. If
121 /* BPF syscall commands, see bpf(2) man-page for more details. */
136 * map. The close-on-exec file descriptor flag (see **fcntl**\ (2))
143 * A new file descriptor (a nonnegative integer), or -1 if an
155 * Look up the value of a spin-locked map without
160 * Returns zero on success. On error, -1 is returned and *errno*
177 * Update a spin_lock-ed map element.
180 * Returns zero on success. On error, -1 is returned and *errno*
201 * Returns zero on success. On error, -1 is returned and *errno*
211 * Returns zero on success. On error, -1 is returned and *errno*
221 * * If *key* is the last element, returns -1 and *errno* is set
235 * The close-on-exec file descriptor flag (see **fcntl**\ (2)) is
239 * A new file descriptor (a nonnegative integer), or -1 if an
264 * Returns zero on success. On error, -1 is returned and *errno*
273 * A new file descriptor (a nonnegative integer), or -1 if an
319 * Returns zero on success. On error, -1 is returned and *errno*
329 * Returns zero on success. On error, -1 is returned and *errno*
361 * Returns zero on success. On error, -1 is returned and *errno*
376 * remain with ids higher than *start_id*, returns -1 and sets
380 * Returns zero on success. On error, or when no id remains, -1
389 * remain with ids higher than *start_id*, returns -1 and sets
393 * Returns zero on success. On error, or when no id remains, -1
402 * A new file descriptor (a nonnegative integer), or -1 if an
411 * A new file descriptor (a nonnegative integer), or -1 if an
429 * Returns zero on success. On error, -1 is returned and *errno*
475 * Returns zero on success. On error, -1 is returned and *errno*
493 * A new file descriptor (a nonnegative integer), or -1 if an
516 * A new file descriptor (a nonnegative integer), or -1 if an
525 * A new file descriptor (a nonnegative integer), or -1 if an
546 * Returns zero on success. On error, -1 is returned and *errno*
559 * Look up and delete the value of a spin-locked map
578 * Returns zero on success. On error, -1 is returned and *errno*
593 * Returns zero on success. On error, -1 is returned and *errno*
603 * remain with ids higher than *start_id*, returns -1 and sets
607 * Returns zero on success. On error, or when no id remains, -1
631 * Look up the value of a spin-locked map without
643 * Returns zero on success. On error, -1 is returned and *errno*
648 * iteration of a hash-based map type.
665 * Returns zero on success. On error, -1 is returned and *errno*
692 * Update spin_lock-ed map elements. This must be
701 * Returns zero on success. On error, -1 is returned and *errno*
735 * Look up the value of a spin-locked map without
747 * Returns zero on success. On error, -1 is returned and *errno*
757 * A new file descriptor (a nonnegative integer), or -1 if an
766 * Returns zero on success. On error, -1 is returned and *errno*
775 * A new file descriptor (a nonnegative integer), or -1 if an
784 * remain with ids higher than *start_id*, returns -1 and sets
788 * Returns zero on success. On error, or when no id remains, -1
803 * disabled system-wide when all outstanding file descriptors
807 * A new file descriptor (a nonnegative integer), or -1 if an
822 * A new file descriptor (a nonnegative integer), or -1 if an
831 * Returns zero on success. On error, -1 is returned and *errno*
846 * Returns zero on success. On error, -1 is returned and *errno*
1048 /* cgroup-bpf attach flags used in BPF_PROG_ATTACH command
1052 * BPF_F_ALLOW_OVERRIDE: If a sub-cgroup installs some bpf program,
1053 * the program in this cgroup yields to sub-cgroup program.
1055 * BPF_F_ALLOW_MULTI: If a sub-cgroup installs some bpf program,
1066 * The programs of sub-cgroup are executed first, then programs of
1076 * A cgroup with MULTI or OVERRIDE flag allows any attach flags in sub-cgroups.
1077 * A cgroup with NONE doesn't allow any programs in sub-cgroups.
1079 * cgrp1 (MULTI progs A, B) ->
1080 * cgrp2 (OVERRIDE prog C) ->
1081 * cgrp3 (MULTI prog D) ->
1082 * cgrp4 (OVERRIDE prog E) ->
1118 * Verifier does sub-register def/use analysis and identifies instructions whose
1119 * def only matters for low 32-bit, high 32-bit is never referenced later
1120 * through implicit zero extension. Therefore verifier notifies JIT back-ends
1121 * that it is safe to ignore clearing high 32-bit for these instructions. This
1122 * saves some back-ends a lot of code-gen. However such optimization is not
1123 * necessary on some arches, for example x86_64, arm64 etc, whose JIT back-ends
1129 * 32-bit for those instructions who has been identified as safe to ignore them.
1201 /* when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative
1205 /* when bpf_call->src_reg == BPF_PSEUDO_KFUNC_CALL,
1206 * bpf_call->imm == btf_id of a BTF_KIND_FUNC in the running kernel
1215 BPF_F_LOCK = 4, /* spin_lock-ed map_lookup/map_update */
1238 /* Zero-initialize hash function seed. This should only be used for testing. */
1248 /* Enable memory-mapping BPF map */
1318 __u32 btf_vmlinux_value_type_id;/* BTF type_id of a kernel-
1322 /* Any per-map-type extra fields
1324 * BPF_MAP_TYPE_BLOOM_FILTER - the lowest 4 bits indicate the
1382 __u32 attach_btf_id; /* in-kernel BTF type id to attach to */
1461 /* output: per-program attach_flags.
1511 /* black box user-provided value passed through
1527 /* black box user-provided value passed through
1573 * --filename include/uapi/linux/bpf.h > /tmp/bpf-helpers.rst
1574 * $ rst2man /tmp/bpf-helpers.rst > /tmp/bpf-helpers.7
1575 * $ man /tmp/bpf-helpers.7
1635 * This helper is a "printk()-like" facility for debugging. It
1653 * telnet-470 [001] .N.. 419421.045894: 0x00000001: <formatted msg>
1678 * helper will return **-EINVAL** (but print nothing) if it
1694 * Get a pseudo-random number.
1697 * pseudo-random internal state, and cannot be used to infer the
1702 * A random 32-bit unsigned value.
1719 * **BPF_F_INVALIDATE_HASH** (set *skb*\ **->hash**, *skb*\
1720 * **->swhash** and *skb*\ **->l4hash** to 0).
1743 * which does not update the checksum in-place, but offers more
1772 * the checksum is to be computed against a pseudo-header.
1775 * which does not update the checksum in-place, but offers more
1846 * A 64-bit integer containing the current tgid and pid, and
1848 * *current_task*\ **->tgid << 32 \|**
1849 * *current_task*\ **->pid**.
1855 * A 64-bit integer containing the current GID and UID, and
1864 * helper makes sure that the *buf* is NUL-terminated. On failure,
1877 * based on a user-provided identifier for all traffic coming from
1880 * *Documentation/admin-guide/cgroup-v1/net_cls.rst*.
1886 * run on cgroups, which is a cgroup-v2-only feature (a socket can
1938 * in *key*\ **->remote_ipv4** or *key*\ **->remote_ipv6**. Also,
1939 * this struct exposes the *key*\ **->tunnel_id**, which is
2067 * identifier retrieved is a user-provided tag, similar to the
2073 * (see also **tc-bpf(8)**), or alternatively on conventional
2141 * manipulated with *skb*\ **->data** and *skb*\ **->data_end**
2172 * generating a variety of graphs (such as flame graphs or off-cpu
2230 * and retrieving arbitrary TLVs (Type-Length-Value headers) from
2276 * comes down to setting *skb*\ **->pkt_type** to *type*, except
2278 * **->pkt_type** beside this helper. Using a helper here allows
2313 * Retrieve the hash of the packet, *skb*\ **->hash**. If it is
2316 * directly with *skb*\ **->hash**.
2325 * The 32-bit hash.
2340 * security mechanism because of TOC-TOU attacks, but rather to
2341 * debug, divert, and manipulate execution of semi-cooperative
2390 * Pull in non-linear data in case the *skb* is non-linear and not
2400 * are within packet boundaries (test on *skb*\ **->data_end**) is
2402 * data is in non-linear parts of the *skb*. On failure the
2403 * program can just bail out, or in the case of a non-linear
2407 * to pull in once the non-linear parts, then retesting and
2427 * Add the checksum *csum* into *skb*\ **->csum** in case the
2439 * Invalidate the current *skb*\ **->hash**. It can be used after
2481 * Adjust (move) *xdp_md*\ **->data** by *delta* bytes. Note that
2517 * A 8-byte long unique number on success, or 0 if the socket
2525 * A 8-byte long unique number.
2532 * A 8-byte long unique number.
2540 * A 8-byte long unique number or 0 if *sk* is NULL.
2548 * time-wait or a request socket instead), **overflowuid** value
2554 * Set the full hash for *skb* (set the field *skb*\ **->hash**)
2699 * Adjust the address pointed by *xdp_md*\ **->data_meta** by
2701 * operation modifies the address stored in *xdp_md*\ **->data**,
2705 * The use of *xdp_md*\ **->data_meta** is optional and programs
2711 * this up for further post-processing. Since TC works with socket
2745 * **->enabled** and *buf*\ **->running**, respectively) are
2865 * **bpf_sock->bpf_sock_ops_cb_flags & ~BPF_SOCK_OPS_RTO_CB_FLAG)**
2876 * Code **-EINVAL** if the socket is not a full TCP socket;
2916 * *bytes* will be sent and the eBPF program will be re-run with
2924 * a non-zero value, this is not a problem because data is not
2939 * 1-byte long message segments. Obviously, this is bad for
2949 * For socket policies, pull in non-linear data from user space
2950 * for *msg* and set pointers *msg*\ **->data** and *msg*\
2951 * **->data_end** to *start* and *end* bytes offsets into *msg*,
2987 * domain (*addr*\ **->sa_family**) must be **AF_INET** (or
2989 * or **sin6_port**) which triggers IP_BIND_ADDRESS_NO_PORT-like
2991 * port as long as 4-tuple is unique. Passing non-zero port might
2998 * Adjust (move) *xdp_md*\ **->data_end** by *delta* bytes. It is
3013 * **ip-xfrm(8)**) at *index* in XFRM "security path" for *skb*.
3050 * adjusted by adding (sh_addr - sh_offset), where
3066 * The non-negative copied *buf* length equal to or less than
3085 * in socket filters where *skb*\ **->data** does not always point
3123 * was exceeded and output params->mtu_result contains the MTU.
3248 * End.X action: Endpoint with Layer-3 cross-connect.
3293 * translated to a keycode using the rc keymap, and reported as
3322 * to the same 64-bit id.
3335 * A 64-bit integer containing the current cgroup id based
3387 * and if non-**NULL**, released via **bpf_sk_release**\ ().
3395 * **sizeof**\ (*tuple*\ **->ipv4**)
3397 * **sizeof**\ (*tuple*\ **->ipv6**)
3400 * If the *netns* is a negative signed 32-bit integer, then the
3404 * If *netns* is any other signed 32-bit value greater than or
3407 * range of 32-bit integers are reserved for future use.
3417 * result is from *reuse*\ **->socks**\ [] using the hash of the
3424 * and if non-**NULL**, released via **bpf_sk_release**\ ().
3432 * **sizeof**\ (*tuple*\ **->ipv4**)
3434 * **sizeof**\ (*tuple*\ **->ipv6**)
3437 * If the *netns* is a negative signed 32-bit integer, then the
3441 * If *netns* is any other signed 32-bit value greater than or
3444 * range of 32-bit integers are reserved for future use.
3454 * result is from *reuse*\ **->socks**\ [] using the hash of the
3460 * non-**NULL** pointer that was returned from
3550 * allowed inside a spinlock-ed region.
3573 * * **bpf_spin_lock** is not allowed in inner maps of map-in-map.
3622 * and if non-**NULL**, released via **bpf_sk_release**\ ().
3634 * result is from *reuse*\ **->socks**\ [] using the hash of the
3658 * The buffer is always NUL terminated, unless it's zero-sized.
3666 * **-E2BIG** if the buffer wasn't big enough (*buf* will contain
3678 * The buffer is always NUL terminated, unless it's zero-sized.
3682 * **-E2BIG** if the buffer wasn't big enough (*buf* will contain
3685 * **-EINVAL** if current value was unavailable, e.g. because
3686 * sysctl is uninitialized and read returns -EIO for it.
3696 * The buffer is always NUL terminated, unless it's zero-sized.
3700 * **-E2BIG** if the buffer wasn't big enough (*buf* will contain
3703 * **-EINVAL** if sysctl is being read.
3718 * **-E2BIG** if the *buf_len* is too big.
3720 * **-EINVAL** if sysctl is being read.
3730 * optional '**-**' sign.
3741 * **-EINVAL** if no valid digits were found or unsupported base
3744 * **-ERANGE** if resulting value was out of range.
3764 * **-EINVAL** if no valid digits were found or unsupported base
3767 * **-ERANGE** if resulting value was out of range.
3771 * Get a bpf-local-storage from a *sk*.
3781 * the *map*. The *map* is used as the bpf-local-storage
3782 * "type". The bpf-local-storage "type" (i.e. the *map*) is
3783 * searched against all bpf-local-storages residing at *sk*.
3789 * used such that a new bpf-local-storage will be
3792 * the initial value of a bpf-local-storage. If *value* is
3793 * **NULL**, the new bpf-local-storage will be zero initialized.
3795 * A bpf-local-storage pointer is returned on success.
3798 * a new bpf-local-storage.
3802 * Delete a bpf-local-storage from a *sk*.
3806 * **-ENOENT** if the bpf-local-storage cannot be found.
3807 * **-EINVAL** if sk is not a fullsock (e.g. a request_sock).
3816 * **-EBUSY** if work queue under nmi is full.
3818 * **-EINVAL** if *sig* is invalid.
3820 * **-EPERM** if no permission to send the *sig*.
3822 * **-EAGAIN** if bpf program can try again.
3843 * **-EINVAL** SYN cookie cannot be issued due to error
3845 * **-ENOENT** SYN cookie should not be issued (no SYN flood)
3847 * **-EOPNOTSUPP** kernel configuration does not enable SYN cookies
3849 * **-EPROTONOSUPPORT** IP packet version is not 4 or 6
3868 * *ctx* is a pointer to in-kernel struct sk_buff.
3895 * string length is larger than *size*, just *size*-1 bytes are
3910 * ctx->di);
3925 * *current*\ **->mm->arg_start** and *current*\
3926 * **->mm->env_start**: using this helper and the return value,
3943 * Send out a tcp-ack. *tp* is the in-kernel struct **tcp_sock**.
3954 * **-EBUSY** if work queue under nmi is full.
3956 * **-EINVAL** if *sig* is invalid.
3958 * **-EPERM** if no permission to send the *sig*.
3960 * **-EAGAIN** if bpf program can try again.
3982 * **-EINVAL** if arguments invalid or **size** not a multiple
3985 * **-ENOENT** if architecture does not support branch records.
3994 * **-EINVAL** if dev and inum supplied don't match dev_t and inode number
3997 * **-ENOENT** if pidns does not exists for the current task.
4016 * *ctx* is a pointer to in-kernel struct xdp_buff.
4034 * A 8-byte long opaque number.
4073 * **-EINVAL** if specified *flags* are not supported.
4075 * **-ENOENT** if the socket is unavailable for assignment.
4077 * **-ENETUNREACH** if the socket is unreachable (wrong netns).
4079 * **-EOPNOTSUPP** if the operation is not supported, for example
4082 * **-ESOCKTNOSUPPORT** if the socket type is not supported
4098 * that are not v6-only can be selected for IPv4 packets.
4111 * load-balancing within reuseport group for the socket
4114 * On success *ctx->sk* will point to the selected socket.
4119 * * **-EAFNOSUPPORT** if socket family (*sk->family*) is
4120 * not compatible with packet family (*ctx->family*).
4122 * * **-EEXIST** if socket has been already selected,
4126 * * **-EINVAL** if unsupported flags were specified.
4128 * * **-EPROTOTYPE** if socket L4 protocol
4129 * (*sk->protocol*) doesn't match packet protocol
4130 * (*ctx->protocol*).
4132 * * **-ESOCKTNOSUPPORT** if socket is not in allowed
4152 * The *data_len* is the size of *data* in bytes - must be a multiple of 8.
4163 * **-EBUSY** if per-CPU memory copy buffer is busy, can try again
4166 * **-EINVAL** if arguments are invalid, or if *fmt* is invalid/unsupported.
4168 * **-E2BIG** if *fmt* contains too many format specifiers.
4170 * **-EOVERFLOW** if an overflow happened: The same object will be tried again.
4180 * **-EOVERFLOW** if an overflow happened: The same object will be tried again.
4186 * *sk* must be a non-**NULL** pointer to a socket, e.g. one
4224 * An adaptive notification is a notification sent whenever the user-space
4225 * process has caught up and consumed all available payloads. In case the user-space
4302 * * **BPF_CSUM_LEVEL_INC**: Increases skb->csum_level for skbs
4304 * * **BPF_CSUM_LEVEL_DEC**: Decreases skb->csum_level for skbs
4306 * * **BPF_CSUM_LEVEL_RESET**: Resets skb->csum_level to 0 and
4308 * * **BPF_CSUM_LEVEL_QUERY**: No-op, returns the current
4309 * skb->csum_level.
4312 * case of **BPF_CSUM_LEVEL_QUERY**, the current skb->csum_level
4313 * is returned or the error code -EACCES in case the skb is not
4375 * The non-negative copied *buf* length equal to or less than
4384 * *skops*\ **->skb_data**. The comment in **struct bpf_sock_ops**
4386 * *skops*\ **->op**.
4396 * the 2nd byte which is "kind-length" of a TCP
4397 * header option and the "kind-length" also
4398 * includes the first 2 bytes "kind" and "kind-length"
4407 * Note, kind-length must be 0 for regular option.
4409 * Searching for No-Op (0) and End-of-Option-List (1) are
4418 * saved_syn packet or the just-received syn packet.
4425 * **-EINVAL** if a parameter is invalid.
4427 * **-ENOMSG** if the option is not found.
4429 * **-ENOENT** if no syn packet is available when
4432 * **-ENOSPC** if there is not enough space. Only *len* number of
4435 * **-EFAULT** on failure to parse the header options in the
4438 * **-EPERM** if the helper cannot be used under the current
4439 * *skops*\ **->op**.
4447 * includes the kind, kind-length, and the actual
4448 * option data. The *len* must be at least kind-length
4449 * long. The kind-length does not have to be 4 byte
4451 * and setting the 4 bytes aligned value to th->doff.
4462 * **-EINVAL** If param is invalid.
4464 * **-ENOSPC** if there is not enough space in the header.
4467 * **-EEXIST** if the option already exists.
4469 * **-EFAULT** on failure to parse the existing header options.
4471 * **-EPERM** if the helper cannot be used under the current
4472 * *skops*\ **->op**.
4489 * **-EINVAL** if a parameter is invalid.
4491 * **-ENOSPC** if there is not enough space in the header.
4493 * **-EPERM** if the helper cannot be used under the current
4494 * *skops*\ **->op**.
4508 * the *map*. The *map* is used as the bpf-local-storage
4509 * "type". The bpf-local-storage "type" (i.e. the *map*) is
4530 * **-ENOENT** if the bpf_local_storage cannot be found.
4553 * Use BTF to store a string representation of *ptr*->ptr in *str*,
4554 * using *ptr*->type_id. This value should specify the type
4555 * that *ptr*->ptr points to. LLVM __builtin_btf_type_id(type, 1)
4558 * stored in the first *str_size* - 1 bytes of *str*. Safe copy of
4579 * show zero-valued struct/union members; they
4590 * *ptr*->ptr, using *ptr*->type_id as per bpf_snprintf_btf().
4682 * the *map*. The *map* is used as the bpf-local-storage
4683 * "type". The bpf-local-storage "type" (i.e. the *map*) is
4704 * **-ENOENT** if the bpf_local_storage cannot be found.
4722 * **-EINVAL** if invalid *flags* are passed, zero otherwise.
4726 * Return a coarse-grained version of the time elapsed since
4741 * **-EOPNOTSUP** if IMA is disabled or **-EINVAL** if
4776 * this value is L3 as this correlate to MTU and IP-header tot_len
4795 * possible for the skb packet to get re-segmented
4805 * MTU value in your BPF-code.
4822 * **map**, **callback_ctx** and other map-specific parameters.
4845 * The number of traversed map elements for success, **-EINVAL** for
4851 * based on a format string stored in a read-only map pointed by
4857 * array. The *data_len* is the size of *data* in bytes - must be
4872 * be zero-terminated except when **str_size** is 0.
4874 * Or **-EBUSY** if the per-CPU memory copy buffer is busy.
4904 * **-EBUSY** if *timer* is already initialized.
4905 * **-EINVAL** if invalid *flags* are passed.
4906 * **-EPERM** if *timer* is in a map that doesn't have any user references.
4916 * **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier.
4917 * **-EPERM** if *timer* is in a map that doesn't have any user references.
4933 * decremented. This is done to make sure that Ctrl-C of a user
4935 * bpffs the callback_fn can re-arm itself indefinitely.
4938 * The map can contain timers that invoke callback_fn-s from different
4945 * **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier
4954 * **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier.
4955 * **-EDEADLK** if callback_fn tried to call bpf_timer_cancel() on its
4973 * - kprobe/uprobe;
4974 * - tracepoint;
4975 * - perf_event.
5003 * **-EINVAL** if *flags* is not zero.
5005 * **-ENOENT** if architecture does not support branch records.
5030 * **-EINVAL** if *flags* is not zero.
5032 * **-EINVAL** if string *name* is not the same size as *name_sz*.
5034 * **-ENOENT** if symbol is not found.
5036 * **-EPERM** if caller does not have permission to obtain kernel address.
5053 * **-ENOENT** if *task->mm* is NULL, or no vma contains *addr*.
5054 * **-EBUSY** if failed to try lock mmap_lock.
5055 * **-EINVAL** for invalid **flags**.
5070 * is zero-indexed.
5078 * The number of loops performed, **-EINVAL** for invalid **flags**,
5079 * **-E2BIG** if **nr_loops** exceeds the maximum number of loops.
5084 * to be null-terminated and **s1_sz** is the maximum storage
5085 * size of **s1**. **s2** must be a read-only string.
5093 * Get **n**-th argument register (zero based) of the traced function (for tracing programs)
5098 * **-EINVAL** if n >= argument register count of traced function.
5107 * **-EOPNOTSUPP** for tracing programs other than BPF_TRACE_FEXIT or BPF_MODIFY_RETURN.
5136 * bpf_set_retval(-EPERM);
5139 * In this case, the BPF program's return value will use helper's -EPERM. This
5179 * Change the __sk_buff->tstamp_type to *tstamp_type*
5180 * and set *tstamp* to the __sk_buff->tstamp together.
5182 * If there is no need to change the __sk_buff->tstamp_type,
5183 * the tstamp value can be directly written to __sk_buff->tstamp
5194 * Only IPv4 and IPv6 skb->protocol are supported.
5197 * mono delivery time to __sk_buff->tstamp and then
5199 * changing the (rcv) timestamp in __sk_buff->tstamp at
5201 * to sch_fq@phy-dev.
5204 * **-EINVAL** for invalid input
5205 * **-EOPNOTSUPP** for unsupported protocol
5214 * **-EOPNOTSUP** if the hash calculation failed or **-EINVAL** if
5250 * 0 on success, -E2BIG if the size exceeds DYNPTR_MAX_SIZE,
5251 * -EINVAL if flags is not 0.
5267 * through the dynptr interface. This is a no-op if the dynptr is
5278 * interface. This is a no-op if the dynptr is invalid/null.
5291 * 0 on success, -E2BIG if *offset* + *len* exceeds the length
5292 * of *src*'s data, -EINVAL if *src* is an invalid dynptr or if
5301 * 0 on success, -E2BIG if *offset* + *len* exceeds the length
5302 * of *dst*'s data, -EINVAL if *dst* is an invalid dynptr or if *dst*
5303 * is a read-only dynptr or if *flags* is not 0.
5313 * read-only, if the dynptr is invalid, or if the offset and length
5334 * **-EINVAL** if *th_len* is invalid.
5354 * **-EINVAL** if *th_len* is invalid.
5356 * **-EPROTONOSUPPORT** if CONFIG_IPV6 is not builtin.
5371 * **-EACCES** if the SYN cookie is not valid.
5386 * **-EACCES** if the SYN cookie is not valid.
5388 * **-EPROTONOSUPPORT** if CONFIG_IPV6 is not builtin.
5392 * A nonsettable system-wide clock derived from wall-clock time but
5417 * buffer. If a user-space producer was epoll-waiting on this map,
5427 * **-EBUSY** if the ring buffer is contended, and another calling
5430 * **-EINVAL** if user-space is not properly tracking the ring
5435 * **-E2BIG** if user-space has tried to publish a sample which is
5439 #define __BPF_FUNC_MAPPER(FN) \ argument
5440 FN(unspec), \
5441 FN(map_lookup_elem), \
5442 FN(map_update_elem), \
5443 FN(map_delete_elem), \
5444 FN(probe_read), \
5445 FN(ktime_get_ns), \
5446 FN(trace_printk), \
5447 FN(get_prandom_u32), \
5448 FN(get_smp_processor_id), \
5449 FN(skb_store_bytes), \
5450 FN(l3_csum_replace), \
5451 FN(l4_csum_replace), \
5452 FN(tail_call), \
5453 FN(clone_redirect), \
5454 FN(get_current_pid_tgid), \
5455 FN(get_current_uid_gid), \
5456 FN(get_current_comm), \
5457 FN(get_cgroup_classid), \
5458 FN(skb_vlan_push), \
5459 FN(skb_vlan_pop), \
5460 FN(skb_get_tunnel_key), \
5461 FN(skb_set_tunnel_key), \
5462 FN(perf_event_read), \
5463 FN(redirect), \
5464 FN(get_route_realm), \
5465 FN(perf_event_output), \
5466 FN(skb_load_bytes), \
5467 FN(get_stackid), \
5468 FN(csum_diff), \
5469 FN(skb_get_tunnel_opt), \
5470 FN(skb_set_tunnel_opt), \
5471 FN(skb_change_proto), \
5472 FN(skb_change_type), \
5473 FN(skb_under_cgroup), \
5474 FN(get_hash_recalc), \
5475 FN(get_current_task), \
5476 FN(probe_write_user), \
5477 FN(current_task_under_cgroup), \
5478 FN(skb_change_tail), \
5479 FN(skb_pull_data), \
5480 FN(csum_update), \
5481 FN(set_hash_invalid), \
5482 FN(get_numa_node_id), \
5483 FN(skb_change_head), \
5484 FN(xdp_adjust_head), \
5485 FN(probe_read_str), \
5486 FN(get_socket_cookie), \
5487 FN(get_socket_uid), \
5488 FN(set_hash), \
5489 FN(setsockopt), \
5490 FN(skb_adjust_room), \
5491 FN(redirect_map), \
5492 FN(sk_redirect_map), \
5493 FN(sock_map_update), \
5494 FN(xdp_adjust_meta), \
5495 FN(perf_event_read_value), \
5496 FN(perf_prog_read_value), \
5497 FN(getsockopt), \
5498 FN(override_return), \
5499 FN(sock_ops_cb_flags_set), \
5500 FN(msg_redirect_map), \
5501 FN(msg_apply_bytes), \
5502 FN(msg_cork_bytes), \
5503 FN(msg_pull_data), \
5504 FN(bind), \
5505 FN(xdp_adjust_tail), \
5506 FN(skb_get_xfrm_state), \
5507 FN(get_stack), \
5508 FN(skb_load_bytes_relative), \
5509 FN(fib_lookup), \
5510 FN(sock_hash_update), \
5511 FN(msg_redirect_hash), \
5512 FN(sk_redirect_hash), \
5513 FN(lwt_push_encap), \
5514 FN(lwt_seg6_store_bytes), \
5515 FN(lwt_seg6_adjust_srh), \
5516 FN(lwt_seg6_action), \
5517 FN(rc_repeat), \
5518 FN(rc_keydown), \
5519 FN(skb_cgroup_id), \
5520 FN(get_current_cgroup_id), \
5521 FN(get_local_storage), \
5522 FN(sk_select_reuseport), \
5523 FN(skb_ancestor_cgroup_id), \
5524 FN(sk_lookup_tcp), \
5525 FN(sk_lookup_udp), \
5526 FN(sk_release), \
5527 FN(map_push_elem), \
5528 FN(map_pop_elem), \
5529 FN(map_peek_elem), \
5530 FN(msg_push_data), \
5531 FN(msg_pop_data), \
5532 FN(rc_pointer_rel), \
5533 FN(spin_lock), \
5534 FN(spin_unlock), \
5535 FN(sk_fullsock), \
5536 FN(tcp_sock), \
5537 FN(skb_ecn_set_ce), \
5538 FN(get_listener_sock), \
5539 FN(skc_lookup_tcp), \
5540 FN(tcp_check_syncookie), \
5541 FN(sysctl_get_name), \
5542 FN(sysctl_get_current_value), \
5543 FN(sysctl_get_new_value), \
5544 FN(sysctl_set_new_value), \
5545 FN(strtol), \
5546 FN(strtoul), \
5547 FN(sk_storage_get), \
5548 FN(sk_storage_delete), \
5549 FN(send_signal), \
5550 FN(tcp_gen_syncookie), \
5551 FN(skb_output), \
5552 FN(probe_read_user), \
5553 FN(probe_read_kernel), \
5554 FN(probe_read_user_str), \
5555 FN(probe_read_kernel_str), \
5556 FN(tcp_send_ack), \
5557 FN(send_signal_thread), \
5558 FN(jiffies64), \
5559 FN(read_branch_records), \
5560 FN(get_ns_current_pid_tgid), \
5561 FN(xdp_output), \
5562 FN(get_netns_cookie), \
5563 FN(get_current_ancestor_cgroup_id), \
5564 FN(sk_assign), \
5565 FN(ktime_get_boot_ns), \
5566 FN(seq_printf), \
5567 FN(seq_write), \
5568 FN(sk_cgroup_id), \
5569 FN(sk_ancestor_cgroup_id), \
5570 FN(ringbuf_output), \
5571 FN(ringbuf_reserve), \
5572 FN(ringbuf_submit), \
5573 FN(ringbuf_discard), \
5574 FN(ringbuf_query), \
5575 FN(csum_level), \
5576 FN(skc_to_tcp6_sock), \
5577 FN(skc_to_tcp_sock), \
5578 FN(skc_to_tcp_timewait_sock), \
5579 FN(skc_to_tcp_request_sock), \
5580 FN(skc_to_udp6_sock), \
5581 FN(get_task_stack), \
5582 FN(load_hdr_opt), \
5583 FN(store_hdr_opt), \
5584 FN(reserve_hdr_opt), \
5585 FN(inode_storage_get), \
5586 FN(inode_storage_delete), \
5587 FN(d_path), \
5588 FN(copy_from_user), \
5589 FN(snprintf_btf), \
5590 FN(seq_printf_btf), \
5591 FN(skb_cgroup_classid), \
5592 FN(redirect_neigh), \
5593 FN(per_cpu_ptr), \
5594 FN(this_cpu_ptr), \
5595 FN(redirect_peer), \
5596 FN(task_storage_get), \
5597 FN(task_storage_delete), \
5598 FN(get_current_task_btf), \
5599 FN(bprm_opts_set), \
5600 FN(ktime_get_coarse_ns), \
5601 FN(ima_inode_hash), \
5602 FN(sock_from_file), \
5603 FN(check_mtu), \
5604 FN(for_each_map_elem), \
5605 FN(snprintf), \
5606 FN(sys_bpf), \
5607 FN(btf_find_by_name_kind), \
5608 FN(sys_close), \
5609 FN(timer_init), \
5610 FN(timer_set_callback), \
5611 FN(timer_start), \
5612 FN(timer_cancel), \
5613 FN(get_func_ip), \
5614 FN(get_attach_cookie), \
5615 FN(task_pt_regs), \
5616 FN(get_branch_snapshot), \
5617 FN(trace_vprintk), \
5618 FN(skc_to_unix_sock), \
5619 FN(kallsyms_lookup_name), \
5620 FN(find_vma), \
5621 FN(loop), \
5622 FN(strncmp), \
5623 FN(get_func_arg), \
5624 FN(get_func_ret), \
5625 FN(get_func_arg_cnt), \
5626 FN(get_retval), \
5627 FN(set_retval), \
5628 FN(xdp_get_buff_len), \
5629 FN(xdp_load_bytes), \
5630 FN(xdp_store_bytes), \
5631 FN(copy_from_user_task), \
5632 FN(skb_set_tstamp), \
5633 FN(ima_file_hash), \
5634 FN(kptr_xchg), \
5635 FN(map_lookup_percpu_elem), \
5636 FN(skc_to_mptcp_sock), \
5637 FN(dynptr_from_mem), \
5638 FN(ringbuf_reserve_dynptr), \
5639 FN(ringbuf_submit_dynptr), \
5640 FN(ringbuf_discard_dynptr), \
5641 FN(dynptr_read), \
5642 FN(dynptr_write), \
5643 FN(dynptr_data), \
5644 FN(tcp_raw_gen_syncookie_ipv4), \
5645 FN(tcp_raw_gen_syncookie_ipv6), \
5646 FN(tcp_raw_check_syncookie_ipv4), \
5647 FN(tcp_raw_check_syncookie_ipv6), \
5648 FN(ktime_get_tai_ns), \
5649 FN(user_ringbuf_drain), \
5729 BPF_F_CURRENT_NETNS = (-1L),
5849 * and try to deduce it by ingress, egress or skb->sk->sk_clockid.
5853 /* user accessible mirror of in-kernel sk_buff.
5917 /* user accessible mirror of in-kernel xfrm_state.
5932 * The values are binary compatible with their TC_ACT_* counter-part to
5942 /* 3-6 reserved */
6068 __u32 ingress_ifindex; /* rxq->dev->ifindex */
6069 __u32 rx_queue_index; /* rxq->queue_index */
6071 __u32 egress_ifindex; /* txq->dev->ifindex */
6074 /* DEVMAP map-value layout
6076 * The struct data-layout of map-value is a configuration interface.
6087 /* CPUMAP map-value layout
6089 * The struct data-layout of map-value is a configuration interface.
6134 * Note that the directly accessible bytes (data_end - data)
6147 /* When reuse->migrating_sk is NULL, it is selecting a sk for the
6149 * the received SYN in the TCP case). reuse->sk is one of the sk
6150 * in the reuseport group. The bpf prog can use reuse->sk to learn
6153 * When reuse->migrating_sk is not NULL, reuse->sk is closed and
6154 * reuse->migrating_sk is the socket that needs to be migrated
6156 * sk that is fully established or a reqsk that is in-the-middle
6157 * of 3-way handshake.
6292 __u32 user_family; /* Allows 4-byte read, but no write. */
6293 __u32 user_ip4; /* Allows 1,2,4-byte read and 4-byte write.
6296 __u32 user_ip6[4]; /* Allows 1,2,4,8-byte read and 4,8-byte write.
6299 __u32 user_port; /* Allows 1,2,4-byte read and 4-byte write.
6302 __u32 family; /* Allows 4-byte read, but no write */
6303 __u32 type; /* Allows 4-byte read, but no write */
6304 __u32 protocol; /* Allows 4-byte read, but no write */
6305 __u32 msg_src_ip4; /* Allows 1,2,4-byte read and 4-byte write.
6308 __u32 msg_src_ip6[4]; /* Allows 1,2,4,8-byte read and 4,8-byte write.
6403 * called under sock_ops->op == BPF_SOCK_OPS_PARSE_HDR_OPT_CB
6411 * mode and required the active side to resend the bpf-written
6412 * options. The active side can keep writing the bpf-options until
6423 * sock_ops->op == BPF_SOCK_OPS_PARSE_HDR_OPT_CB.
6433 * sock_ops->op == BPF_SOCK_OPS_HDR_OPT_LEN_CB. Then
6435 * under sock_ops->op == BPF_SOCK_OPS_WRITE_HDR_OPT_CB.
6454 BPF_SOCK_OPS_TIMEOUT_INIT, /* Should return SYN-RTO value to use or
6455 * -1 if default value should be used
6458 * window (in packets) or -1 if default
6508 * sock_ops->skb_data:
6522 * sock_ops->skb_data:
6526 * sock_ops->skb_tcp_flags:
6537 * sock_ops->skb_data:
6542 * earlier bpf-progs.
6544 * sock_ops->skb_tcp_flags:
6557 * earlier bpf-progs.
6595 * 1. the just-received SYN packet (only available when writing the
6609 * If the bpf-prog does not need the IP[46] header, the
6610 * bpf-prog can avoid parsing the IP header by using
6611 * TCP_BPF_SYN. Otherwise, the bpf-prog can get both
6615 * -ENOSPC: Not enough space in optval. Only optlen number of
6617 * -ENOENT: The SYN skb is not available now and the earlier SYN pkt
6699 /* set if lookup is to consider L4 data - e.g., FIB rules */
6706 __u16 tot_len; /* L3 length from network hdr (iph->tot_len) */
6764 BPF_MTU_CHK_RET_SEGS_TOOBIG, /* GSO re-segmentation needed to fwd */
6838 * Allows 1,2,4-byte read, but no write.
6841 * Allows 1,2,4-byte read an 4-byte write.
6865 __u64 cookie; /* Non-zero if socket was selected in PROG_TEST_RUN */
6883 * via the bpf_snprintf_btf() helper described above. A flags field -
6885 * (rather than its mode of display) - is included for future use.
6886 * Display flags - BTF_F_* - are passed to bpf_snprintf_btf separately.
6896 * - BTF_F_COMPACT: no formatting around type information
6897 * - BTF_F_NONAME: no struct/union member names/types
6898 * - BTF_F_PTR_RAW: show raw (unobfuscated) pointer values;
6900 * - BTF_F_ZERO: show zero-valued struct/union members; they
6918 BPF_CORE_FIELD_SIGNED = 3, /* field signedness (0 - unsigned, 1 - signed) */
6919 BPF_CORE_FIELD_LSHIFT_U64 = 4, /* bitfield-specific left bitshift */
6920 BPF_CORE_FIELD_RSHIFT_U64 = 5, /* bitfield-specific right bitshift */
6934 * CO-RE relocation captures the following data:
6935 * - insn_off - instruction offset (in bytes) within a BPF program that needs
6936 * its insn->imm field to be relocated with actual field info;
6937 * - type_id - BTF type ID of the "root" (containing) entity of a relocatable
6939 * - access_str_off - offset into corresponding .BTF string section. String
6941 * - for field-based relocations, string encodes an accessed field using
6945 * - for type-based relocations, strings is expected to be just "0";
6946 * - for enum value-based relocations, string contains an index of enum
6948 * - kind - one of enum bpf_core_relo_kind;
6959 * int *x = &s->a; // encoded as "0:0" (a is field #0)
6960 * int *y = &s->b[5]; // encoded as "0:1:0:5" (anon struct is field #1,
6962 * int *z = &s[10]->b; // encoded as "10:1" (ptr is used as an array)
6968 * Clang built-in, passing expression that captures field address, e.g.:
6971 * __builtin_preserve_access_index(&src->a.b.c));
6976 * [0] https://llvm.org/docs/LangRef.html#getelementptr-instruction