From patchwork Mon Aug 21 14:04:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 110531 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1328665qge; Mon, 21 Aug 2017 07:06:26 -0700 (PDT) X-Received: by 10.99.96.211 with SMTP id u202mr13428628pgb.347.1503324386880; Mon, 21 Aug 2017 07:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503324386; cv=none; d=google.com; s=arc-20160816; b=rNWSrmZ5dXk0fm24QBlIUfRMGrelDcBn62BZ9FNZJRoVeam0jKdOPMhk2YappwQAOu C8YEUwJQcd8Hibtw7OX1Pa8wSP9exCXxD4uG99p4FmxQpbrwPaUK3y3NX37D6bgafh+6 rXM5pfR30PDEJ1fQlLrmTXBfXQH+qrVNdNjMI68C7p4wevlKk7NB0f9SnivVzAsBSZ3d dHfw6S0mEPYKA/3X6MJfI01SD0zZbAel7n2JESXxUfyfFxZTscAD8h2BqI1tMz1vXG+Y RXQoXUCg3hxzsPL7emTBfpg2rR8ZlNqj5NESef/aj/+FOPz2aG0b+HmI5/IOzbLheNL3 LBeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=FWgov2tx4uZGAQ6iVml25k5ESHYbE4SuTVwVDMgsHHk=; b=ol3QHhST3LwDyOsNUU3CWmxiC3KleUFULopsqITDmRFnB36S4XlyeU6kLe0gAk8Ghs SlR9KCyvDMGtjBGPLafpdQHWWgVbGpydOq7f5piPud+SQhS8lPVDqeqgb14X29h11gr0 VyzhmtupIyI/Oba3nh8aGZ0Nk85MVNIP6IT6H/oe0WPNkFvdZ/eTIFY2GkHUwpDztX44 AOKPTmoYFJKHYasfYUMeN03TE/UGrNMJKAe1Z7Z8BPlQfV7dkhTHwwPDDXvorUSdX3VF agmQHzZU7jXaMQR0BnB1MRCXuyRbm5qjDAU+LpgfMfpV2YQpM0k3crnF9JiPCGgoDpJe gJLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s22si7292787pgs.15.2017.08.21.07.06.26; Mon, 21 Aug 2017 07:06:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754080AbdHUOGX (ORCPT + 1 other); Mon, 21 Aug 2017 10:06:23 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57852 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753229AbdHUOGU (ORCPT ); Mon, 21 Aug 2017 10:06:20 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0B8D916A3; Mon, 21 Aug 2017 07:06:20 -0700 (PDT) Received: from gby.kfn.arm.com (unknown [10.45.48.132]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 03D253F540; Mon, 21 Aug 2017 07:06:11 -0700 (PDT) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" , Jonathan Corbet , David Howells , Tom Lendacky , Gary Hook , Boris Brezillon , Arnaud Ebalard , Matthias Brugger , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, Shaohua Li , Steve French , "Theodore Y. Ts'o" , Jaegeuk Kim , Mimi Zohar , Dmitry Kasatkin , James Morris , "Serge E. Hallyn" , 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-raid@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fscrypt@vger.kernel.org, linux-ima-devel@lists.sourceforge.net, linux-ima-user@lists.sourceforge.net, linux-security-module@vger.kernel.org Cc: Ofir Drang Subject: [PATCH v6 04/19] crypto: marvell/cesa: remove redundant backlog checks on EBUSY Date: Mon, 21 Aug 2017 17:04:50 +0300 Message-Id: <1503324309-13673-5-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1503324309-13673-1-git-send-email-gilad@benyossef.com> References: <1503324309-13673-1-git-send-email-gilad@benyossef.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Now that -EBUSY return code only indicates backlog queueing we can safely remove the now redundant check for the CRYPTO_TFM_REQ_MAY_BACKLOG flag when -EBUSY is returned. Signed-off-by: Gilad Ben-Yossef Acked-by: Boris Brezillon --- drivers/crypto/marvell/cesa.c | 3 +-- drivers/crypto/marvell/cesa.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) -- 2.1.4 diff --git a/drivers/crypto/marvell/cesa.c b/drivers/crypto/marvell/cesa.c index 6e7a5c7..269737f 100644 --- a/drivers/crypto/marvell/cesa.c +++ b/drivers/crypto/marvell/cesa.c @@ -183,8 +183,7 @@ int mv_cesa_queue_req(struct crypto_async_request *req, spin_lock_bh(&engine->lock); ret = crypto_enqueue_request(&engine->queue, req); if ((mv_cesa_req_get_type(creq) == CESA_DMA_REQ) && - (ret == -EINPROGRESS || - (ret == -EBUSY && req->flags & CRYPTO_TFM_REQ_MAY_BACKLOG))) + (ret == -EINPROGRESS || ret == -EBUSY) mv_cesa_tdma_chain(engine, creq); spin_unlock_bh(&engine->lock); diff --git a/drivers/crypto/marvell/cesa.h b/drivers/crypto/marvell/cesa.h index b7872f6..63c8457 100644 --- a/drivers/crypto/marvell/cesa.h +++ b/drivers/crypto/marvell/cesa.h @@ -763,7 +763,7 @@ static inline int mv_cesa_req_needs_cleanup(struct crypto_async_request *req, * the backlog and will be processed later. There's no need to * clean it up. */ - if (ret == -EBUSY && req->flags & CRYPTO_TFM_REQ_MAY_BACKLOG) + if (ret == -EBUSY) return false; /* Request wasn't queued, we need to clean it up */ From patchwork Mon Aug 21 14:05:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 110543 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1333266qge; Mon, 21 Aug 2017 07:09:30 -0700 (PDT) X-Received: by 10.99.96.211 with SMTP id u202mr13438807pgb.347.1503324570010; Mon, 21 Aug 2017 07:09:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503324570; cv=none; d=google.com; s=arc-20160816; b=ErXL5UyD1cL0Mua4wORSEg73rBXT+AG8a6J+jMpXpZrM5bxeaW5tDeYYw6axWWUACi r+Oz5Wu788jaBoyiIPLqzbKojXqO8ReErYQyGuDhqXJHuRo4YS40Db8DauAp20jRJL45 PYRytr3LlD4bxEbsAwVfMQyg4AAhNvukLUupkTF5+33WavXmO14VHgzjqHlh02m1GmU7 /jk0k5n3ciM1lQv0XMQeAIRVRrxFthUX/E/yoESeSsLuncZ29sKE88tga533vDIQH/ca 7I21jvAIx0q/oTIChWBQKNHMMpHAUUZwh1I9Ql5aTi0Z5OM6+Ut2E8l8BYkcXz+XpbWR mUEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=ZEEwY7S0lvfkzX5eSnqpbx2gek6uifwcDnkIXVl4mV0=; b=uTHvb3mg5OyqJ5daFJZEywdq/VWCbjuqy+763JjRlHPXX176DlCMpqDm2pEPLtjFjN CQBrqI+L0eoJN4LBsT2mcC/DRkB62nx3Nt9x29Ho3oCjMZqxl4KJYhCPuu7ndkA7Ai/4 cJxNiAKIGGM0Ib7ki0QpcboMTO2rirQjrxV+pW5qtkNXoBVKlaCke594uAxIzQj5MI4O 4ECrvJ9/9CpP7cHtTaELEn0HkXm2Y+QiDadFyiHiURu6eI4qFB2Ms3GGkgNzJH7HWssf dOeM+6T2B9oNBx+YZV5oa0jm7TM54XSY8LLcrFyFIuq1PVPqD6xozkIWicDfIrMRN2qA Tj7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z6si7111216pgb.140.2017.08.21.07.09.29; Mon, 21 Aug 2017 07:09:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754063AbdHUOJ1 (ORCPT + 1 other); Mon, 21 Aug 2017 10:09:27 -0400 Received: from foss.arm.com ([217.140.101.70]:58526 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754124AbdHUOJY (ORCPT ); Mon, 21 Aug 2017 10:09:24 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3FC6D1AC1; Mon, 21 Aug 2017 07:09:24 -0700 (PDT) Received: from gby.kfn.arm.com (unknown [10.45.48.132]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A689E3F540; Mon, 21 Aug 2017 07:09:13 -0700 (PDT) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" , Jonathan Corbet , David Howells , Tom Lendacky , Gary Hook , Boris Brezillon , Arnaud Ebalard , Matthias Brugger , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, Shaohua Li , Steve French , "Theodore Y. Ts'o" , Jaegeuk Kim , Mimi Zohar , Dmitry Kasatkin , James Morris , "Serge E. Hallyn" , 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-raid@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fscrypt@vger.kernel.org, linux-ima-devel@lists.sourceforge.net, linux-ima-user@lists.sourceforge.net, linux-security-module@vger.kernel.org Cc: Ofir Drang Subject: [PATCH v6 17/19] crypto: qce: move to generic async completion Date: Mon, 21 Aug 2017 17:05:03 +0300 Message-Id: <1503324309-13673-18-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1503324309-13673-1-git-send-email-gilad@benyossef.com> References: <1503324309-13673-1-git-send-email-gilad@benyossef.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The qce 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 --- drivers/crypto/qce/sha.c | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) -- 2.1.4 diff --git a/drivers/crypto/qce/sha.c b/drivers/crypto/qce/sha.c index 47e114a..53227d7 100644 --- a/drivers/crypto/qce/sha.c +++ b/drivers/crypto/qce/sha.c @@ -349,28 +349,12 @@ static int qce_ahash_digest(struct ahash_request *req) return qce->async_req_enqueue(tmpl->qce, &req->base); } -struct qce_ahash_result { - struct completion completion; - int error; -}; - -static void qce_digest_complete(struct crypto_async_request *req, int error) -{ - struct qce_ahash_result *result = req->data; - - if (error == -EINPROGRESS) - return; - - result->error = error; - complete(&result->completion); -} - static int qce_ahash_hmac_setkey(struct crypto_ahash *tfm, const u8 *key, unsigned int keylen) { unsigned int digestsize = crypto_ahash_digestsize(tfm); struct qce_sha_ctx *ctx = crypto_tfm_ctx(&tfm->base); - struct qce_ahash_result result; + struct crypto_wait wait; struct ahash_request *req; struct scatterlist sg; unsigned int blocksize; @@ -405,9 +389,9 @@ static int qce_ahash_hmac_setkey(struct crypto_ahash *tfm, const u8 *key, goto err_free_ahash; } - init_completion(&result.completion); + crypto_init_wait(&wait); ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, - qce_digest_complete, &result); + crypto_req_done, &wait); crypto_ahash_clear_flags(ahash_tfm, ~0); buf = kzalloc(keylen + QCE_MAX_ALIGN_SIZE, GFP_KERNEL); @@ -420,13 +404,7 @@ static int qce_ahash_hmac_setkey(struct crypto_ahash *tfm, const u8 *key, sg_init_one(&sg, buf, keylen); ahash_request_set_crypt(req, &sg, ctx->authkey, keylen); - ret = crypto_ahash_digest(req); - if (ret == -EINPROGRESS || ret == -EBUSY) { - ret = wait_for_completion_interruptible(&result.completion); - if (!ret) - ret = result.error; - } - + ret = crypto_wait_req(crypto_ahash_digest(req), &wait); if (ret) crypto_ahash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);