From 5221eceb39a8a4f9bd637ebfa7c0f9c0958e8afa Mon Sep 17 00:00:00 2001 From: Jonathan Neuschäfer Date: Thu, 5 Jul 2018 22:27:29 +0200 Subject: receive: use NAPI on the receive path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Suggested-by: Jason A. Donenfeld [Jason: fixed up the flushing of the rx_queue in peer_remove] Signed-off-by: Jonathan Neuschäfer Signed-off-by: Jason A. Donenfeld --- src/queueing.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/queueing.c') diff --git a/src/queueing.c b/src/queueing.c index f33395e..c8394fc 100644 --- a/src/queueing.c +++ b/src/queueing.c @@ -28,12 +28,14 @@ int packet_queue_init(struct crypt_queue *queue, work_func_t function, bool mult ret = ptr_ring_init(&queue->ring, len, GFP_KERNEL); if (ret) return ret; - if (multicore) { - queue->worker = packet_alloc_percpu_multicore_worker(function, queue); - if (!queue->worker) - return -ENOMEM; - } else - INIT_WORK(&queue->work, function); + if (function) { + if (multicore) { + queue->worker = packet_alloc_percpu_multicore_worker(function, queue); + if (!queue->worker) + return -ENOMEM; + } else + INIT_WORK(&queue->work, function); + } return 0; } -- cgit v1.2.3