History

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

Pull networking updates from David Miller: "Highlights: 1) Maintain the TCP retransmit queue using an rbtree, with 1GB windows at 100Gb this really has become necessary. From Eric Dumazet. 2) Multi-program support for cgroup+bpf, from Alexei Starovoitov. 3) Perform broadcast flooding in hardware in mv88e6xxx, from Andrew Lunn. 4) Add meter action support to openvswitch, from Andy Zhou. 5) Add a data meta pointer for BPF accessible packets, from Daniel Borkmann. 6) Namespace-ify almost all TCP sysctl knobs, from Eric Dumazet. 7) Turn on Broadcom Tags in b53 driver, from Florian Fainelli. 8) More work to move the RTNL mutex down, from Florian Westphal. 9) Add 'bpftool' utility, to help with bpf program introspection. From Jakub Kicinski. 10) Add new 'cpumap' type for XDP_REDIRECT action, from Jesper Dangaard Brouer. 11) Support 'blocks' of transformations in the packet scheduler which can span multiple network devices, from Jiri Pirko. 12) TC flower offload support in cxgb4, from Kumar Sanghvi. 13) Priority based stream scheduler for SCTP, from Marcelo Ricardo Leitner. 14) Thunderbolt networking driver, from Amir Levy and Mika Westerberg. 15) Add RED qdisc offloadability, and use it in mlxsw driver. From Nogah Frankel. 16) eBPF based device controller for cgroup v2, from Roman Gushchin. 17) Add some fundamental tracepoints for TCP, from Song Liu. 18) Remove garbage collection from ipv6 route layer, this is a significant accomplishment. From Wei Wang. 19) Add multicast route offload support to mlxsw, from Yotam Gigi" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (2177 commits) tcp: highest_sack fix geneve: fix fill_info when link down bpf: fix lockdep splat net: cdc_ncm: GetNtbFormat endian fix openvswitch: meter: fix NULL pointer dereference in ovs_meter_cmd_reply_start netem: remove unnecessary 64 bit modulus netem: use 64 bit divide by rate tcp: Namespace-ify sysctl_tcp_default_congestion_control net: Protect iterations over net::fib_notifier_ops in fib_seq_sum() ipv6: set all.accept_dad to 0 by default uapi: fix linux/tls.h userspace compilation error usbnet: ipheth: prevent TX queue timeouts when device not ready vhost_net: conditionally enable tx polling uapi: fix linux/rxrpc.h userspace compilation errors net: stmmac: fix LPI transitioning for dwmac4 atm: horizon: Fix irq release error net-sysfs: trigger netlink notification on ifalias change via sysfs openvswitch: Using kfree_rcu() to simplify the code openvswitch: Make local function ovs_nsh_key_attr_size() static openvswitch: Fix return value check in ovs_meter_cmd_features() ...

Linus Torvalds committed 8 years ago

Commit 5bbcc0f2 parents 892204e 50895b91617 files · +91535 −27255Browse files

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

Unified · Split

