From: Christophe LEROY <christophe.leroy@c-s.fr>
To: Gilad Ben-Yossef <gilad@benyossef.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Jonathan Corbet <corbet@lwn.net>,
David Howells <dhowells@redhat.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
Gary Hook <gary.hook@amd.com>,
Boris Brezillon <boris.brezillon@free-electrons.com>,
Arnaud Ebalard <arno@natisbad.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
Alasdair Kergon <agk@redhat.com>,
Mike Snitzer <snitzer@redhat.com>,
dm-devel@redhat.com, Steve French <sfrench@samba.org>,
"Theodore Y. Ts'o" <tytso@mit.edu>,
Jaegeuk Kim <jaegeuk@kernel.org>,
Steffen Klassert <steffen.klassert@secunet.com>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Mimi Zohar <zohar@linux.vnet.ibm.com>,
Dmitry Kasatkin <dmitry.kasatkin@gmail.com>,
James Morris <james.l.morris@oracle.com>,
"Serge E. Hallyn" <serge@hallyn.com>
Cc: Ofir Drang <ofir.drang@arm.com>,
linux-crypto@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, keyrings@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-cifs@vger.kernel.org,
samba-technical@lists.samba.org, linux-fscrypt@vger.kernel.org,
netdev@vger.kernel.org, linux-ima-devel@lists.sourceforge.net,
linux-ima-user@lists.sourceforge.net,
linux-security-module@vger.kernel.org
Subject: Re: [PATCH v9 17/20] crypto: talitos: move to generic async completion
Date: Tue, 17 Oct 2017 12:50:41 +0200 [thread overview]
Message-ID: <b75d3b02-2aba-124c-ccf5-7241775c004c@c-s.fr> (raw)
In-Reply-To: <1508059209-25529-18-git-send-email-gilad@benyossef.com>
Le 15/10/2017 à 11:20, Gilad Ben-Yossef a écrit :
> The talitos driver starts several async crypto ops and waits for their
> completions. Move it over to generic code doing the same.
>
> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Tested-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
> drivers/crypto/talitos.c | 38 +++++---------------------------------
> 1 file changed, 5 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
> index 5bd8191..9c80e0c 100644
> --- a/drivers/crypto/talitos.c
> +++ b/drivers/crypto/talitos.c
> @@ -2160,22 +2160,6 @@ static int ahash_import(struct ahash_request *areq, const void *in)
> return 0;
> }
>
> -struct keyhash_result {
> - struct completion completion;
> - int err;
> -};
> -
> -static void keyhash_complete(struct crypto_async_request *req, int err)
> -{
> - struct keyhash_result *res = req->data;
> -
> - if (err == -EINPROGRESS)
> - return;
> -
> - res->err = err;
> - complete(&res->completion);
> -}
> -
> static int keyhash(struct crypto_ahash *tfm, const u8 *key, unsigned int keylen,
> u8 *hash)
> {
> @@ -2183,10 +2167,10 @@ static int keyhash(struct crypto_ahash *tfm, const u8 *key, unsigned int keylen,
>
> struct scatterlist sg[1];
> struct ahash_request *req;
> - struct keyhash_result hresult;
> + struct crypto_wait wait;
> int ret;
>
> - init_completion(&hresult.completion);
> + crypto_init_wait(&wait);
>
> req = ahash_request_alloc(tfm, GFP_KERNEL);
> if (!req)
> @@ -2195,25 +2179,13 @@ static int keyhash(struct crypto_ahash *tfm, const u8 *key, unsigned int keylen,
> /* Keep tfm keylen == 0 during hash of the long key */
> ctx->keylen = 0;
> ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
> - keyhash_complete, &hresult);
> + crypto_req_done, &wait);
>
> sg_init_one(&sg[0], key, keylen);
>
> ahash_request_set_crypt(req, sg, hash, keylen);
> - ret = crypto_ahash_digest(req);
> - switch (ret) {
> - case 0:
> - break;
> - case -EINPROGRESS:
> - case -EBUSY:
> - ret = wait_for_completion_interruptible(
> - &hresult.completion);
> - if (!ret)
> - ret = hresult.err;
> - break;
> - default:
> - break;
> - }
> + ret = crypto_wait_req(crypto_ahash_digest(req), &wait);
> +
> ahash_request_free(req);
>
> return ret;
>
next prev parent reply other threads:[~2017-10-17 10:51 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-15 9:19 [PATCH v9 00/20] simplify crypto wait for async op Gilad Ben-Yossef
2017-10-15 9:19 ` [PATCH v9 01/20] crypto: change transient busy return code to -EAGAIN Gilad Ben-Yossef
2017-10-15 9:19 ` [PATCH v9 02/20] crypto: ccp: use -EAGAIN for transient busy indication Gilad Ben-Yossef
2017-10-15 9:19 ` [PATCH v9 03/20] net: " Gilad Ben-Yossef
2017-10-15 9:19 ` [PATCH v9 04/20] crypto: remove redundant backlog checks on EBUSY Gilad Ben-Yossef
2017-10-15 9:19 ` [PATCH v9 05/20] crypto: marvell/cesa: " Gilad Ben-Yossef
2017-10-15 9:19 ` [PATCH v9 06/20] crypto: introduce crypto wait for async op Gilad Ben-Yossef
2017-10-15 9:19 ` [PATCH v9 07/20] crypto: move algif to generic async completion Gilad Ben-Yossef
2017-10-15 9:19 ` [PATCH v9 08/20] crypto: move pub key " Gilad Ben-Yossef
2017-10-15 9:19 ` [PATCH v9 09/20] crypto: move drbg " Gilad Ben-Yossef
2017-10-15 9:19 ` [PATCH v9 10/20] crypto: move gcm " Gilad Ben-Yossef
2017-10-15 9:19 ` [PATCH v9 11/20] crypto: move testmgr " Gilad Ben-Yossef
2017-10-15 9:19 ` [PATCH v9 12/20] fscrypt: move " Gilad Ben-Yossef
2017-10-15 9:19 ` [PATCH v9 13/20] dm: move dm-verity " Gilad Ben-Yossef
2017-10-15 9:19 ` [PATCH v9 14/20] cifs: move " Gilad Ben-Yossef
2017-10-15 9:20 ` [PATCH v9 15/20] ima: " Gilad Ben-Yossef
2017-10-15 9:20 ` [PATCH v9 16/20] crypto: tcrypt: " Gilad Ben-Yossef
2017-10-15 9:20 ` [PATCH v9 17/20] crypto: talitos: " Gilad Ben-Yossef
2017-10-17 10:50 ` Christophe LEROY [this message]
2017-10-15 9:20 ` [PATCH v9 18/20] crypto: qce: " Gilad Ben-Yossef
2017-10-15 9:20 ` [PATCH v9 19/20] crypto: mediatek: " Gilad Ben-Yossef
2017-10-15 9:20 ` [PATCH v9 20/20] crypto: adapt api sample to use async. op wait Gilad Ben-Yossef
2017-10-15 15:38 ` [PATCH v9 00/20] simplify crypto wait for async op Herbert Xu
2017-10-17 11:55 ` Gilad Ben-Yossef
2017-10-17 13:09 ` Herbert Xu
2017-10-17 14:06 ` Russell King - ARM Linux
2017-10-18 5:44 ` Gilad Ben-Yossef
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b75d3b02-2aba-124c-ccf5-7241775c004c@c-s.fr \
--to=christophe.leroy@c-s.fr \
--cc=agk@redhat.com \
--cc=arno@natisbad.org \
--cc=boris.brezillon@free-electrons.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=dm-devel@redhat.com \
--cc=dmitry.kasatkin@gmail.com \
--cc=gary.hook@amd.com \
--cc=gilad@benyossef.com \
--cc=herbert@gondor.apana.org.au \
--cc=jaegeuk@kernel.org \
--cc=james.l.morris@oracle.com \
--cc=keyrings@vger.kernel.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fscrypt@vger.kernel.org \
--cc=linux-ima-devel@lists.sourceforge.net \
--cc=linux-ima-user@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-security-module@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=ofir.drang@arm.com \
--cc=samba-technical@lists.samba.org \
--cc=serge@hallyn.com \
--cc=sfrench@samba.org \
--cc=snitzer@redhat.com \
--cc=steffen.klassert@secunet.com \
--cc=thomas.lendacky@amd.com \
--cc=tytso@mit.edu \
--cc=yoshfuji@linux-ipv6.org \
--cc=zohar@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®