History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next

Alexei Starovoitov says: ==================== pull-request: bpf-next 2020-05-01 (v2) The following pull-request contains BPF updates for your *net-next* tree. We've added 61 non-merge commits during the last 6 day(s) which contain a total of 153 files changed, 6739 insertions(+), 3367 deletions(-). The main changes are: 1) pulled work.sysctl from vfs tree with sysctl bpf changes. 2) bpf_link observability, from Andrii. 3) BTF-defined map in map, from Andrii. 4) asan fixes for selftests, from Andrii. 5) Allow bpf_map_lookup_elem for SOCKMAP and SOCKHASH, from Jakub. 6) production cloudflare classifier as a selftes, from Lorenz. 7) bpf_ktime_get_*_ns() helper improvements, from Maciej. 8) unprivileged bpftool feature probe, from Quentin. 9) BPF_ENABLE_STATS command, from Song. 10) enable bpf_[gs]etsockopt() helpers for sock_ops progs, from Stanislav. 11) enable a bunch of common helpers for cg-device, sysctl, sockopt progs, from Stanislav. ====================

David S. Miller committed 6 years ago

Commit 115506f2 parents 5b95dea 57dc6f3153 files · +6739 −3367Browse files

Showing the changes to include/uapi/linux (1 of 153 files). Show all

Unified · Split