tools/include/uapi/linux/bpf.h+150−8
@@ -93,6 +93,7 @@ enum bpf_cmd { · 92 unmodified lines
9393 BPF_PROG_GET_FD_BY_ID,
9494 BPF_MAP_GET_FD_BY_ID,
9595 BPF_OBJ_GET_INFO_BY_FD,
96+ BPF_PROG_QUERY,
9697 };
9798
9899 enum bpf_map_type {
@@ -112,6 +113,7 @@ enum bpf_map_type { · 13 unmodified lines
112113 BPF_MAP_TYPE_HASH_OF_MAPS,
113114 BPF_MAP_TYPE_DEVMAP,
114115 BPF_MAP_TYPE_SOCKMAP,
116+ BPF_MAP_TYPE_CPUMAP,
115117 };
116118
117119 enum bpf_prog_type {
@@ -130,6 +132,7 @@ enum bpf_prog_type { · 12 unmodified lines
130132 BPF_PROG_TYPE_LWT_XMIT,
131133 BPF_PROG_TYPE_SOCK_OPS,
132134 BPF_PROG_TYPE_SK_SKB,
135+ BPF_PROG_TYPE_CGROUP_DEVICE,
133136 };
134137
135138 enum bpf_attach_type {
@@ -139,16 +142,53 @@ enum bpf_attach_type { · 3 unmodified lines
139142 BPF_CGROUP_SOCK_OPS,
140143 BPF_SK_SKB_STREAM_PARSER,
141144 BPF_SK_SKB_STREAM_VERDICT,
145+ BPF_CGROUP_DEVICE,
142146 __MAX_BPF_ATTACH_TYPE
143147 };
144148
145149 #define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE
146150
147−/* If BPF_F_ALLOW_OVERRIDE flag is used in BPF_PROG_ATTACH command
148− * to the given target_fd cgroup the descendent cgroup will be able to
149− * override effective bpf program that was inherited from this cgroup
151+/* cgroup-bpf attach flags used in BPF_PROG_ATTACH command
152+ *
153+ * NONE(default): No further bpf programs allowed in the subtree.
154+ *
155+ * BPF_F_ALLOW_OVERRIDE: If a sub-cgroup installs some bpf program,
156+ * the program in this cgroup yields to sub-cgroup program.
157+ *
158+ * BPF_F_ALLOW_MULTI: If a sub-cgroup installs some bpf program,
159+ * that cgroup program gets run in addition to the program in this cgroup.
160+ *
161+ * Only one program is allowed to be attached to a cgroup with
162+ * NONE or BPF_F_ALLOW_OVERRIDE flag.
163+ * Attaching another program on top of NONE or BPF_F_ALLOW_OVERRIDE will
164+ * release old program and attach the new one. Attach flags has to match.
165+ *
166+ * Multiple programs are allowed to be attached to a cgroup with
167+ * BPF_F_ALLOW_MULTI flag. They are executed in FIFO order
168+ * (those that were attached first, run first)
169+ * The programs of sub-cgroup are executed first, then programs of
170+ * this cgroup and then programs of parent cgroup.
171+ * When children program makes decision (like picking TCP CA or sock bind)
172+ * parent program has a chance to override it.
173+ *
174+ * A cgroup with MULTI or OVERRIDE flag allows any attach flags in sub-cgroups.
175+ * A cgroup with NONE doesn't allow any programs in sub-cgroups.
176+ * Ex1:
177+ * cgrp1 (MULTI progs A, B) ->
178+ * cgrp2 (OVERRIDE prog C) ->
179+ * cgrp3 (MULTI prog D) ->
180+ * cgrp4 (OVERRIDE prog E) ->
181+ * cgrp5 (NONE prog F)
182+ * the event in cgrp5 triggers execution of F,D,A,B in that order.
183+ * if prog F is detached, the execution is E,D,A,B
184+ * if prog F and D are detached, the execution is E,A,B
185+ * if prog F, E and D are detached, the execution is C,A,B
186+ *
187+ * All eligible programs are executed regardless of return code from
188+ * earlier programs.
150189 */
151190 #define BPF_F_ALLOW_OVERRIDE (1U << 0)
191+#define BPF_F_ALLOW_MULTI (1U << 1)
152192
153193 /* If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the
154194 * verifier will perform strict alignment checking as if the kernel
@@ -176,6 +216,15 @@ enum bpf_attach_type { · 21 unmodified lines
176216 /* Specify numa node during map creation */
177217 #define BPF_F_NUMA_NODE (1U << 2)
178218
219+/* flags for BPF_PROG_QUERY */
220+#define BPF_F_QUERY_EFFECTIVE (1U << 0)
221+
222+#define BPF_OBJ_NAME_LEN 16U
223+
224+/* Flags for accessing BPF object */
225+#define BPF_F_RDONLY (1U << 3)
226+#define BPF_F_WRONLY (1U << 4)
227+
179228 union bpf_attr {
180229 struct { /* anonymous struct used by BPF_MAP_CREATE command */
181230 __u32 map_type; /* one of enum bpf_map_type */
@@ -189,6 +238,7 @@ union bpf_attr { · 7 unmodified lines
189238 __u32 numa_node; /* numa node (effective only if
190239 * BPF_F_NUMA_NODE is set).
191240 */
241+ char map_name[BPF_OBJ_NAME_LEN];
192242 };
193243
194244 struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */
@@ -211,11 +261,14 @@ union bpf_attr { · 16 unmodified lines
211261 __aligned_u64 log_buf; /* user supplied buffer */
212262 __u32 kern_version; /* checked when prog_type=kprobe */
213263 __u32 prog_flags;
264+ char prog_name[BPF_OBJ_NAME_LEN];
265+ __u32 prog_target_ifindex; /* ifindex of netdev to prep for */
214266 };
215267
216268 struct { /* anonymous struct used by BPF_OBJ_* commands */
217269 __aligned_u64 pathname;
218270 __u32 bpf_fd;
271+ __u32 file_flags;
219272 };
220273
221274 struct { /* anonymous struct used by BPF_PROG_ATTACH/DETACH commands */
@@ -243,6 +296,7 @@ union bpf_attr { · 21 unmodified lines
243296 __u32 map_id;
244297 };
245298 __u32 next_id;
299+ __u32 open_flags;
246300 };
247301
248302 struct { /* anonymous struct used by BPF_OBJ_GET_INFO_BY_FD */
@@ -250,6 +304,15 @@ union bpf_attr { · 1 unmodified line
250304 __u32 info_len;
251305 __aligned_u64 info;
252306 } info;
307+
308+ struct { /* anonymous struct used by BPF_PROG_QUERY command */
309+ __u32 target_fd; /* container object to query */
310+ __u32 attach_type;
311+ __u32 query_flags;
312+ __u32 attach_flags;
313+ __aligned_u64 prog_ids;
314+ __u32 prog_cnt;
315+ } query;
253316 } __attribute__((aligned(8)));
254317
255318 /* BPF helper function descriptions:
@@ -554,12 +617,22 @@ union bpf_attr { · 298 unmodified lines
554617 * int bpf_setsockopt(bpf_socket, level, optname, optval, optlen)
555618 * Calls setsockopt. Not all opts are available, only those with
556619 * integer optvals plus TCP_CONGESTION.
557− * Supported levels: SOL_SOCKET and IPROTO_TCP
620+ * Supported levels: SOL_SOCKET and IPPROTO_TCP
621+ * @bpf_socket: pointer to bpf_socket
622+ * @level: SOL_SOCKET or IPPROTO_TCP
623+ * @optname: option name
624+ * @optval: pointer to option value
625+ * @optlen: length of optval in bytes
626+ * Return: 0 or negative error
627+ *
628+ * int bpf_getsockopt(bpf_socket, level, optname, optval, optlen)
629+ * Calls getsockopt. Not all opts are available.
630+ * Supported levels: IPPROTO_TCP
558631 * @bpf_socket: pointer to bpf_socket
559− * @level: SOL_SOCKET or IPROTO_TCP
632+ * @level: IPPROTO_TCP
560633 * @optname: option name
561634 * @optval: pointer to option value
562− * @optlen: length of optval in byes
635+ * @optlen: length of optval in bytes
563636 * Return: 0 or negative error
564637 *
565638 * int bpf_skb_adjust_room(skb, len_diff, mode, flags)
@@ -583,6 +656,27 @@ union bpf_attr { · 17 unmodified lines
583656 * @map: pointer to sockmap to update
584657 * @key: key to insert/update sock in map
585658 * @flags: same flags as map update elem
659+ *
660+ * int bpf_xdp_adjust_meta(xdp_md, delta)
661+ * Adjust the xdp_md.data_meta by delta
662+ * @xdp_md: pointer to xdp_md
663+ * @delta: An positive/negative integer to be added to xdp_md.data_meta
664+ * Return: 0 on success or negative on error
665+ *
666+ * int bpf_perf_event_read_value(map, flags, buf, buf_size)
667+ * read perf event counter value and perf event enabled/running time
668+ * @map: pointer to perf_event_array map
669+ * @flags: index of event in the map or bitmask flags
670+ * @buf: buf to fill
671+ * @buf_size: size of the buf
672+ * Return: 0 on success or negative error code
673+ *
674+ * int bpf_perf_prog_read_value(ctx, buf, buf_size)
675+ * read perf prog attached perf event counter and enabled/running time
676+ * @ctx: pointer to ctx
677+ * @buf: buf to fill
678+ * @buf_size: size of the buf
679+ * Return : 0 on success or negative error code
586680 */
587681 #define __BPF_FUNC_MAPPER(FN) \
588682 FN(unspec), \
@@ -639,6 +733,10 @@ union bpf_attr { · 50 unmodified lines
639733 FN(redirect_map), \
640734 FN(sk_redirect_map), \
641735 FN(sock_map_update), \
736+ FN(xdp_adjust_meta), \
737+ FN(perf_event_read_value), \
738+ FN(perf_prog_read_value), \
739+ FN(getsockopt),
642740
643741 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
644742 * function eBPF program intends to call
@@ -682,7 +780,9 @@ enum bpf_func_id { · 37 unmodified lines
682780 #define BPF_F_ZERO_CSUM_TX (1ULL << 1)
683781 #define BPF_F_DONT_FRAGMENT (1ULL << 2)
684782
685−/* BPF_FUNC_perf_event_output and BPF_FUNC_perf_event_read flags. */
783+/* BPF_FUNC_perf_event_output, BPF_FUNC_perf_event_read and
784+ * BPF_FUNC_perf_event_read_value flags.
785+ */
686786 #define BPF_F_INDEX_MASK 0xffffffffULL
687787 #define BPF_F_CURRENT_CPU BPF_F_INDEX_MASK
688788 /* BPF_FUNC_perf_event_output for sk_buff input context. */
@@ -716,7 +816,7 @@ struct __sk_buff { · 27 unmodified lines
716816 __u32 data_end;
717817 __u32 napi_id;
718818
719− /* accessed by BPF_PROG_TYPE_sk_skb types */
819+ /* Accessed by BPF_PROG_TYPE_sk_skb types from here to ... */
720820 __u32 family;
721821 __u32 remote_ip4; /* Stored in network byte order */
722822 __u32 local_ip4; /* Stored in network byte order */
@@ -724,6 +824,9 @@ struct __sk_buff { · 1 unmodified line
724824 __u32 local_ip6[4]; /* Stored in network byte order */
725825 __u32 remote_port; /* Stored in network byte order */
726826 __u32 local_port; /* stored in host byte order */
827+ /* ... here. */
828+
829+ __u32 data_meta;
727830 };
728831
729832 struct bpf_tunnel_key {
@@ -784,6 +887,7 @@ enum xdp_action { · 54 unmodified lines
784887 struct xdp_md {
785888 __u32 data;
786889 __u32 data_end;
890+ __u32 data_meta;
787891 };
788892
789893 enum sk_action {
@@ -793,6 +897,10 @@ enum sk_action { · 3 unmodified lines
793897
794898 #define BPF_TAG_SIZE 8
795899
900+enum bpf_prog_status {
901+ BPF_PROG_STATUS_DEV_BOUND = (1 << 0),
902+};
903+
796904 struct bpf_prog_info {
797905 __u32 type;
798906 __u32 id;
@@ -801,6 +909,13 @@ struct bpf_prog_info { · 2 unmodified lines
801909 __u32 xlated_prog_len;
802910 __aligned_u64 jited_prog_insns;
803911 __aligned_u64 xlated_prog_insns;
912+ __u64 load_time; /* ns since boottime */
913+ __u32 created_by_uid;
914+ __u32 nr_map_ids;
915+ __aligned_u64 map_ids;
916+ char name[BPF_OBJ_NAME_LEN];
917+ __u32 ifindex;
918+ __u32 status;
804919 } __attribute__((aligned(8)));
805920
806921 struct bpf_map_info {
@@ -810,6 +925,7 @@ struct bpf_map_info { · 3 unmodified lines
810925 __u32 value_size;
811926 __u32 max_entries;
812927 __u32 map_flags;
928+ char name[BPF_OBJ_NAME_LEN];
813929 } __attribute__((aligned(8)));
814930
815931 /* User bpf_sock_ops struct to access socket values and specify request ops
@@ -859,9 +975,35 @@ enum { · 43 unmodified lines
859975 BPF_SOCK_OPS_NEEDS_ECN, /* If connection's congestion control
860976 * needs ECN
861977 */
978+ BPF_SOCK_OPS_BASE_RTT, /* Get base RTT. The correct value is
979+ * based on the path and may be
980+ * dependent on the congestion control
981+ * algorithm. In general it indicates
982+ * a congestion threshold. RTTs above
983+ * this indicate congestion
984+ */
862985 };
863986
864987 #define TCP_BPF_IW 1001 /* Set TCP initial congestion window */
865988 #define TCP_BPF_SNDCWND_CLAMP 1002 /* Set sndcwnd_clamp */
866989
990+struct bpf_perf_event_value {
991+ __u64 counter;
992+ __u64 enabled;
993+ __u64 running;
994+};
995+
996+#define BPF_DEVCG_ACC_MKNOD (1ULL << 0)
997+#define BPF_DEVCG_ACC_READ (1ULL << 1)
998+#define BPF_DEVCG_ACC_WRITE (1ULL << 2)
999+
1000+#define BPF_DEVCG_DEV_BLOCK (1ULL << 0)
1001+#define BPF_DEVCG_DEV_CHAR (1ULL << 1)
1002+
1003+struct bpf_cgroup_dev_ctx {
1004+ __u32 access_type; /* (access << 16) | type */
1005+ __u32 major;
1006+ __u32 minor;
1007+};
1008+
8671009 #endif /* _UAPI__LINUX_BPF_H__ */