diff options
author | pjd <pjd@FreeBSD.org> | 2009-09-04 09:48:18 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2009-09-04 09:48:18 +0000 |
commit | 6552caebd3f50b3ee805fb2fb52d1d6f77476044 (patch) | |
tree | 974cbad101da77e4873ebb87d7c1c3d9ba22d21d /sys/opencrypto/cryptodev.c | |
parent | 81e539fed7bc8e9b33dfd4d57690cb4b52f77485 (diff) | |
download | FreeBSD-src-6552caebd3f50b3ee805fb2fb52d1d6f77476044.zip FreeBSD-src-6552caebd3f50b3ee805fb2fb52d1d6f77476044.tar.gz |
If crypto operation is finished with EAGAIN, don't repeat operation from
the return context, but from the original context.
Before repeating operation clear DONE flag and error.
Reviewed by: sam
Obtained from: Wheel Sp. z o.o. (http://www.wheel.pl)
Diffstat (limited to 'sys/opencrypto/cryptodev.c')
-rw-r--r-- | sys/opencrypto/cryptodev.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index 5f1331d..6ba4425 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -496,6 +496,7 @@ cryptodev_op( goto bail; } +again: /* * Let the dispatch run unlocked, then, interlock against the * callback before checking if the operation completed and going @@ -512,6 +513,12 @@ cryptodev_op( if (error != 0) goto bail; + if (crp->crp_etype == EAGAIN) { + crp->crp_etype = 0; + crp->crp_flags &= ~CRYPTO_F_DONE; + goto again; + } + if (crp->crp_etype != 0) { error = crp->crp_etype; goto bail; @@ -545,16 +552,10 @@ cryptodev_cb(void *op) { struct cryptop *crp = (struct cryptop *) op; struct csession *cse = (struct csession *)crp->crp_opaque; - int error; - error = crp->crp_etype; - if (error == EAGAIN) - error = crypto_dispatch(crp); mtx_lock(&cse->lock); - if (error != 0 || (crp->crp_flags & CRYPTO_F_DONE)) { - cse->error = error; - wakeup_one(crp); - } + cse->error = crp->crp_etype; + wakeup_one(crp); mtx_unlock(&cse->lock); return (0); } |