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