Skip to content

Commit 3bd43a8

Browse files
iamkafaiborkmann
authored andcommitted
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 <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
1 parent aa5f0c9 commit 3bd43a8

File tree

1 file changed

+36
-1
lines changed
  • tools/include/uapi/linux

1 file changed

+36
-1
lines changed

tools/include/uapi/linux/bpf.h

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ enum bpf_map_type {
126126
BPF_MAP_TYPE_XSKMAP,
127127
BPF_MAP_TYPE_SOCKHASH,
128128
BPF_MAP_TYPE_CGROUP_STORAGE,
129+
BPF_MAP_TYPE_REUSEPORT_SOCKARRAY,
129130
};
130131

131132
enum bpf_prog_type {
@@ -150,6 +151,7 @@ enum bpf_prog_type {
150151
BPF_PROG_TYPE_CGROUP_SOCK_ADDR,
151152
BPF_PROG_TYPE_LWT_SEG6LOCAL,
152153
BPF_PROG_TYPE_LIRC_MODE2,
154+
BPF_PROG_TYPE_SK_REUSEPORT,
153155
};
154156

155157
enum bpf_attach_type {
@@ -2113,6 +2115,14 @@ union bpf_attr {
21132115
* the shared data.
21142116
* Return
21152117
* 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.
21162126
*/
21172127
#define __BPF_FUNC_MAPPER(FN) \
21182128
FN(unspec), \
@@ -2196,7 +2206,8 @@ union bpf_attr {
21962206
FN(rc_keydown), \
21972207
FN(skb_cgroup_id), \
21982208
FN(get_current_cgroup_id), \
2199-
FN(get_local_storage),
2209+
FN(get_local_storage), \
2210+
FN(sk_select_reuseport),
22002211

22012212
/* integer value in 'imm' field of BPF_CALL instruction selects which helper
22022213
* function eBPF program intends to call
@@ -2413,6 +2424,30 @@ struct sk_msg_md {
24132424
__u32 local_port; /* stored in host byte order */
24142425
};
24152426

2427+
struct 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+
24162451
#define BPF_TAG_SIZE 8
24172452

24182453
struct bpf_prog_info {

0 commit comments

Comments
 (0)