Craig Gallek | ef45614 | 2016-01-04 17:41:45 -0500 | [diff] [blame] | 1 | #ifndef _SOCK_REUSEPORT_H |
| 2 | #define _SOCK_REUSEPORT_H |
| 3 | |
Craig Gallek | 538950a | 2016-01-04 17:41:47 -0500 | [diff] [blame] | 4 | #include <linux/filter.h> |
| 5 | #include <linux/skbuff.h> |
Craig Gallek | ef45614 | 2016-01-04 17:41:45 -0500 | [diff] [blame] | 6 | #include <linux/types.h> |
| 7 | #include <net/sock.h> |
| 8 | |
| 9 | struct sock_reuseport { |
| 10 | struct rcu_head rcu; |
| 11 | |
| 12 | u16 max_socks; /* length of socks */ |
| 13 | u16 num_socks; /* elements in socks */ |
Craig Gallek | 538950a | 2016-01-04 17:41:47 -0500 | [diff] [blame] | 14 | struct bpf_prog __rcu *prog; /* optional BPF sock selector */ |
Craig Gallek | ef45614 | 2016-01-04 17:41:45 -0500 | [diff] [blame] | 15 | struct sock *socks[0]; /* array of sock pointers */ |
| 16 | }; |
| 17 | |
| 18 | extern int reuseport_alloc(struct sock *sk); |
| 19 | extern int reuseport_add_sock(struct sock *sk, const struct sock *sk2); |
| 20 | extern void reuseport_detach_sock(struct sock *sk); |
Craig Gallek | 538950a | 2016-01-04 17:41:47 -0500 | [diff] [blame] | 21 | extern struct sock *reuseport_select_sock(struct sock *sk, |
| 22 | u32 hash, |
| 23 | struct sk_buff *skb, |
| 24 | int hdr_len); |
| 25 | extern struct bpf_prog *reuseport_attach_prog(struct sock *sk, |
| 26 | struct bpf_prog *prog); |
Craig Gallek | ef45614 | 2016-01-04 17:41:45 -0500 | [diff] [blame] | 27 | |
| 28 | #endif /* _SOCK_REUSEPORT_H */ |