From b7b193f499d4acd8a620163ec358c0830e856c9e Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 16 Jun 2018 02:21:58 +0200 Subject: queueing: remove useless spinlocks on sc Since these are the only consumers, there's no need for locking. --- src/queueing.c | 2 +- src/receive.c | 2 -- src/send.c | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/queueing.c b/src/queueing.c index 85dea6b..f33395e 100644 --- a/src/queueing.c +++ b/src/queueing.c @@ -41,6 +41,6 @@ void packet_queue_free(struct crypt_queue *queue, bool multicore) { if (multicore) free_percpu(queue->worker); - WARN_ON(!ptr_ring_empty_bh(&queue->ring)); + WARN_ON(!__ptr_ring_empty(&queue->ring)); ptr_ring_cleanup(&queue->ring, NULL); } diff --git a/src/receive.c b/src/receive.c index 27d3d04..99d6b19 100644 --- a/src/receive.c +++ b/src/receive.c @@ -378,7 +378,6 @@ void packet_rx_worker(struct work_struct *work) bool free; local_bh_disable(); - spin_lock_bh(&queue->ring.consumer_lock); while ((skb = __ptr_ring_peek(&queue->ring)) != NULL && (state = atomic_read(&PACKET_CB(skb)->state)) != PACKET_STATE_UNCRYPTED) { __ptr_ring_discard_one(&queue->ring); peer = PACKET_PEER(skb); @@ -406,7 +405,6 @@ next: if (unlikely(free)) dev_kfree_skb(skb); } - spin_unlock_bh(&queue->ring.consumer_lock); local_bh_enable(); } diff --git a/src/send.c b/src/send.c index 6e04ad4..5151466 100644 --- a/src/send.c +++ b/src/send.c @@ -223,7 +223,6 @@ void packet_tx_worker(struct work_struct *work) struct sk_buff *first; enum packet_state state; - spin_lock_bh(&queue->ring.consumer_lock); while ((first = __ptr_ring_peek(&queue->ring)) != NULL && (state = atomic_read(&PACKET_CB(first)->state)) != PACKET_STATE_UNCRYPTED) { __ptr_ring_discard_one(&queue->ring); peer = PACKET_PEER(first); @@ -237,7 +236,6 @@ void packet_tx_worker(struct work_struct *work) noise_keypair_put(keypair); peer_put(peer); } - spin_unlock_bh(&queue->ring.consumer_lock); } void packet_encrypt_worker(struct work_struct *work) -- cgit v1.2.3-59-g8ed1b