summaryrefslogtreecommitdiffstats
path: root/tools/include
diff options
context:
space:
mode:
authorMartin KaFai Lau <kafai@fb.com>2018-08-08 04:01:29 -0400
committerDaniel Borkmann <daniel@iogearbox.net>2018-08-10 19:58:46 -0400
commit3bd43a8c91cba0493e507ed7baefa9b5613c28a9 (patch)
tree1d776b54f38fb36affd3a67e6a58d4db9b0bbf17 /tools/include
parentaa5f0c96cc7b96a678779055b2ff4cd9dabd8ba7 (diff)
bpf: Sync bpf.h uapi to tools/
This patch sync include/uapi/linux/bpf.h to tools/include/uapi/linux/ Signed-off-by: Martin KaFai Lau <kafai@fb.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/include')
-rw-r--r--tools/include/uapi/linux/bpf.h37
1 files changed, 36 insertions, 1 deletions
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index dd5758dc35d3..3102a2a23c31 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -126,6 +126,7 @@ enum bpf_map_type {
126 BPF_MAP_TYPE_XSKMAP, 126 BPF_MAP_TYPE_XSKMAP,
127 BPF_MAP_TYPE_SOCKHASH, 127 BPF_MAP_TYPE_SOCKHASH,
128 BPF_MAP_TYPE_CGROUP_STORAGE, 128 BPF_MAP_TYPE_CGROUP_STORAGE,
129 BPF_MAP_TYPE_REUSEPORT_SOCKARRAY,
129}; 130};
130 131
131enum bpf_prog_type { 132enum bpf_prog_type {
@@ -150,6 +151,7 @@ enum bpf_prog_type {
150 BPF_PROG_TYPE_CGROUP_SOCK_ADDR, 151 BPF_PROG_TYPE_CGROUP_SOCK_ADDR,
151 BPF_PROG_TYPE_LWT_SEG6LOCAL, 152 BPF_PROG_TYPE_LWT_SEG6LOCAL,
152 BPF_PROG_TYPE_LIRC_MODE2, 153 BPF_PROG_TYPE_LIRC_MODE2,
154 BPF_PROG_TYPE_SK_REUSEPORT,
153}; 155};
154 156
155enum bpf_attach_type { 157enum bpf_attach_type {
@@ -2113,6 +2115,14 @@ union bpf_attr {
2113 * the shared data. 2115 * the shared data.
2114 * Return 2116 * Return
2115 * Pointer to the local storage area. 2117 * Pointer to the local storage area.
2118 *
2119 * int bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags)
2120 * Description
2121 * Select a SO_REUSEPORT sk from a BPF_MAP_TYPE_REUSEPORT_ARRAY map
2122 * It checks the selected sk is matching the incoming
2123 * request in the skb.
2124 * Return
2125 * 0 on success, or a negative error in case of failure.
2116 */ 2126 */
2117#define __BPF_FUNC_MAPPER(FN) \ 2127#define __BPF_FUNC_MAPPER(FN) \
2118 FN(unspec), \ 2128 FN(unspec), \
@@ -2196,7 +2206,8 @@ union bpf_attr {
2196 FN(rc_keydown), \ 2206 FN(rc_keydown), \
2197 FN(skb_cgroup_id), \ 2207 FN(skb_cgroup_id), \
2198 FN(get_current_cgroup_id), \ 2208 FN(get_current_cgroup_id), \
2199 FN(get_local_storage), 2209 FN(get_local_storage), \
2210 FN(sk_select_reuseport),
2200 2211
2201/* integer value in 'imm' field of BPF_CALL instruction selects which helper 2212/* integer value in 'imm' field of BPF_CALL instruction selects which helper
2202 * function eBPF program intends to call 2213 * function eBPF program intends to call
@@ -2413,6 +2424,30 @@ struct sk_msg_md {
2413 __u32 local_port; /* stored in host byte order */ 2424 __u32 local_port; /* stored in host byte order */
2414}; 2425};
2415 2426
2427struct sk_reuseport_md {
2428 /*
2429 * Start of directly accessible data. It begins from
2430 * the tcp/udp header.
2431 */
2432 void *data;
2433 void *data_end; /* End of directly accessible data */
2434 /*
2435 * Total length of packet (starting from the tcp/udp header).
2436 * Note that the directly accessible bytes (data_end - data)
2437 * could be less than this "len". Those bytes could be
2438 * indirectly read by a helper "bpf_skb_load_bytes()".
2439 */
2440 __u32 len;
2441 /*
2442 * Eth protocol in the mac header (network byte order). e.g.
2443 * ETH_P_IP(0x0800) and ETH_P_IPV6(0x86DD)
2444 */
2445 __u32 eth_protocol;
2446 __u32 ip_protocol; /* IP protocol. e.g. IPPROTO_TCP, IPPROTO_UDP */
2447 __u32 bind_inany; /* Is sock bound to an INANY address? */
2448 __u32 hash; /* A hash of the packet 4 tuples */
2449};
2450
2416#define BPF_TAG_SIZE 8 2451#define BPF_TAG_SIZE 8
2417 2452
2418struct bpf_prog_info { 2453struct bpf_prog_info {