summaryrefslogtreecommitdiffstats
path: root/sys/opencrypto
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2006-05-22 09:58:34 +0000
committerpjd <pjd@FreeBSD.org>2006-05-22 09:58:34 +0000
commit76a66b1d1475236fa6de7576bea8e189948e7cac (patch)
tree642877458b958fa6190fd389a89f315e8622bb46 /sys/opencrypto
parentd316f794dd9aa1b84aac8ddbd44602325b25cebc (diff)
downloadFreeBSD-src-76a66b1d1475236fa6de7576bea8e189948e7cac.zip
FreeBSD-src-76a66b1d1475236fa6de7576bea8e189948e7cac.tar.gz
Don't wakeup the crypto_ret_proc thread if it is running already.
Before the change if the thread was working on symmetric operation, we would send unnecessary wakeup after adding asymmetric operation (when asym queue was empty) and vice versa.
Diffstat (limited to 'sys/opencrypto')
-rw-r--r--sys/opencrypto/crypto.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c
index 36e32a7..bd3e578 100644
--- a/sys/opencrypto/crypto.c
+++ b/sys/opencrypto/crypto.c
@@ -79,6 +79,7 @@ static TAILQ_HEAD(,cryptkop) crp_ret_kq;
static struct mtx crypto_ret_q_mtx;
#define CRYPTO_RETQ_LOCK() mtx_lock(&crypto_ret_q_mtx)
#define CRYPTO_RETQ_UNLOCK() mtx_unlock(&crypto_ret_q_mtx)
+#define CRYPTO_RETQ_EMPTY() (TAILQ_EMPTY(&crp_ret_q) && TAILQ_EMPTY(&crp_ret_kq))
static uma_zone_t cryptop_zone;
static uma_zone_t cryptodesc_zone;
@@ -953,7 +954,7 @@ crypto_done(struct cryptop *crp)
* Normal case; queue the callback for the thread.
*/
CRYPTO_RETQ_LOCK();
- if (TAILQ_EMPTY(&crp_ret_q))
+ if (CRYPTO_RETQ_EMPTY())
wakeup_one(&crp_ret_q); /* shared wait channel */
TAILQ_INSERT_TAIL(&crp_ret_q, crp, crp_next);
CRYPTO_RETQ_UNLOCK();
@@ -981,7 +982,7 @@ crypto_kdone(struct cryptkop *krp)
}
CRYPTO_DRIVER_UNLOCK();
CRYPTO_RETQ_LOCK();
- if (TAILQ_EMPTY(&crp_ret_kq))
+ if (CRYPTO_RETQ_EMPTY())
wakeup_one(&crp_ret_q); /* shared wait channel */
TAILQ_INSERT_TAIL(&crp_ret_kq, krp, krp_next);
CRYPTO_RETQ_UNLOCK();
OpenPOWER on IntegriCloud