include/uapi/linux/bpf.h+66−3
@@ -113,6 +113,9 @@ enum bpf_cmd { · 112 unmodified lines
113113 BPF_MAP_DELETE_BATCH,
114114 BPF_LINK_CREATE,
115115 BPF_LINK_UPDATE,
116+ BPF_LINK_GET_FD_BY_ID,
117+ BPF_LINK_GET_NEXT_ID,
118+ BPF_ENABLE_STATS,
116119 };
117120
118121 enum bpf_map_type {
@@ -220,6 +223,15 @@ enum bpf_attach_type { · 101 unmodified lines
220223
221224 #define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE
222225
226+enum bpf_link_type {
227+ BPF_LINK_TYPE_UNSPEC = 0,
228+ BPF_LINK_TYPE_RAW_TRACEPOINT = 1,
229+ BPF_LINK_TYPE_TRACING = 2,
230+ BPF_LINK_TYPE_CGROUP = 3,
231+
232+ MAX_BPF_LINK_TYPE,
233+};
234+
223235 /* cgroup-bpf attach flags used in BPF_PROG_ATTACH command
224236 *
225237 * NONE(default): No further bpf programs allowed in the subtree.
@@ -379,6 +391,12 @@ enum { · 153 unmodified lines
379391 */
380392 #define BPF_F_QUERY_EFFECTIVE (1U << 0)
381393
394+/* type for BPF_ENABLE_STATS */
395+enum bpf_stats_type {
396+ /* enabled run_time_ns and run_cnt */
397+ BPF_STATS_RUN_TIME = 0,
398+};
399+
382400 enum bpf_stack_build_id_status {
383401 /* user space need an empty entry to identify end of a trace */
384402 BPF_STACK_BUILD_ID_EMPTY = 0,
@@ -523,6 +541,7 @@ union bpf_attr { · 138 unmodified lines
523541 __u32 prog_id;
524542 __u32 map_id;
525543 __u32 btf_id;
544+ __u32 link_id;
526545 };
527546 __u32 next_id;
528547 __u32 open_flags;
@@ -589,6 +608,10 @@ union bpf_attr { · 60 unmodified lines
589608 __u32 old_prog_fd;
590609 } link_update;
591610
611+ struct { /* struct used by BPF_ENABLE_STATS command */
612+ __u32 type;
613+ } enable_stats;
614+
592615 } __attribute__((aligned(8)));
593616
594617 /* The description below is an attempt at providing documentation to eBPF
@@ -652,6 +675,8 @@ union bpf_attr { · 57 unmodified lines
652675 * u64 bpf_ktime_get_ns(void)
653676 * Description
654677 * Return the time elapsed since system boot, in nanoseconds.
678+ * Does not include time the system was suspended.
679+ * See: clock_gettime(CLOCK_MONOTONIC)
655680 * Return
656681 * Current *ktime*.
657682 *
@@ -1562,7 +1587,7 @@ union bpf_attr { · 904 unmodified lines
15621587 * Return
15631588 * 0
15641589 *
1565− * int bpf_setsockopt(struct bpf_sock_ops *bpf_socket, int level, int optname, void *optval, int optlen)
1590+ * int bpf_setsockopt(void *bpf_socket, int level, int optname, void *optval, int optlen)
15661591 * Description
15671592 * Emulate a call to **setsockopt()** on the socket associated to
15681593 * *bpf_socket*, which must be a full socket. The *level* at
@@ -1570,6 +1595,11 @@ union bpf_attr { · 1 unmodified line
15701595 * must be specified, see **setsockopt(2)** for more information.
15711596 * The option value of length *optlen* is pointed by *optval*.
15721597 *
1598+ * *bpf_socket* should be one of the following:
1599+ * * **struct bpf_sock_ops** for **BPF_PROG_TYPE_SOCK_OPS**.
1600+ * * **struct bpf_sock_addr** for **BPF_CGROUP_INET4_CONNECT**
1601+ * and **BPF_CGROUP_INET6_CONNECT**.
1602+ *
15731603 * This helper actually implements a subset of **setsockopt()**.
15741604 * It supports the following *level*\ s:
15751605 *
@@ -1764,7 +1794,7 @@ union bpf_attr { · 188 unmodified lines
17641794 * Return
17651795 * 0 on success, or a negative error in case of failure.
17661796 *
1767− * int bpf_getsockopt(struct bpf_sock_ops *bpf_socket, int level, int optname, void *optval, int optlen)
1797+ * int bpf_getsockopt(void *bpf_socket, int level, int optname, void *optval, int optlen)
17681798 * Description
17691799 * Emulate a call to **getsockopt()** on the socket associated to
17701800 * *bpf_socket*, which must be a full socket. The *level* at
@@ -1773,6 +1803,11 @@ union bpf_attr { · 2 unmodified lines
17731803 * The retrieved value is stored in the structure pointed by
17741804 * *opval* and of length *optlen*.
17751805 *
1806+ * *bpf_socket* should be one of the following:
1807+ * * **struct bpf_sock_ops** for **BPF_PROG_TYPE_SOCK_OPS**.
1808+ * * **struct bpf_sock_addr** for **BPF_CGROUP_INET4_CONNECT**
1809+ * and **BPF_CGROUP_INET6_CONNECT**.
1810+ *
17761811 * This helper actually implements a subset of **getsockopt()**.
17771812 * It supports the following *level*\ s:
17781813 *
@@ -3025,6 +3060,14 @@ union bpf_attr { · 1246 unmodified lines
30253060 * * **-EOPNOTSUPP** Unsupported operation, for example a
30263061 * call from outside of TC ingress.
30273062 * * **-ESOCKTNOSUPPORT** Socket type not supported (reuseport).
3063+ *
3064+ * u64 bpf_ktime_get_boot_ns(void)
3065+ * Description
3066+ * Return the time elapsed since system boot, in nanoseconds.
3067+ * Does include the time the system was suspended.
3068+ * See: clock_gettime(CLOCK_BOOTTIME)
3069+ * Return
3070+ * Current *ktime*.
30283071 */
30293072 #define __BPF_FUNC_MAPPER(FN) \
30303073 FN(unspec), \
@@ -3151,7 +3194,8 @@ union bpf_attr { · 120 unmodified lines
31513194 FN(xdp_output), \
31523195 FN(get_netns_cookie), \
31533196 FN(get_current_ancestor_cgroup_id), \
3154− FN(sk_assign),
3197+ FN(sk_assign), \
3198+ FN(ktime_get_boot_ns),
31553199
31563200 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
31573201 * function eBPF program intends to call
@@ -3598,6 +3642,25 @@ struct bpf_btf_info { · 440 unmodified lines
35983642 __u32 id;
35993643 } __attribute__((aligned(8)));
36003644
3645+struct bpf_link_info {
3646+ __u32 type;
3647+ __u32 id;
3648+ __u32 prog_id;
3649+ union {
3650+ struct {
3651+ __aligned_u64 tp_name; /* in/out: tp_name buffer ptr */
3652+ __u32 tp_name_len; /* in/out: tp_name buffer len */
3653+ } raw_tracepoint;
3654+ struct {
3655+ __u32 attach_type;
3656+ } tracing;
3657+ struct {
3658+ __u64 cgroup_id;
3659+ __u32 attach_type;
3660+ } cgroup;
3661+ };
3662+} __attribute__((aligned(8)));
3663+
36013664 /* User bpf_sock_addr struct to access socket fields and sockaddr struct passed
36023665 * by user and intended to be used by socket (e.g. to bind to, depends on
36033666 * attach attach type).

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t