svn commit: r196825 - head/sys/opencrypto
Pawel Jakub Dawidek
pjd at FreeBSD.org
Fri Sep 4 09:48:19 UTC 2009
Author: pjd
Date: Fri Sep 4 09:48:18 2009
New Revision: 196825
URL: http://svn.freebsd.org/changeset/base/196825
Log:
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)
Modified:
head/sys/opencrypto/cryptodev.c
Modified: head/sys/opencrypto/cryptodev.c
==============================================================================
--- head/sys/opencrypto/cryptodev.c Fri Sep 4 09:40:59 2009 (r196824)
+++ head/sys/opencrypto/cryptodev.c Fri Sep 4 09:48:18 2009 (r196825)
@@ -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);
}
More information about the svn-src-all
mailing list