|
|
8792a8 |
From 2e5b8fd1e0e8fc4135bd6a162f32df5e624262b1 Mon Sep 17 00:00:00 2001
|
|
|
8792a8 |
Message-Id: <2e5b8fd1e0e8fc4135bd6a162f32df5e624262b1.1628790091.git.aclaudi@redhat.com>
|
|
|
8792a8 |
In-Reply-To: <650694eb0120722499207078f965442ef7343bb1.1628790091.git.aclaudi@redhat.com>
|
|
|
8792a8 |
References: <650694eb0120722499207078f965442ef7343bb1.1628790091.git.aclaudi@redhat.com>
|
|
|
8792a8 |
From: Andrea Claudi <aclaudi@redhat.com>
|
|
|
8792a8 |
Date: Wed, 11 Aug 2021 12:55:14 +0200
|
|
|
8792a8 |
Subject: [PATCH] Update kernel headers
|
|
|
8792a8 |
|
|
|
8792a8 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1981393
|
|
|
8792a8 |
Upstream Status: iproute2.git commit a5b355c0
|
|
|
8792a8 |
|
|
|
8792a8 |
commit a5b355c08c62fb5b3a42d0e27ef05571c7b30e2e
|
|
|
8792a8 |
Author: David Ahern <dsahern@kernel.org>
|
|
|
8792a8 |
Date: Fri Mar 19 14:59:17 2021 +0000
|
|
|
8792a8 |
|
|
|
8792a8 |
Update kernel headers
|
|
|
8792a8 |
|
|
|
8792a8 |
Update kernel headers to commit:
|
|
|
8792a8 |
38cb57602369 ("selftests: net: forwarding: Fix a typo")
|
|
|
8792a8 |
|
|
|
8792a8 |
Signed-off-by: David Ahern <dsahern@kernel.org>
|
|
|
8792a8 |
|
|
|
8792a8 |
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
|
|
|
8792a8 |
---
|
|
|
8792a8 |
include/uapi/linux/bpf.h | 764 ++++++++++++++++++++++++++++++++-
|
|
|
8792a8 |
include/uapi/linux/btf.h | 5 +-
|
|
|
8792a8 |
include/uapi/linux/nexthop.h | 47 +-
|
|
|
8792a8 |
include/uapi/linux/pkt_cls.h | 2 +
|
|
|
8792a8 |
include/uapi/linux/rtnetlink.h | 7 +
|
|
|
8792a8 |
5 files changed, 818 insertions(+), 7 deletions(-)
|
|
|
8792a8 |
|
|
|
8792a8 |
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
|
|
|
8792a8 |
index b1aba6af..502934f7 100644
|
|
|
8792a8 |
--- a/include/uapi/linux/bpf.h
|
|
|
8792a8 |
+++ b/include/uapi/linux/bpf.h
|
|
|
8792a8 |
@@ -93,7 +93,717 @@ union bpf_iter_link_info {
|
|
|
8792a8 |
} map;
|
|
|
8792a8 |
};
|
|
|
8792a8 |
|
|
|
8792a8 |
-/* BPF syscall commands, see bpf(2) man-page for details. */
|
|
|
8792a8 |
+/* BPF syscall commands, see bpf(2) man-page for more details. */
|
|
|
8792a8 |
+/**
|
|
|
8792a8 |
+ * DOC: eBPF Syscall Preamble
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The operation to be performed by the **bpf**\ () system call is determined
|
|
|
8792a8 |
+ * by the *cmd* argument. Each operation takes an accompanying argument,
|
|
|
8792a8 |
+ * provided via *attr*, which is a pointer to a union of type *bpf_attr* (see
|
|
|
8792a8 |
+ * below). The size argument is the size of the union pointed to by *attr*.
|
|
|
8792a8 |
+ */
|
|
|
8792a8 |
+/**
|
|
|
8792a8 |
+ * DOC: eBPF Syscall Commands
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_MAP_CREATE
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Create a map and return a file descriptor that refers to the
|
|
|
8792a8 |
+ * map. The close-on-exec file descriptor flag (see **fcntl**\ (2))
|
|
|
8792a8 |
+ * is automatically enabled for the new file descriptor.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Applying **close**\ (2) to the file descriptor returned by
|
|
|
8792a8 |
+ * **BPF_MAP_CREATE** will delete the map (but see NOTES).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * A new file descriptor (a nonnegative integer), or -1 if an
|
|
|
8792a8 |
+ * error occurred (in which case, *errno* is set appropriately).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_MAP_LOOKUP_ELEM
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Look up an element with a given *key* in the map referred to
|
|
|
8792a8 |
+ * by the file descriptor *map_fd*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The *flags* argument may be specified as one of the
|
|
|
8792a8 |
+ * following:
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * **BPF_F_LOCK**
|
|
|
8792a8 |
+ * Look up the value of a spin-locked map without
|
|
|
8792a8 |
+ * returning the lock. This must be specified if the
|
|
|
8792a8 |
+ * elements contain a spinlock.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_MAP_UPDATE_ELEM
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Create or update an element (key/value pair) in a specified map.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The *flags* argument should be specified as one of the
|
|
|
8792a8 |
+ * following:
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * **BPF_ANY**
|
|
|
8792a8 |
+ * Create a new element or update an existing element.
|
|
|
8792a8 |
+ * **BPF_NOEXIST**
|
|
|
8792a8 |
+ * Create a new element only if it did not exist.
|
|
|
8792a8 |
+ * **BPF_EXIST**
|
|
|
8792a8 |
+ * Update an existing element.
|
|
|
8792a8 |
+ * **BPF_F_LOCK**
|
|
|
8792a8 |
+ * Update a spin_lock-ed map element.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * May set *errno* to **EINVAL**, **EPERM**, **ENOMEM**,
|
|
|
8792a8 |
+ * **E2BIG**, **EEXIST**, or **ENOENT**.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * **E2BIG**
|
|
|
8792a8 |
+ * The number of elements in the map reached the
|
|
|
8792a8 |
+ * *max_entries* limit specified at map creation time.
|
|
|
8792a8 |
+ * **EEXIST**
|
|
|
8792a8 |
+ * If *flags* specifies **BPF_NOEXIST** and the element
|
|
|
8792a8 |
+ * with *key* already exists in the map.
|
|
|
8792a8 |
+ * **ENOENT**
|
|
|
8792a8 |
+ * If *flags* specifies **BPF_EXIST** and the element with
|
|
|
8792a8 |
+ * *key* does not exist in the map.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_MAP_DELETE_ELEM
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Look up and delete an element by key in a specified map.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_MAP_GET_NEXT_KEY
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Look up an element by key in a specified map and return the key
|
|
|
8792a8 |
+ * of the next element. Can be used to iterate over all elements
|
|
|
8792a8 |
+ * in the map.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The following cases can be used to iterate over all elements of
|
|
|
8792a8 |
+ * the map:
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * * If *key* is not found, the operation returns zero and sets
|
|
|
8792a8 |
+ * the *next_key* pointer to the key of the first element.
|
|
|
8792a8 |
+ * * If *key* is found, the operation returns zero and sets the
|
|
|
8792a8 |
+ * *next_key* pointer to the key of the next element.
|
|
|
8792a8 |
+ * * If *key* is the last element, returns -1 and *errno* is set
|
|
|
8792a8 |
+ * to **ENOENT**.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * May set *errno* to **ENOMEM**, **EFAULT**, **EPERM**, or
|
|
|
8792a8 |
+ * **EINVAL** on error.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_PROG_LOAD
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Verify and load an eBPF program, returning a new file
|
|
|
8792a8 |
+ * descriptor associated with the program.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Applying **close**\ (2) to the file descriptor returned by
|
|
|
8792a8 |
+ * **BPF_PROG_LOAD** will unload the eBPF program (but see NOTES).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The close-on-exec file descriptor flag (see **fcntl**\ (2)) is
|
|
|
8792a8 |
+ * automatically enabled for the new file descriptor.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * A new file descriptor (a nonnegative integer), or -1 if an
|
|
|
8792a8 |
+ * error occurred (in which case, *errno* is set appropriately).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_OBJ_PIN
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Pin an eBPF program or map referred by the specified *bpf_fd*
|
|
|
8792a8 |
+ * to the provided *pathname* on the filesystem.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The *pathname* argument must not contain a dot (".").
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * On success, *pathname* retains a reference to the eBPF object,
|
|
|
8792a8 |
+ * preventing deallocation of the object when the original
|
|
|
8792a8 |
+ * *bpf_fd* is closed. This allow the eBPF object to live beyond
|
|
|
8792a8 |
+ * **close**\ (\ *bpf_fd*\ ), and hence the lifetime of the parent
|
|
|
8792a8 |
+ * process.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Applying **unlink**\ (2) or similar calls to the *pathname*
|
|
|
8792a8 |
+ * unpins the object from the filesystem, removing the reference.
|
|
|
8792a8 |
+ * If no other file descriptors or filesystem nodes refer to the
|
|
|
8792a8 |
+ * same object, it will be deallocated (see NOTES).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The filesystem type for the parent directory of *pathname* must
|
|
|
8792a8 |
+ * be **BPF_FS_MAGIC**.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_OBJ_GET
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Open a file descriptor for the eBPF object pinned to the
|
|
|
8792a8 |
+ * specified *pathname*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * A new file descriptor (a nonnegative integer), or -1 if an
|
|
|
8792a8 |
+ * error occurred (in which case, *errno* is set appropriately).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_PROG_ATTACH
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Attach an eBPF program to a *target_fd* at the specified
|
|
|
8792a8 |
+ * *attach_type* hook.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The *attach_type* specifies the eBPF attachment point to
|
|
|
8792a8 |
+ * attach the program to, and must be one of *bpf_attach_type*
|
|
|
8792a8 |
+ * (see below).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The *attach_bpf_fd* must be a valid file descriptor for a
|
|
|
8792a8 |
+ * loaded eBPF program of a cgroup, flow dissector, LIRC, sockmap
|
|
|
8792a8 |
+ * or sock_ops type corresponding to the specified *attach_type*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The *target_fd* must be a valid file descriptor for a kernel
|
|
|
8792a8 |
+ * object which depends on the attach type of *attach_bpf_fd*:
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_CGROUP_DEVICE**,
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_CGROUP_SKB**,
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_CGROUP_SOCK**,
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_CGROUP_SOCK_ADDR**,
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_CGROUP_SOCKOPT**,
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_CGROUP_SYSCTL**,
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_SOCK_OPS**
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Control Group v2 hierarchy with the eBPF controller
|
|
|
8792a8 |
+ * enabled. Requires the kernel to be compiled with
|
|
|
8792a8 |
+ * **CONFIG_CGROUP_BPF**.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_FLOW_DISSECTOR**
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Network namespace (eg /proc/self/ns/net).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_LIRC_MODE2**
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * LIRC device path (eg /dev/lircN). Requires the kernel
|
|
|
8792a8 |
+ * to be compiled with **CONFIG_BPF_LIRC_MODE2**.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_SK_SKB**,
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_SK_MSG**
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * eBPF map of socket type (eg **BPF_MAP_TYPE_SOCKHASH**).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_PROG_DETACH
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Detach the eBPF program associated with the *target_fd* at the
|
|
|
8792a8 |
+ * hook specified by *attach_type*. The program must have been
|
|
|
8792a8 |
+ * previously attached using **BPF_PROG_ATTACH**.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_PROG_TEST_RUN
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Run the eBPF program associated with the *prog_fd* a *repeat*
|
|
|
8792a8 |
+ * number of times against a provided program context *ctx_in* and
|
|
|
8792a8 |
+ * data *data_in*, and return the modified program context
|
|
|
8792a8 |
+ * *ctx_out*, *data_out* (for example, packet data), result of the
|
|
|
8792a8 |
+ * execution *retval*, and *duration* of the test run.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * **ENOSPC**
|
|
|
8792a8 |
+ * Either *data_size_out* or *ctx_size_out* is too small.
|
|
|
8792a8 |
+ * **ENOTSUPP**
|
|
|
8792a8 |
+ * This command is not supported by the program type of
|
|
|
8792a8 |
+ * the program referred to by *prog_fd*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_PROG_GET_NEXT_ID
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Fetch the next eBPF program currently loaded into the kernel.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Looks for the eBPF program with an id greater than *start_id*
|
|
|
8792a8 |
+ * and updates *next_id* on success. If no other eBPF programs
|
|
|
8792a8 |
+ * remain with ids higher than *start_id*, returns -1 and sets
|
|
|
8792a8 |
+ * *errno* to **ENOENT**.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, or when no id remains, -1
|
|
|
8792a8 |
+ * is returned and *errno* is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_MAP_GET_NEXT_ID
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Fetch the next eBPF map currently loaded into the kernel.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Looks for the eBPF map with an id greater than *start_id*
|
|
|
8792a8 |
+ * and updates *next_id* on success. If no other eBPF maps
|
|
|
8792a8 |
+ * remain with ids higher than *start_id*, returns -1 and sets
|
|
|
8792a8 |
+ * *errno* to **ENOENT**.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, or when no id remains, -1
|
|
|
8792a8 |
+ * is returned and *errno* is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_PROG_GET_FD_BY_ID
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Open a file descriptor for the eBPF program corresponding to
|
|
|
8792a8 |
+ * *prog_id*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * A new file descriptor (a nonnegative integer), or -1 if an
|
|
|
8792a8 |
+ * error occurred (in which case, *errno* is set appropriately).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_MAP_GET_FD_BY_ID
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Open a file descriptor for the eBPF map corresponding to
|
|
|
8792a8 |
+ * *map_id*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * A new file descriptor (a nonnegative integer), or -1 if an
|
|
|
8792a8 |
+ * error occurred (in which case, *errno* is set appropriately).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_OBJ_GET_INFO_BY_FD
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Obtain information about the eBPF object corresponding to
|
|
|
8792a8 |
+ * *bpf_fd*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Populates up to *info_len* bytes of *info*, which will be in
|
|
|
8792a8 |
+ * one of the following formats depending on the eBPF object type
|
|
|
8792a8 |
+ * of *bpf_fd*:
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * * **struct bpf_prog_info**
|
|
|
8792a8 |
+ * * **struct bpf_map_info**
|
|
|
8792a8 |
+ * * **struct bpf_btf_info**
|
|
|
8792a8 |
+ * * **struct bpf_link_info**
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_PROG_QUERY
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Obtain information about eBPF programs associated with the
|
|
|
8792a8 |
+ * specified *attach_type* hook.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The *target_fd* must be a valid file descriptor for a kernel
|
|
|
8792a8 |
+ * object which depends on the attach type of *attach_bpf_fd*:
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_CGROUP_DEVICE**,
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_CGROUP_SKB**,
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_CGROUP_SOCK**,
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_CGROUP_SOCK_ADDR**,
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_CGROUP_SOCKOPT**,
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_CGROUP_SYSCTL**,
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_SOCK_OPS**
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Control Group v2 hierarchy with the eBPF controller
|
|
|
8792a8 |
+ * enabled. Requires the kernel to be compiled with
|
|
|
8792a8 |
+ * **CONFIG_CGROUP_BPF**.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_FLOW_DISSECTOR**
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Network namespace (eg /proc/self/ns/net).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * **BPF_PROG_TYPE_LIRC_MODE2**
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * LIRC device path (eg /dev/lircN). Requires the kernel
|
|
|
8792a8 |
+ * to be compiled with **CONFIG_BPF_LIRC_MODE2**.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * **BPF_PROG_QUERY** always fetches the number of programs
|
|
|
8792a8 |
+ * attached and the *attach_flags* which were used to attach those
|
|
|
8792a8 |
+ * programs. Additionally, if *prog_ids* is nonzero and the number
|
|
|
8792a8 |
+ * of attached programs is less than *prog_cnt*, populates
|
|
|
8792a8 |
+ * *prog_ids* with the eBPF program ids of the programs attached
|
|
|
8792a8 |
+ * at *target_fd*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The following flags may alter the result:
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * **BPF_F_QUERY_EFFECTIVE**
|
|
|
8792a8 |
+ * Only return information regarding programs which are
|
|
|
8792a8 |
+ * currently effective at the specified *target_fd*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_RAW_TRACEPOINT_OPEN
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Attach an eBPF program to a tracepoint *name* to access kernel
|
|
|
8792a8 |
+ * internal arguments of the tracepoint in their raw form.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The *prog_fd* must be a valid file descriptor associated with
|
|
|
8792a8 |
+ * a loaded eBPF program of type **BPF_PROG_TYPE_RAW_TRACEPOINT**.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * No ABI guarantees are made about the content of tracepoint
|
|
|
8792a8 |
+ * arguments exposed to the corresponding eBPF program.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Applying **close**\ (2) to the file descriptor returned by
|
|
|
8792a8 |
+ * **BPF_RAW_TRACEPOINT_OPEN** will delete the map (but see NOTES).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * A new file descriptor (a nonnegative integer), or -1 if an
|
|
|
8792a8 |
+ * error occurred (in which case, *errno* is set appropriately).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_BTF_LOAD
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Verify and load BPF Type Format (BTF) metadata into the kernel,
|
|
|
8792a8 |
+ * returning a new file descriptor associated with the metadata.
|
|
|
8792a8 |
+ * BTF is described in more detail at
|
|
|
8792a8 |
+ * https://www.kernel.org/doc/html/latest/bpf/btf.html.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The *btf* parameter must point to valid memory providing
|
|
|
8792a8 |
+ * *btf_size* bytes of BTF binary metadata.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The returned file descriptor can be passed to other **bpf**\ ()
|
|
|
8792a8 |
+ * subcommands such as **BPF_PROG_LOAD** or **BPF_MAP_CREATE** to
|
|
|
8792a8 |
+ * associate the BTF with those objects.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Similar to **BPF_PROG_LOAD**, **BPF_BTF_LOAD** has optional
|
|
|
8792a8 |
+ * parameters to specify a *btf_log_buf*, *btf_log_size* and
|
|
|
8792a8 |
+ * *btf_log_level* which allow the kernel to return freeform log
|
|
|
8792a8 |
+ * output regarding the BTF verification process.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * A new file descriptor (a nonnegative integer), or -1 if an
|
|
|
8792a8 |
+ * error occurred (in which case, *errno* is set appropriately).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_BTF_GET_FD_BY_ID
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Open a file descriptor for the BPF Type Format (BTF)
|
|
|
8792a8 |
+ * corresponding to *btf_id*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * A new file descriptor (a nonnegative integer), or -1 if an
|
|
|
8792a8 |
+ * error occurred (in which case, *errno* is set appropriately).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_TASK_FD_QUERY
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Obtain information about eBPF programs associated with the
|
|
|
8792a8 |
+ * target process identified by *pid* and *fd*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * If the *pid* and *fd* are associated with a tracepoint, kprobe
|
|
|
8792a8 |
+ * or uprobe perf event, then the *prog_id* and *fd_type* will
|
|
|
8792a8 |
+ * be populated with the eBPF program id and file descriptor type
|
|
|
8792a8 |
+ * of type **bpf_task_fd_type**. If associated with a kprobe or
|
|
|
8792a8 |
+ * uprobe, the *probe_offset* and *probe_addr* will also be
|
|
|
8792a8 |
+ * populated. Optionally, if *buf* is provided, then up to
|
|
|
8792a8 |
+ * *buf_len* bytes of *buf* will be populated with the name of
|
|
|
8792a8 |
+ * the tracepoint, kprobe or uprobe.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The resulting *prog_id* may be introspected in deeper detail
|
|
|
8792a8 |
+ * using **BPF_PROG_GET_FD_BY_ID** and **BPF_OBJ_GET_INFO_BY_FD**.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_MAP_LOOKUP_AND_DELETE_ELEM
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Look up an element with the given *key* in the map referred to
|
|
|
8792a8 |
+ * by the file descriptor *fd*, and if found, delete the element.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The **BPF_MAP_TYPE_QUEUE** and **BPF_MAP_TYPE_STACK** map types
|
|
|
8792a8 |
+ * implement this command as a "pop" operation, deleting the top
|
|
|
8792a8 |
+ * element rather than one corresponding to *key*.
|
|
|
8792a8 |
+ * The *key* and *key_len* parameters should be zeroed when
|
|
|
8792a8 |
+ * issuing this operation for these map types.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * This command is only valid for the following map types:
|
|
|
8792a8 |
+ * * **BPF_MAP_TYPE_QUEUE**
|
|
|
8792a8 |
+ * * **BPF_MAP_TYPE_STACK**
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_MAP_FREEZE
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Freeze the permissions of the specified map.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Write permissions may be frozen by passing zero *flags*.
|
|
|
8792a8 |
+ * Upon success, no future syscall invocations may alter the
|
|
|
8792a8 |
+ * map state of *map_fd*. Write operations from eBPF programs
|
|
|
8792a8 |
+ * are still possible for a frozen map.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Not supported for maps of type **BPF_MAP_TYPE_STRUCT_OPS**.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_BTF_GET_NEXT_ID
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Fetch the next BPF Type Format (BTF) object currently loaded
|
|
|
8792a8 |
+ * into the kernel.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Looks for the BTF object with an id greater than *start_id*
|
|
|
8792a8 |
+ * and updates *next_id* on success. If no other BTF objects
|
|
|
8792a8 |
+ * remain with ids higher than *start_id*, returns -1 and sets
|
|
|
8792a8 |
+ * *errno* to **ENOENT**.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, or when no id remains, -1
|
|
|
8792a8 |
+ * is returned and *errno* is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_MAP_LOOKUP_BATCH
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Iterate and fetch multiple elements in a map.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Two opaque values are used to manage batch operations,
|
|
|
8792a8 |
+ * *in_batch* and *out_batch*. Initially, *in_batch* must be set
|
|
|
8792a8 |
+ * to NULL to begin the batched operation. After each subsequent
|
|
|
8792a8 |
+ * **BPF_MAP_LOOKUP_BATCH**, the caller should pass the resultant
|
|
|
8792a8 |
+ * *out_batch* as the *in_batch* for the next operation to
|
|
|
8792a8 |
+ * continue iteration from the current point.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The *keys* and *values* are output parameters which must point
|
|
|
8792a8 |
+ * to memory large enough to hold *count* items based on the key
|
|
|
8792a8 |
+ * and value size of the map *map_fd*. The *keys* buffer must be
|
|
|
8792a8 |
+ * of *key_size* * *count*. The *values* buffer must be of
|
|
|
8792a8 |
+ * *value_size* * *count*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The *elem_flags* argument may be specified as one of the
|
|
|
8792a8 |
+ * following:
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * **BPF_F_LOCK**
|
|
|
8792a8 |
+ * Look up the value of a spin-locked map without
|
|
|
8792a8 |
+ * returning the lock. This must be specified if the
|
|
|
8792a8 |
+ * elements contain a spinlock.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * On success, *count* elements from the map are copied into the
|
|
|
8792a8 |
+ * user buffer, with the keys copied into *keys* and the values
|
|
|
8792a8 |
+ * copied into the corresponding indices in *values*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * If an error is returned and *errno* is not **EFAULT**, *count*
|
|
|
8792a8 |
+ * is set to the number of successfully processed elements.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * May set *errno* to **ENOSPC** to indicate that *keys* or
|
|
|
8792a8 |
+ * *values* is too small to dump an entire bucket during
|
|
|
8792a8 |
+ * iteration of a hash-based map type.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_MAP_LOOKUP_AND_DELETE_BATCH
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Iterate and delete all elements in a map.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * This operation has the same behavior as
|
|
|
8792a8 |
+ * **BPF_MAP_LOOKUP_BATCH** with two exceptions:
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * * Every element that is successfully returned is also deleted
|
|
|
8792a8 |
+ * from the map. This is at least *count* elements. Note that
|
|
|
8792a8 |
+ * *count* is both an input and an output parameter.
|
|
|
8792a8 |
+ * * Upon returning with *errno* set to **EFAULT**, up to
|
|
|
8792a8 |
+ * *count* elements may be deleted without returning the keys
|
|
|
8792a8 |
+ * and values of the deleted elements.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_MAP_UPDATE_BATCH
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Update multiple elements in a map by *key*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The *keys* and *values* are input parameters which must point
|
|
|
8792a8 |
+ * to memory large enough to hold *count* items based on the key
|
|
|
8792a8 |
+ * and value size of the map *map_fd*. The *keys* buffer must be
|
|
|
8792a8 |
+ * of *key_size* * *count*. The *values* buffer must be of
|
|
|
8792a8 |
+ * *value_size* * *count*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Each element specified in *keys* is sequentially updated to the
|
|
|
8792a8 |
+ * value in the corresponding index in *values*. The *in_batch*
|
|
|
8792a8 |
+ * and *out_batch* parameters are ignored and should be zeroed.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The *elem_flags* argument should be specified as one of the
|
|
|
8792a8 |
+ * following:
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * **BPF_ANY**
|
|
|
8792a8 |
+ * Create new elements or update a existing elements.
|
|
|
8792a8 |
+ * **BPF_NOEXIST**
|
|
|
8792a8 |
+ * Create new elements only if they do not exist.
|
|
|
8792a8 |
+ * **BPF_EXIST**
|
|
|
8792a8 |
+ * Update existing elements.
|
|
|
8792a8 |
+ * **BPF_F_LOCK**
|
|
|
8792a8 |
+ * Update spin_lock-ed map elements. This must be
|
|
|
8792a8 |
+ * specified if the map value contains a spinlock.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * On success, *count* elements from the map are updated.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * If an error is returned and *errno* is not **EFAULT**, *count*
|
|
|
8792a8 |
+ * is set to the number of successfully processed elements.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * May set *errno* to **EINVAL**, **EPERM**, **ENOMEM**, or
|
|
|
8792a8 |
+ * **E2BIG**. **E2BIG** indicates that the number of elements in
|
|
|
8792a8 |
+ * the map reached the *max_entries* limit specified at map
|
|
|
8792a8 |
+ * creation time.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * May set *errno* to one of the following error codes under
|
|
|
8792a8 |
+ * specific circumstances:
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * **EEXIST**
|
|
|
8792a8 |
+ * If *flags* specifies **BPF_NOEXIST** and the element
|
|
|
8792a8 |
+ * with *key* already exists in the map.
|
|
|
8792a8 |
+ * **ENOENT**
|
|
|
8792a8 |
+ * If *flags* specifies **BPF_EXIST** and the element with
|
|
|
8792a8 |
+ * *key* does not exist in the map.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_MAP_DELETE_BATCH
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Delete multiple elements in a map by *key*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The *keys* parameter is an input parameter which must point
|
|
|
8792a8 |
+ * to memory large enough to hold *count* items based on the key
|
|
|
8792a8 |
+ * size of the map *map_fd*, that is, *key_size* * *count*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Each element specified in *keys* is sequentially deleted. The
|
|
|
8792a8 |
+ * *in_batch*, *out_batch*, and *values* parameters are ignored
|
|
|
8792a8 |
+ * and should be zeroed.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The *elem_flags* argument may be specified as one of the
|
|
|
8792a8 |
+ * following:
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * **BPF_F_LOCK**
|
|
|
8792a8 |
+ * Look up the value of a spin-locked map without
|
|
|
8792a8 |
+ * returning the lock. This must be specified if the
|
|
|
8792a8 |
+ * elements contain a spinlock.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * On success, *count* elements from the map are updated.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * If an error is returned and *errno* is not **EFAULT**, *count*
|
|
|
8792a8 |
+ * is set to the number of successfully processed elements. If
|
|
|
8792a8 |
+ * *errno* is **EFAULT**, up to *count* elements may be been
|
|
|
8792a8 |
+ * deleted.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_LINK_CREATE
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Attach an eBPF program to a *target_fd* at the specified
|
|
|
8792a8 |
+ * *attach_type* hook and return a file descriptor handle for
|
|
|
8792a8 |
+ * managing the link.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * A new file descriptor (a nonnegative integer), or -1 if an
|
|
|
8792a8 |
+ * error occurred (in which case, *errno* is set appropriately).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_LINK_UPDATE
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Update the eBPF program in the specified *link_fd* to
|
|
|
8792a8 |
+ * *new_prog_fd*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_LINK_GET_FD_BY_ID
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Open a file descriptor for the eBPF Link corresponding to
|
|
|
8792a8 |
+ * *link_id*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * A new file descriptor (a nonnegative integer), or -1 if an
|
|
|
8792a8 |
+ * error occurred (in which case, *errno* is set appropriately).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_LINK_GET_NEXT_ID
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Fetch the next eBPF link currently loaded into the kernel.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Looks for the eBPF link with an id greater than *start_id*
|
|
|
8792a8 |
+ * and updates *next_id* on success. If no other eBPF links
|
|
|
8792a8 |
+ * remain with ids higher than *start_id*, returns -1 and sets
|
|
|
8792a8 |
+ * *errno* to **ENOENT**.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, or when no id remains, -1
|
|
|
8792a8 |
+ * is returned and *errno* is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_ENABLE_STATS
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Enable eBPF runtime statistics gathering.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Runtime statistics gathering for the eBPF runtime is disabled
|
|
|
8792a8 |
+ * by default to minimize the corresponding performance overhead.
|
|
|
8792a8 |
+ * This command enables statistics globally.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Multiple programs may independently enable statistics.
|
|
|
8792a8 |
+ * After gathering the desired statistics, eBPF runtime statistics
|
|
|
8792a8 |
+ * may be disabled again by calling **close**\ (2) for the file
|
|
|
8792a8 |
+ * descriptor returned by this function. Statistics will only be
|
|
|
8792a8 |
+ * disabled system-wide when all outstanding file descriptors
|
|
|
8792a8 |
+ * returned by prior calls for this subcommand are closed.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * A new file descriptor (a nonnegative integer), or -1 if an
|
|
|
8792a8 |
+ * error occurred (in which case, *errno* is set appropriately).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_ITER_CREATE
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Create an iterator on top of the specified *link_fd* (as
|
|
|
8792a8 |
+ * previously created using **BPF_LINK_CREATE**) and return a
|
|
|
8792a8 |
+ * file descriptor that can be used to trigger the iteration.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * If the resulting file descriptor is pinned to the filesystem
|
|
|
8792a8 |
+ * using **BPF_OBJ_PIN**, then subsequent **read**\ (2) syscalls
|
|
|
8792a8 |
+ * for that path will trigger the iterator to read kernel state
|
|
|
8792a8 |
+ * using the eBPF program attached to *link_fd*.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * A new file descriptor (a nonnegative integer), or -1 if an
|
|
|
8792a8 |
+ * error occurred (in which case, *errno* is set appropriately).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_LINK_DETACH
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Forcefully detach the specified *link_fd* from its
|
|
|
8792a8 |
+ * corresponding attachment point.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_PROG_BIND_MAP
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * Bind a map to the lifetime of an eBPF program.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The map identified by *map_fd* is bound to the program
|
|
|
8792a8 |
+ * identified by *prog_fd* and only released when *prog_fd* is
|
|
|
8792a8 |
+ * released. This may be used in cases where metadata should be
|
|
|
8792a8 |
+ * associated with a program which otherwise does not contain any
|
|
|
8792a8 |
+ * references to the map (for example, embedded in the eBPF
|
|
|
8792a8 |
+ * program instructions).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * Returns zero on success. On error, -1 is returned and *errno*
|
|
|
8792a8 |
+ * is set appropriately.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * NOTES
|
|
|
8792a8 |
+ * eBPF objects (maps and programs) can be shared between processes.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * * After **fork**\ (2), the child inherits file descriptors
|
|
|
8792a8 |
+ * referring to the same eBPF objects.
|
|
|
8792a8 |
+ * * File descriptors referring to eBPF objects can be transferred over
|
|
|
8792a8 |
+ * **unix**\ (7) domain sockets.
|
|
|
8792a8 |
+ * * File descriptors referring to eBPF objects can be duplicated in the
|
|
|
8792a8 |
+ * usual way, using **dup**\ (2) and similar calls.
|
|
|
8792a8 |
+ * * File descriptors referring to eBPF objects can be pinned to the
|
|
|
8792a8 |
+ * filesystem using the **BPF_OBJ_PIN** command of **bpf**\ (2).
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * An eBPF object is deallocated only after all file descriptors referring
|
|
|
8792a8 |
+ * to the object have been closed and no references remain pinned to the
|
|
|
8792a8 |
+ * filesystem or attached (for example, bound to a program or device).
|
|
|
8792a8 |
+ */
|
|
|
8792a8 |
enum bpf_cmd {
|
|
|
8792a8 |
BPF_MAP_CREATE,
|
|
|
8792a8 |
BPF_MAP_LOOKUP_ELEM,
|
|
|
8792a8 |
@@ -393,6 +1103,15 @@ enum bpf_link_type {
|
|
|
8792a8 |
* is struct/union.
|
|
|
8792a8 |
*/
|
|
|
8792a8 |
#define BPF_PSEUDO_BTF_ID 3
|
|
|
8792a8 |
+/* insn[0].src_reg: BPF_PSEUDO_FUNC
|
|
|
8792a8 |
+ * insn[0].imm: insn offset to the func
|
|
|
8792a8 |
+ * insn[1].imm: 0
|
|
|
8792a8 |
+ * insn[0].off: 0
|
|
|
8792a8 |
+ * insn[1].off: 0
|
|
|
8792a8 |
+ * ldimm64 rewrite: address of the function
|
|
|
8792a8 |
+ * verifier type: PTR_TO_FUNC.
|
|
|
8792a8 |
+ */
|
|
|
8792a8 |
+#define BPF_PSEUDO_FUNC 4
|
|
|
8792a8 |
|
|
|
8792a8 |
/* when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative
|
|
|
8792a8 |
* offset to another bpf function
|
|
|
8792a8 |
@@ -720,7 +1439,7 @@ union bpf_attr {
|
|
|
8792a8 |
* parsed and used to produce a manual page. The workflow is the following,
|
|
|
8792a8 |
* and requires the rst2man utility:
|
|
|
8792a8 |
*
|
|
|
8792a8 |
- * $ ./scripts/bpf_helpers_doc.py \
|
|
|
8792a8 |
+ * $ ./scripts/bpf_doc.py \
|
|
|
8792a8 |
* --filename include/uapi/linux/bpf.h > /tmp/bpf-helpers.rst
|
|
|
8792a8 |
* $ rst2man /tmp/bpf-helpers.rst > /tmp/bpf-helpers.7
|
|
|
8792a8 |
* $ man /tmp/bpf-helpers.7
|
|
|
8792a8 |
@@ -1765,6 +2484,10 @@ union bpf_attr {
|
|
|
8792a8 |
* Use with ENCAP_L3/L4 flags to further specify the tunnel
|
|
|
8792a8 |
* type; *len* is the length of the inner MAC header.
|
|
|
8792a8 |
*
|
|
|
8792a8 |
+ * * **BPF_F_ADJ_ROOM_ENCAP_L2_ETH**:
|
|
|
8792a8 |
+ * Use with BPF_F_ADJ_ROOM_ENCAP_L2 flag to further specify the
|
|
|
8792a8 |
+ * L2 type as Ethernet.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
* A call to this helper is susceptible to change the underlying
|
|
|
8792a8 |
* packet buffer. Therefore, at load time, all checks on pointers
|
|
|
8792a8 |
* previously done by the verifier are invalidated and must be
|
|
|
8792a8 |
@@ -3850,7 +4573,7 @@ union bpf_attr {
|
|
|
8792a8 |
*
|
|
|
8792a8 |
* long bpf_check_mtu(void *ctx, u32 ifindex, u32 *mtu_len, s32 len_diff, u64 flags)
|
|
|
8792a8 |
* Description
|
|
|
8792a8 |
- * Check packet size against exceeding MTU of net device (based
|
|
|
8792a8 |
+ * Check ctx packet size against exceeding MTU of net device (based
|
|
|
8792a8 |
* on *ifindex*). This helper will likely be used in combination
|
|
|
8792a8 |
* with helpers that adjust/change the packet size.
|
|
|
8792a8 |
*
|
|
|
8792a8 |
@@ -3915,6 +4638,34 @@ union bpf_attr {
|
|
|
8792a8 |
* * **BPF_MTU_CHK_RET_FRAG_NEEDED**
|
|
|
8792a8 |
* * **BPF_MTU_CHK_RET_SEGS_TOOBIG**
|
|
|
8792a8 |
*
|
|
|
8792a8 |
+ * long bpf_for_each_map_elem(struct bpf_map *map, void *callback_fn, void *callback_ctx, u64 flags)
|
|
|
8792a8 |
+ * Description
|
|
|
8792a8 |
+ * For each element in **map**, call **callback_fn** function with
|
|
|
8792a8 |
+ * **map**, **callback_ctx** and other map-specific parameters.
|
|
|
8792a8 |
+ * The **callback_fn** should be a static function and
|
|
|
8792a8 |
+ * the **callback_ctx** should be a pointer to the stack.
|
|
|
8792a8 |
+ * The **flags** is used to control certain aspects of the helper.
|
|
|
8792a8 |
+ * Currently, the **flags** must be 0.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * The following are a list of supported map types and their
|
|
|
8792a8 |
+ * respective expected callback signatures:
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * BPF_MAP_TYPE_HASH, BPF_MAP_TYPE_PERCPU_HASH,
|
|
|
8792a8 |
+ * BPF_MAP_TYPE_LRU_HASH, BPF_MAP_TYPE_LRU_PERCPU_HASH,
|
|
|
8792a8 |
+ * BPF_MAP_TYPE_ARRAY, BPF_MAP_TYPE_PERCPU_ARRAY
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * long (\*callback_fn)(struct bpf_map \*map, const void \*key, void \*value, void \*ctx);
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * For per_cpu maps, the map_value is the value on the cpu where the
|
|
|
8792a8 |
+ * bpf_prog is running.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * If **callback_fn** return 0, the helper will continue to the next
|
|
|
8792a8 |
+ * element. If return value is 1, the helper will skip the rest of
|
|
|
8792a8 |
+ * elements and return. Other return values are not used now.
|
|
|
8792a8 |
+ *
|
|
|
8792a8 |
+ * Return
|
|
|
8792a8 |
+ * The number of traversed map elements for success, **-EINVAL** for
|
|
|
8792a8 |
+ * invalid **flags**.
|
|
|
8792a8 |
*/
|
|
|
8792a8 |
#define __BPF_FUNC_MAPPER(FN) \
|
|
|
8792a8 |
FN(unspec), \
|
|
|
8792a8 |
@@ -4081,6 +4832,7 @@ union bpf_attr {
|
|
|
8792a8 |
FN(ima_inode_hash), \
|
|
|
8792a8 |
FN(sock_from_file), \
|
|
|
8792a8 |
FN(check_mtu), \
|
|
|
8792a8 |
+ FN(for_each_map_elem), \
|
|
|
8792a8 |
/* */
|
|
|
8792a8 |
|
|
|
8792a8 |
/* integer value in 'imm' field of BPF_CALL instruction selects which helper
|
|
|
8792a8 |
@@ -4174,6 +4926,7 @@ enum {
|
|
|
8792a8 |
BPF_F_ADJ_ROOM_ENCAP_L4_GRE = (1ULL << 3),
|
|
|
8792a8 |
BPF_F_ADJ_ROOM_ENCAP_L4_UDP = (1ULL << 4),
|
|
|
8792a8 |
BPF_F_ADJ_ROOM_NO_CSUM_RESET = (1ULL << 5),
|
|
|
8792a8 |
+ BPF_F_ADJ_ROOM_ENCAP_L2_ETH = (1ULL << 6),
|
|
|
8792a8 |
};
|
|
|
8792a8 |
|
|
|
8792a8 |
enum {
|
|
|
8792a8 |
@@ -5211,7 +5964,10 @@ struct bpf_pidns_info {
|
|
|
8792a8 |
|
|
|
8792a8 |
/* User accessible data for SK_LOOKUP programs. Add new fields at the end. */
|
|
|
8792a8 |
struct bpf_sk_lookup {
|
|
|
8792a8 |
- __bpf_md_ptr(struct bpf_sock *, sk); /* Selected socket */
|
|
|
8792a8 |
+ union {
|
|
|
8792a8 |
+ __bpf_md_ptr(struct bpf_sock *, sk); /* Selected socket */
|
|
|
8792a8 |
+ __u64 cookie; /* Non-zero if socket was selected in PROG_TEST_RUN */
|
|
|
8792a8 |
+ };
|
|
|
8792a8 |
|
|
|
8792a8 |
__u32 family; /* Protocol family (AF_INET, AF_INET6) */
|
|
|
8792a8 |
__u32 protocol; /* IP protocol (IPPROTO_TCP, IPPROTO_UDP) */
|
|
|
8792a8 |
diff --git a/include/uapi/linux/btf.h b/include/uapi/linux/btf.h
|
|
|
8792a8 |
index 4a42eb48..2c42dcac 100644
|
|
|
8792a8 |
--- a/include/uapi/linux/btf.h
|
|
|
8792a8 |
+++ b/include/uapi/linux/btf.h
|
|
|
8792a8 |
@@ -52,7 +52,7 @@ struct btf_type {
|
|
|
8792a8 |
};
|
|
|
8792a8 |
};
|
|
|
8792a8 |
|
|
|
8792a8 |
-#define BTF_INFO_KIND(info) (((info) >> 24) & 0x0f)
|
|
|
8792a8 |
+#define BTF_INFO_KIND(info) (((info) >> 24) & 0x1f)
|
|
|
8792a8 |
#define BTF_INFO_VLEN(info) ((info) & 0xffff)
|
|
|
8792a8 |
#define BTF_INFO_KFLAG(info) ((info) >> 31)
|
|
|
8792a8 |
|
|
|
8792a8 |
@@ -72,7 +72,8 @@ struct btf_type {
|
|
|
8792a8 |
#define BTF_KIND_FUNC_PROTO 13 /* Function Proto */
|
|
|
8792a8 |
#define BTF_KIND_VAR 14 /* Variable */
|
|
|
8792a8 |
#define BTF_KIND_DATASEC 15 /* Section */
|
|
|
8792a8 |
-#define BTF_KIND_MAX BTF_KIND_DATASEC
|
|
|
8792a8 |
+#define BTF_KIND_FLOAT 16 /* Floating point */
|
|
|
8792a8 |
+#define BTF_KIND_MAX BTF_KIND_FLOAT
|
|
|
8792a8 |
#define NR_BTF_KINDS (BTF_KIND_MAX + 1)
|
|
|
8792a8 |
|
|
|
8792a8 |
/* For some specific BTF_KIND, "struct btf_type" is immediately
|
|
|
8792a8 |
diff --git a/include/uapi/linux/nexthop.h b/include/uapi/linux/nexthop.h
|
|
|
8792a8 |
index b0a56139..37b14b4e 100644
|
|
|
8792a8 |
--- a/include/uapi/linux/nexthop.h
|
|
|
8792a8 |
+++ b/include/uapi/linux/nexthop.h
|
|
|
8792a8 |
@@ -21,7 +21,10 @@ struct nexthop_grp {
|
|
|
8792a8 |
};
|
|
|
8792a8 |
|
|
|
8792a8 |
enum {
|
|
|
8792a8 |
- NEXTHOP_GRP_TYPE_MPATH, /* default type if not specified */
|
|
|
8792a8 |
+ NEXTHOP_GRP_TYPE_MPATH, /* hash-threshold nexthop group
|
|
|
8792a8 |
+ * default type if not specified
|
|
|
8792a8 |
+ */
|
|
|
8792a8 |
+ NEXTHOP_GRP_TYPE_RES, /* resilient nexthop group */
|
|
|
8792a8 |
__NEXTHOP_GRP_TYPE_MAX,
|
|
|
8792a8 |
};
|
|
|
8792a8 |
|
|
|
8792a8 |
@@ -52,8 +55,50 @@ enum {
|
|
|
8792a8 |
NHA_FDB, /* flag; nexthop belongs to a bridge fdb */
|
|
|
8792a8 |
/* if NHA_FDB is added, OIF, BLACKHOLE, ENCAP cannot be set */
|
|
|
8792a8 |
|
|
|
8792a8 |
+ /* nested; resilient nexthop group attributes */
|
|
|
8792a8 |
+ NHA_RES_GROUP,
|
|
|
8792a8 |
+ /* nested; nexthop bucket attributes */
|
|
|
8792a8 |
+ NHA_RES_BUCKET,
|
|
|
8792a8 |
+
|
|
|
8792a8 |
__NHA_MAX,
|
|
|
8792a8 |
};
|
|
|
8792a8 |
|
|
|
8792a8 |
#define NHA_MAX (__NHA_MAX - 1)
|
|
|
8792a8 |
+
|
|
|
8792a8 |
+enum {
|
|
|
8792a8 |
+ NHA_RES_GROUP_UNSPEC,
|
|
|
8792a8 |
+ /* Pad attribute for 64-bit alignment. */
|
|
|
8792a8 |
+ NHA_RES_GROUP_PAD = NHA_RES_GROUP_UNSPEC,
|
|
|
8792a8 |
+
|
|
|
8792a8 |
+ /* u16; number of nexthop buckets in a resilient nexthop group */
|
|
|
8792a8 |
+ NHA_RES_GROUP_BUCKETS,
|
|
|
8792a8 |
+ /* clock_t as u32; nexthop bucket idle timer (per-group) */
|
|
|
8792a8 |
+ NHA_RES_GROUP_IDLE_TIMER,
|
|
|
8792a8 |
+ /* clock_t as u32; nexthop unbalanced timer */
|
|
|
8792a8 |
+ NHA_RES_GROUP_UNBALANCED_TIMER,
|
|
|
8792a8 |
+ /* clock_t as u64; nexthop unbalanced time */
|
|
|
8792a8 |
+ NHA_RES_GROUP_UNBALANCED_TIME,
|
|
|
8792a8 |
+
|
|
|
8792a8 |
+ __NHA_RES_GROUP_MAX,
|
|
|
8792a8 |
+};
|
|
|
8792a8 |
+
|
|
|
8792a8 |
+#define NHA_RES_GROUP_MAX (__NHA_RES_GROUP_MAX - 1)
|
|
|
8792a8 |
+
|
|
|
8792a8 |
+enum {
|
|
|
8792a8 |
+ NHA_RES_BUCKET_UNSPEC,
|
|
|
8792a8 |
+ /* Pad attribute for 64-bit alignment. */
|
|
|
8792a8 |
+ NHA_RES_BUCKET_PAD = NHA_RES_BUCKET_UNSPEC,
|
|
|
8792a8 |
+
|
|
|
8792a8 |
+ /* u16; nexthop bucket index */
|
|
|
8792a8 |
+ NHA_RES_BUCKET_INDEX,
|
|
|
8792a8 |
+ /* clock_t as u64; nexthop bucket idle time */
|
|
|
8792a8 |
+ NHA_RES_BUCKET_IDLE_TIME,
|
|
|
8792a8 |
+ /* u32; nexthop id assigned to the nexthop bucket */
|
|
|
8792a8 |
+ NHA_RES_BUCKET_NH_ID,
|
|
|
8792a8 |
+
|
|
|
8792a8 |
+ __NHA_RES_BUCKET_MAX,
|
|
|
8792a8 |
+};
|
|
|
8792a8 |
+
|
|
|
8792a8 |
+#define NHA_RES_BUCKET_MAX (__NHA_RES_BUCKET_MAX - 1)
|
|
|
8792a8 |
+
|
|
|
8792a8 |
#endif
|
|
|
8792a8 |
diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
|
|
|
8792a8 |
index 7ea59cfe..025c40fe 100644
|
|
|
8792a8 |
--- a/include/uapi/linux/pkt_cls.h
|
|
|
8792a8 |
+++ b/include/uapi/linux/pkt_cls.h
|
|
|
8792a8 |
@@ -190,6 +190,8 @@ enum {
|
|
|
8792a8 |
TCA_POLICE_PAD,
|
|
|
8792a8 |
TCA_POLICE_RATE64,
|
|
|
8792a8 |
TCA_POLICE_PEAKRATE64,
|
|
|
8792a8 |
+ TCA_POLICE_PKTRATE64,
|
|
|
8792a8 |
+ TCA_POLICE_PKTBURST64,
|
|
|
8792a8 |
__TCA_POLICE_MAX
|
|
|
8792a8 |
#define TCA_POLICE_RESULT TCA_POLICE_RESULT
|
|
|
8792a8 |
};
|
|
|
8792a8 |
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
|
|
|
8792a8 |
index b34b9add..f62cccc1 100644
|
|
|
8792a8 |
--- a/include/uapi/linux/rtnetlink.h
|
|
|
8792a8 |
+++ b/include/uapi/linux/rtnetlink.h
|
|
|
8792a8 |
@@ -178,6 +178,13 @@ enum {
|
|
|
8792a8 |
RTM_GETVLAN,
|
|
|
8792a8 |
#define RTM_GETVLAN RTM_GETVLAN
|
|
|
8792a8 |
|
|
|
8792a8 |
+ RTM_NEWNEXTHOPBUCKET = 116,
|
|
|
8792a8 |
+#define RTM_NEWNEXTHOPBUCKET RTM_NEWNEXTHOPBUCKET
|
|
|
8792a8 |
+ RTM_DELNEXTHOPBUCKET,
|
|
|
8792a8 |
+#define RTM_DELNEXTHOPBUCKET RTM_DELNEXTHOPBUCKET
|
|
|
8792a8 |
+ RTM_GETNEXTHOPBUCKET,
|
|
|
8792a8 |
+#define RTM_GETNEXTHOPBUCKET RTM_GETNEXTHOPBUCKET
|
|
|
8792a8 |
+
|
|
|
8792a8 |
__RTM_MAX,
|
|
|
8792a8 |
#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
|
|
|
8792a8 |
};
|
|
|
8792a8 |
--
|
|
|
8792a8 |
2.31.1
|
|
|
8792a8 |
|