aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi/linux/bpf.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-03-19 13:05:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-19 13:05:34 -0400
commit1200b6809dfd9d73bc4c7db76d288c35fa4b2ebe (patch)
tree552e03de245cdbd0780ca1215914edc4a26540f7 /include/uapi/linux/bpf.h
parent6b5f04b6cf8ebab9a65d9c0026c650bb2538fd0f (diff)
parentfe30937b65354c7fec244caebbdaae68e28ca797 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: "Highlights: 1) Support more Realtek wireless chips, from Jes Sorenson. 2) New BPF types for per-cpu hash and arrap maps, from Alexei Starovoitov. 3) Make several TCP sysctls per-namespace, from Nikolay Borisov. 4) Allow the use of SO_REUSEPORT in order to do per-thread processing of incoming TCP/UDP connections. The muxing can be done using a BPF program which hashes the incoming packet. From Craig Gallek. 5) Add a multiplexer for TCP streams, to provide a messaged based interface. BPF programs can be used to determine the message boundaries. From Tom Herbert. 6) Add 802.1AE MACSEC support, from Sabrina Dubroca. 7) Avoid factorial complexity when taking down an inetdev interface with lots of configured addresses. We were doing things like traversing the entire address less for each address removed, and flushing the entire netfilter conntrack table for every address as well. 8) Add and use SKB bulk free infrastructure, from Jesper Brouer. 9) Allow offloading u32 classifiers to hardware, and implement for ixgbe, from John Fastabend. 10) Allow configuring IRQ coalescing parameters on a per-queue basis, from Kan Liang. 11) Extend ethtool so that larger link mode masks can be supported. From David Decotigny. 12) Introduce devlink, which can be used to configure port link types (ethernet vs Infiniband, etc.), port splitting, and switch device level attributes as a whole. From Jiri Pirko. 13) Hardware offload support for flower classifiers, from Amir Vadai. 14) Add "Local Checksum Offload". Basically, for a tunneled packet the checksum of the outer header is 'constant' (because with the checksum field filled into the inner protocol header, the payload of the outer frame checksums to 'zero'), and we can take advantage of that in various ways. From Edward Cree" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1548 commits) bonding: fix bond_get_stats() net: bcmgenet: fix dma api length mismatch net/mlx4_core: Fix backward compatibility on VFs phy: mdio-thunder: Fix some Kconfig typos lan78xx: add ndo_get_stats64 lan78xx: handle statistics counter rollover RDS: TCP: Remove unused constant RDS: TCP: Add sysctl tunables for sndbuf/rcvbuf on rds-tcp socket net: smc911x: convert pxa dma to dmaengine team: remove duplicate set of flag IFF_MULTICAST bonding: remove duplicate set of flag IFF_MULTICAST net: fix a comment typo ethernet: micrel: fix some error codes ip_tunnels, bpf: define IP_TUNNEL_OPTS_MAX and use it bpf, dst: add and use dst_tclassid helper bpf: make skb->tc_classid also readable net: mvneta: bm: clarify dependencies cls_bpf: reset class and reuse major in da ldmvsw: Checkpatch sunvnet.c and sunvnet_common.c ldmvsw: Add ldmvsw.c driver code ...
Diffstat (limited to 'include/uapi/linux/bpf.h')
-rw-r--r--include/uapi/linux/bpf.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 5df4881dea7b..924f537183fd 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -81,6 +81,9 @@ enum bpf_map_type {
81 BPF_MAP_TYPE_ARRAY, 81 BPF_MAP_TYPE_ARRAY,
82 BPF_MAP_TYPE_PROG_ARRAY, 82 BPF_MAP_TYPE_PROG_ARRAY,
83 BPF_MAP_TYPE_PERF_EVENT_ARRAY, 83 BPF_MAP_TYPE_PERF_EVENT_ARRAY,
84 BPF_MAP_TYPE_PERCPU_HASH,
85 BPF_MAP_TYPE_PERCPU_ARRAY,
86 BPF_MAP_TYPE_STACK_TRACE,
84}; 87};
85 88
86enum bpf_prog_type { 89enum bpf_prog_type {
@@ -98,12 +101,15 @@ enum bpf_prog_type {
98#define BPF_NOEXIST 1 /* create new element if it didn't exist */ 101#define BPF_NOEXIST 1 /* create new element if it didn't exist */
99#define BPF_EXIST 2 /* update existing element */ 102#define BPF_EXIST 2 /* update existing element */
100 103
104#define BPF_F_NO_PREALLOC (1U << 0)
105
101union bpf_attr { 106union bpf_attr {
102 struct { /* anonymous struct used by BPF_MAP_CREATE command */ 107 struct { /* anonymous struct used by BPF_MAP_CREATE command */
103 __u32 map_type; /* one of enum bpf_map_type */ 108 __u32 map_type; /* one of enum bpf_map_type */
104 __u32 key_size; /* size of key in bytes */ 109 __u32 key_size; /* size of key in bytes */
105 __u32 value_size; /* size of value in bytes */ 110 __u32 value_size; /* size of value in bytes */
106 __u32 max_entries; /* max number of entries in a map */ 111 __u32 max_entries; /* max number of entries in a map */
112 __u32 map_flags; /* prealloc or not */
107 }; 113 };
108 114
109 struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ 115 struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */
@@ -270,6 +276,42 @@ enum bpf_func_id {
270 */ 276 */
271 BPF_FUNC_perf_event_output, 277 BPF_FUNC_perf_event_output,
272 BPF_FUNC_skb_load_bytes, 278 BPF_FUNC_skb_load_bytes,
279
280 /**
281 * bpf_get_stackid(ctx, map, flags) - walk user or kernel stack and return id
282 * @ctx: struct pt_regs*
283 * @map: pointer to stack_trace map
284 * @flags: bits 0-7 - numer of stack frames to skip
285 * bit 8 - collect user stack instead of kernel
286 * bit 9 - compare stacks by hash only
287 * bit 10 - if two different stacks hash into the same stackid
288 * discard old
289 * other bits - reserved
290 * Return: >= 0 stackid on success or negative error
291 */
292 BPF_FUNC_get_stackid,
293
294 /**
295 * bpf_csum_diff(from, from_size, to, to_size, seed) - calculate csum diff
296 * @from: raw from buffer
297 * @from_size: length of from buffer
298 * @to: raw to buffer
299 * @to_size: length of to buffer
300 * @seed: optional seed
301 * Return: csum result
302 */
303 BPF_FUNC_csum_diff,
304
305 /**
306 * bpf_skb_[gs]et_tunnel_opt(skb, opt, size)
307 * retrieve or populate tunnel options metadata
308 * @skb: pointer to skb
309 * @opt: pointer to raw tunnel option data
310 * @size: size of @opt
311 * Return: 0 on success for set, option size for get
312 */
313 BPF_FUNC_skb_get_tunnel_opt,
314 BPF_FUNC_skb_set_tunnel_opt,
273 __BPF_FUNC_MAX_ID, 315 __BPF_FUNC_MAX_ID,
274}; 316};
275 317
@@ -277,6 +319,7 @@ enum bpf_func_id {
277 319
278/* BPF_FUNC_skb_store_bytes flags. */ 320/* BPF_FUNC_skb_store_bytes flags. */
279#define BPF_F_RECOMPUTE_CSUM (1ULL << 0) 321#define BPF_F_RECOMPUTE_CSUM (1ULL << 0)
322#define BPF_F_INVALIDATE_HASH (1ULL << 1)
280 323
281/* BPF_FUNC_l3_csum_replace and BPF_FUNC_l4_csum_replace flags. 324/* BPF_FUNC_l3_csum_replace and BPF_FUNC_l4_csum_replace flags.
282 * First 4 bits are for passing the header field size. 325 * First 4 bits are for passing the header field size.
@@ -285,6 +328,7 @@ enum bpf_func_id {
285 328
286/* BPF_FUNC_l4_csum_replace flags. */ 329/* BPF_FUNC_l4_csum_replace flags. */
287#define BPF_F_PSEUDO_HDR (1ULL << 4) 330#define BPF_F_PSEUDO_HDR (1ULL << 4)
331#define BPF_F_MARK_MANGLED_0 (1ULL << 5)
288 332
289/* BPF_FUNC_clone_redirect and BPF_FUNC_redirect flags. */ 333/* BPF_FUNC_clone_redirect and BPF_FUNC_redirect flags. */
290#define BPF_F_INGRESS (1ULL << 0) 334#define BPF_F_INGRESS (1ULL << 0)
@@ -292,8 +336,15 @@ enum bpf_func_id {
292/* BPF_FUNC_skb_set_tunnel_key and BPF_FUNC_skb_get_tunnel_key flags. */ 336/* BPF_FUNC_skb_set_tunnel_key and BPF_FUNC_skb_get_tunnel_key flags. */
293#define BPF_F_TUNINFO_IPV6 (1ULL << 0) 337#define BPF_F_TUNINFO_IPV6 (1ULL << 0)
294 338
339/* BPF_FUNC_get_stackid flags. */
340#define BPF_F_SKIP_FIELD_MASK 0xffULL
341#define BPF_F_USER_STACK (1ULL << 8)
342#define BPF_F_FAST_STACK_CMP (1ULL << 9)
343#define BPF_F_REUSE_STACKID (1ULL << 10)
344
295/* BPF_FUNC_skb_set_tunnel_key flags. */ 345/* BPF_FUNC_skb_set_tunnel_key flags. */
296#define BPF_F_ZERO_CSUM_TX (1ULL << 1) 346#define BPF_F_ZERO_CSUM_TX (1ULL << 1)
347#define BPF_F_DONT_FRAGMENT (1ULL << 2)
297 348
298/* user accessible mirror of in-kernel sk_buff. 349/* user accessible mirror of in-kernel sk_buff.
299 * new fields can only be added to the end of this structure 350 * new fields can only be added to the end of this structure
@@ -324,6 +375,7 @@ struct bpf_tunnel_key {
324 }; 375 };
325 __u8 tunnel_tos; 376 __u8 tunnel_tos;
326 __u8 tunnel_ttl; 377 __u8 tunnel_ttl;
378 __u32 tunnel_label;
327}; 379};
328 380
329#endif /* _UAPI__LINUX_BPF_H__ */ 381#endif /* _UAPI__LINUX_BPF_H__ */