Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / net / wireguard / device.h
blob4d0144e169478f1a3c6982effe8deed2146d40d7
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
4 */
6 #ifndef _WG_DEVICE_H
7 #define _WG_DEVICE_H
9 #include "noise.h"
10 #include "allowedips.h"
11 #include "peerlookup.h"
12 #include "cookie.h"
14 #include <linux/types.h>
15 #include <linux/netdevice.h>
16 #include <linux/workqueue.h>
17 #include <linux/mutex.h>
18 #include <linux/net.h>
19 #include <linux/ptr_ring.h>
21 struct wg_device;
23 struct multicore_worker {
24 void *ptr;
25 struct work_struct work;
28 struct crypt_queue {
29 struct ptr_ring ring;
30 union {
31 struct {
32 struct multicore_worker __percpu *worker;
33 int last_cpu;
35 struct work_struct work;
39 struct wg_device {
40 struct net_device *dev;
41 struct crypt_queue encrypt_queue, decrypt_queue;
42 struct sock __rcu *sock4, *sock6;
43 struct net __rcu *creating_net;
44 struct noise_static_identity static_identity;
45 struct workqueue_struct *handshake_receive_wq, *handshake_send_wq;
46 struct workqueue_struct *packet_crypt_wq;
47 struct sk_buff_head incoming_handshakes;
48 int incoming_handshake_cpu;
49 struct multicore_worker __percpu *incoming_handshakes_worker;
50 struct cookie_checker cookie_checker;
51 struct pubkey_hashtable *peer_hashtable;
52 struct index_hashtable *index_hashtable;
53 struct allowedips peer_allowedips;
54 struct mutex device_update_lock, socket_update_lock;
55 struct list_head device_list, peer_list;
56 unsigned int num_peers, device_update_gen;
57 u32 fwmark;
58 u16 incoming_port;
61 int wg_device_init(void);
62 void wg_device_uninit(void);
64 #endif /* _WG_DEVICE_H */