blob: aecd30308d500b53a1b46902f2b3d254bcbc39b6 [file] [log] [blame]
Craig Gallekef456142016-01-04 17:41:45 -05001#ifndef _SOCK_REUSEPORT_H
2#define _SOCK_REUSEPORT_H
3
Craig Gallek538950a2016-01-04 17:41:47 -05004#include <linux/filter.h>
5#include <linux/skbuff.h>
Craig Gallekef456142016-01-04 17:41:45 -05006#include <linux/types.h>
7#include <net/sock.h>
8
9struct sock_reuseport {
10 struct rcu_head rcu;
11
12 u16 max_socks; /* length of socks */
13 u16 num_socks; /* elements in socks */
Craig Gallek538950a2016-01-04 17:41:47 -050014 struct bpf_prog __rcu *prog; /* optional BPF sock selector */
Craig Gallekef456142016-01-04 17:41:45 -050015 struct sock *socks[0]; /* array of sock pointers */
16};
17
18extern int reuseport_alloc(struct sock *sk);
Craig Gallekb4ace4f2016-01-19 14:27:08 -050019extern int reuseport_add_sock(struct sock *sk, struct sock *sk2);
Craig Gallekef456142016-01-04 17:41:45 -050020extern void reuseport_detach_sock(struct sock *sk);
Craig Gallek538950a2016-01-04 17:41:47 -050021extern struct sock *reuseport_select_sock(struct sock *sk,
22 u32 hash,
23 struct sk_buff *skb,
24 int hdr_len);
25extern struct bpf_prog *reuseport_attach_prog(struct sock *sk,
26 struct bpf_prog *prog);
Craig Gallekef456142016-01-04 17:41:45 -050027
28#endif /* _SOCK_REUSEPORT_H */