From owner-svn-src-head@FreeBSD.ORG Fri Sep 4 09:48:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 08A151065672; Fri, 4 Sep 2009 09:48:19 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC32D8FC08; Fri, 4 Sep 2009 09:48:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n849mIXD061078; Fri, 4 Sep 2009 09:48:18 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n849mI3Y061075; Fri, 4 Sep 2009 09:48:18 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909040948.n849mI3Y061075@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 4 Sep 2009 09:48:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196825 - head/sys/opencrypto X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Sep 2009 09:48:19 -0000 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); }