aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/queueing.h
diff options
context:
space:
mode:
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>2018-07-05 22:27:29 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-07-08 18:45:41 +0200
commit6008eacbf2c7a5f31b0c9d5d0a629cbdfbb8f222 (patch)
tree1d57d8c64149dbf7a1709a1a4cd938ccff868d9d /src/queueing.h
parentqemu: decide debug kernel based on KERNEL_VERSION (diff)
downloadwireguard-monolithic-historical-6008eacbf2c7a5f31b0c9d5d0a629cbdfbb8f222.tar.xz
wireguard-monolithic-historical-6008eacbf2c7a5f31b0c9d5d0a629cbdfbb8f222.zip
receive: use NAPI on the receive path
Suggested-by: Jason A. Donenfeld <Jason@zx2c4.com> [Jason: fixed up the flushing of the rx_queue in peer_remove] Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Diffstat (limited to 'src/queueing.h')
-rw-r--r--src/queueing.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/queueing.h b/src/queueing.h
index 0057cfa..c17b0d8 100644
--- a/src/queueing.h
+++ b/src/queueing.h
@@ -26,8 +26,9 @@ struct multicore_worker __percpu *packet_alloc_percpu_multicore_worker(work_func
/* receive.c APIs: */
void packet_receive(struct wireguard_device *wg, struct sk_buff *skb);
void packet_handshake_receive_worker(struct work_struct *work);
-/* Workqueue workers: */
-void packet_rx_worker(struct work_struct *work);
+/* NAPI poll function: */
+int packet_rx_poll(struct napi_struct *napi, int budget);
+/* Workqueue worker: */
void packet_decrypt_worker(struct work_struct *work);
/* send.c APIs: */
@@ -138,6 +139,15 @@ static inline void queue_enqueue_per_peer(struct crypt_queue *queue, struct sk_b
peer_put(peer);
}
+static inline void queue_enqueue_per_peer_napi(struct crypt_queue *queue, struct sk_buff *skb, enum packet_state state)
+{
+ struct wireguard_peer *peer = peer_rcu_get(PACKET_PEER(skb));
+
+ atomic_set(&PACKET_CB(skb)->state, state);
+ napi_schedule(&peer->napi);
+ peer_put(peer);
+}
+
#ifdef DEBUG
bool packet_counter_selftest(void);
#endif