Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Sep 2009 09:48:18 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r196825 - head/sys/opencrypto
Message-ID:  <200909040948.n849mI3Y061075@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909040948.n849mI3Y061075>