1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2ef456144SCraig Gallek #ifndef _SOCK_REUSEPORT_H 3ef456144SCraig Gallek #define _SOCK_REUSEPORT_H 4ef456144SCraig Gallek 5538950a1SCraig Gallek #include <linux/filter.h> 6538950a1SCraig Gallek #include <linux/skbuff.h> 7ef456144SCraig Gallek #include <linux/types.h> 8ef456144SCraig Gallek #include <net/sock.h> 9ef456144SCraig Gallek 10ef456144SCraig Gallek struct sock_reuseport { 11ef456144SCraig Gallek struct rcu_head rcu; 12ef456144SCraig Gallek 13ef456144SCraig Gallek u16 max_socks; /* length of socks */ 14ef456144SCraig Gallek u16 num_socks; /* elements in socks */ 15538950a1SCraig Gallek struct bpf_prog __rcu *prog; /* optional BPF sock selector */ 16ef456144SCraig Gallek struct sock *socks[0]; /* array of sock pointers */ 17ef456144SCraig Gallek }; 18ef456144SCraig Gallek 19ef456144SCraig Gallek extern int reuseport_alloc(struct sock *sk); 20b4ace4f1SCraig Gallek extern int reuseport_add_sock(struct sock *sk, struct sock *sk2); 21ef456144SCraig Gallek extern void reuseport_detach_sock(struct sock *sk); 22538950a1SCraig Gallek extern struct sock *reuseport_select_sock(struct sock *sk, 23538950a1SCraig Gallek u32 hash, 24538950a1SCraig Gallek struct sk_buff *skb, 25538950a1SCraig Gallek int hdr_len); 26538950a1SCraig Gallek extern struct bpf_prog *reuseport_attach_prog(struct sock *sk, 27538950a1SCraig Gallek struct bpf_prog *prog); 28ef456144SCraig Gallek 29ef456144SCraig Gallek #endif /* _SOCK_REUSEPORT_H */ 30