diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-10-08 03:36:20 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-10-08 03:38:12 +0200 |
commit | 1027c1fb4493130ed9df96fd4092c4bf9c599b82 (patch) | |
tree | 9cc86eb2c6c003f220c9d66171a2d5d0f59745b6 /src/receive.c | |
parent | 021084071d57c47c9aabe9c3fcd9be8fd870fa0e (diff) |
global: rename struct wireguard_ to struct wg_
This required a bit of pruning of our christmas trees.
Suggested-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/receive.c')
-rw-r--r-- | src/receive.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/receive.c b/src/receive.c index 9170e6a..f3d0c40 100644 --- a/src/receive.c +++ b/src/receive.c @@ -18,7 +18,7 @@ #include <net/ip_tunnels.h> /* Must be called with bh disabled. */ -static void update_rx_stats(struct wireguard_peer *peer, size_t len) +static void update_rx_stats(struct wg_peer *peer, size_t len) { struct pcpu_sw_netstats *tstats = get_cpu_ptr(peer->device->dev->tstats); @@ -52,7 +52,7 @@ static size_t validate_header_len(struct sk_buff *skb) return 0; } -static int prepare_skb_header(struct sk_buff *skb, struct wireguard_device *wg) +static int prepare_skb_header(struct sk_buff *skb, struct wg_device *wg) { size_t data_offset, data_len, header_len; struct udphdr *udp; @@ -97,13 +97,13 @@ static int prepare_skb_header(struct sk_buff *skb, struct wireguard_device *wg) return 0; } -static void wg_receive_handshake_packet(struct wireguard_device *wg, +static void wg_receive_handshake_packet(struct wg_device *wg, struct sk_buff *skb) { - struct wireguard_peer *peer = NULL; enum cookie_mac_state mac_state; - /* This is global, so that our load calculation applies to - * the whole system. + struct wg_peer *peer = NULL; + /* This is global, so that our load calculation applies to the whole + * system. We don't care about races with it at all. */ static u64 last_under_load; bool packet_needs_cookie; @@ -210,8 +210,8 @@ static void wg_receive_handshake_packet(struct wireguard_device *wg, void wg_packet_handshake_receive_worker(struct work_struct *work) { - struct wireguard_device *wg = - container_of(work, struct multicore_worker, work)->ptr; + struct wg_device *wg = container_of(work, struct multicore_worker, + work)->ptr; struct sk_buff *skb; while ((skb = skb_dequeue(&wg->incoming_handshakes)) != NULL) { @@ -221,7 +221,7 @@ void wg_packet_handshake_receive_worker(struct work_struct *work) } } -static void keep_key_fresh(struct wireguard_peer *peer) +static void keep_key_fresh(struct wg_peer *peer) { struct noise_keypair *keypair; bool send = false; @@ -337,13 +337,13 @@ out: } #include "selftest/counter.c" -static void wg_packet_consume_data_done(struct wireguard_peer *peer, +static void wg_packet_consume_data_done(struct wg_peer *peer, struct sk_buff *skb, struct endpoint *endpoint) { struct net_device *dev = peer->device->dev; - struct wireguard_peer *routed_peer; unsigned int len, len_before_trim; + struct wg_peer *routed_peer; wg_socket_set_peer_endpoint(peer, endpoint); @@ -441,8 +441,7 @@ packet_processed: int wg_packet_rx_poll(struct napi_struct *napi, int budget) { - struct wireguard_peer *peer = - container_of(napi, struct wireguard_peer, napi); + struct wg_peer *peer = container_of(napi, struct wg_peer, napi); struct crypt_queue *queue = &peer->rx_queue; struct noise_keypair *keypair; struct endpoint endpoint; @@ -499,8 +498,8 @@ next: void wg_packet_decrypt_worker(struct work_struct *work) { - struct crypt_queue *queue = - container_of(work, struct multicore_worker, work)->ptr; + struct crypt_queue *queue = container_of(work, struct multicore_worker, + work)->ptr; simd_context_t simd_context; struct sk_buff *skb; @@ -518,11 +517,10 @@ void wg_packet_decrypt_worker(struct work_struct *work) simd_put(&simd_context); } -static void wg_packet_consume_data(struct wireguard_device *wg, - struct sk_buff *skb) +static void wg_packet_consume_data(struct wg_device *wg, struct sk_buff *skb) { __le32 idx = ((struct message_data *)skb->data)->key_idx; - struct wireguard_peer *peer = NULL; + struct wg_peer *peer = NULL; int ret; rcu_read_lock_bh(); @@ -554,7 +552,7 @@ err_keypair: dev_kfree_skb(skb); } -void wg_packet_receive(struct wireguard_device *wg, struct sk_buff *skb) +void wg_packet_receive(struct wg_device *wg, struct sk_buff *skb) { if (unlikely(prepare_skb_header(skb, wg) < 0)) goto err; |