]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
bpf: Sync bpf.h uapi to tools/
authorMartin KaFai Lau <kafai@fb.com>
Wed, 8 Aug 2018 08:01:29 +0000 (01:01 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 10 Aug 2018 23:58:46 +0000 (01:58 +0200)
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>
tools/include/uapi/linux/bpf.h

index dd5758dc35d305e6b5a3faaa98e7390ac8984560..3102a2a23c318d9803c09ea7464fdc5f6b1cf3f3 100644 (file)
@@ -126,6 +126,7 @@ enum bpf_map_type {
        BPF_MAP_TYPE_XSKMAP,
        BPF_MAP_TYPE_SOCKHASH,
        BPF_MAP_TYPE_CGROUP_STORAGE,
+       BPF_MAP_TYPE_REUSEPORT_SOCKARRAY,
 };
 
 enum bpf_prog_type {
@@ -150,6 +151,7 @@ enum bpf_prog_type {
        BPF_PROG_TYPE_CGROUP_SOCK_ADDR,
        BPF_PROG_TYPE_LWT_SEG6LOCAL,
        BPF_PROG_TYPE_LIRC_MODE2,
+       BPF_PROG_TYPE_SK_REUSEPORT,
 };
 
 enum bpf_attach_type {
@@ -2113,6 +2115,14 @@ union bpf_attr {
  *             the shared data.
  *     Return
  *             Pointer to the local storage area.
+ *
+ * int bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags)
+ *     Description
+ *             Select a SO_REUSEPORT sk from a BPF_MAP_TYPE_REUSEPORT_ARRAY map
+ *             It checks the selected sk is matching the incoming
+ *             request in the skb.
+ *     Return
+ *             0 on success, or a negative error in case of failure.
  */
 #define __BPF_FUNC_MAPPER(FN)          \
        FN(unspec),                     \
@@ -2196,7 +2206,8 @@ union bpf_attr {
        FN(rc_keydown),                 \
        FN(skb_cgroup_id),              \
        FN(get_current_cgroup_id),      \
-       FN(get_local_storage),
+       FN(get_local_storage),          \
+       FN(sk_select_reuseport),
 
 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
  * function eBPF program intends to call
@@ -2413,6 +2424,30 @@ struct sk_msg_md {
        __u32 local_port;       /* stored in host byte order */
 };
 
+struct sk_reuseport_md {
+       /*
+        * Start of directly accessible data. It begins from
+        * the tcp/udp header.
+        */
+       void *data;
+       void *data_end;         /* End of directly accessible data */
+       /*
+        * Total length of packet (starting from the tcp/udp header).
+        * Note that the directly accessible bytes (data_end - data)
+        * could be less than this "len".  Those bytes could be
+        * indirectly read by a helper "bpf_skb_load_bytes()".
+        */
+       __u32 len;
+       /*
+        * Eth protocol in the mac header (network byte order). e.g.
+        * ETH_P_IP(0x0800) and ETH_P_IPV6(0x86DD)
+        */
+       __u32 eth_protocol;
+       __u32 ip_protocol;      /* IP protocol. e.g. IPPROTO_TCP, IPPROTO_UDP */
+       __u32 bind_inany;       /* Is sock bound to an INANY address? */
+       __u32 hash;             /* A hash of the packet 4 tuples */
+};
+
 #define BPF_TAG_SIZE   8
 
 struct bpf_prog_info {