From patchwork Sun Jul 2 14:41:45 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: 9821221 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3617C602F0 for ; Sun, 2 Jul 2017 14:43:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24C2E27528 for ; Sun, 2 Jul 2017 14:43:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 186D52810E; Sun, 2 Jul 2017 14:43:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1DE927528 for ; Sun, 2 Jul 2017 14:43:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752212AbdGBOn1 (ORCPT ); Sun, 2 Jul 2017 10:43:27 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53518 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751780AbdGBOnY (ORCPT ); Sun, 2 Jul 2017 10:43: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 0902815B2; Sun, 2 Jul 2017 07:43:09 -0700 (PDT) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 299953F578; Sun, 2 Jul 2017 07:43:00 -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 v3 03/28] crypto: ccm: use -EIOCBQUEUED for backlog indication Date: Sun, 2 Jul 2017 17:41:45 +0300 Message-Id: <1499006535-19760-4-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1499006535-19760-1-git-send-email-gilad@benyossef.com> References: <1499006535-19760-1-git-send-email-gilad@benyossef.com> Sender: linux-fscrypt-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Replace -EBUSY with -EIOCBQUEUED for backlog queueing indication as part of new API Signed-off-by: Gilad Ben-Yossef --- This patch should be squashed with the first patch in the series when applied. drivers/crypto/ccp/ccp-crypto-main.c | 10 +++++----- drivers/crypto/ccp/ccp-dev.c | 8 +++++--- drivers/crypto/ccp/ccp-dmaengine.c | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/crypto/ccp/ccp-crypto-main.c b/drivers/crypto/ccp/ccp-crypto-main.c index 8dccbdd..dff1998 100644 --- a/drivers/crypto/ccp/ccp-crypto-main.c +++ b/drivers/crypto/ccp/ccp-crypto-main.c @@ -84,7 +84,7 @@ struct ccp_crypto_cpu { static inline bool ccp_crypto_success(int err) { - if (err && (err != -EINPROGRESS) && (err != -EBUSY)) + if (err && (err != -EINPROGRESS) && (err != -EIOCBQUEUED)) return false; return true; @@ -148,7 +148,7 @@ static void ccp_crypto_complete(void *data, int err) if (err == -EINPROGRESS) { /* Only propagate the -EINPROGRESS if necessary */ - if (crypto_cmd->ret == -EBUSY) { + if (crypto_cmd->ret == -EIOCBQUEUED) { crypto_cmd->ret = -EINPROGRESS; req->complete(req, -EINPROGRESS); } @@ -166,8 +166,8 @@ static void ccp_crypto_complete(void *data, int err) backlog->req->complete(backlog->req, -EINPROGRESS); } - /* Transition the state from -EBUSY to -EINPROGRESS first */ - if (crypto_cmd->ret == -EBUSY) + /* Transition the state from -EIOCBQUEUED to -EINPROGRESS first */ + if (crypto_cmd->ret == -EIOCBQUEUED) req->complete(req, -EINPROGRESS); /* Completion callbacks */ @@ -243,7 +243,7 @@ static int ccp_crypto_enqueue_cmd(struct ccp_crypto_cmd *crypto_cmd) } if (req_queue.cmd_count >= CCP_CRYPTO_MAX_QLEN) { - ret = -EBUSY; + ret = -EIOCBQUEUED; if (req_queue.backlog == &req_queue.cmds) req_queue.backlog = &crypto_cmd->entry; } diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c index 2506b50..b7006d7 100644 --- a/drivers/crypto/ccp/ccp-dev.c +++ b/drivers/crypto/ccp/ccp-dev.c @@ -269,7 +269,7 @@ EXPORT_SYMBOL_GPL(ccp_version); * Queue a cmd to be processed by the CCP. If queueing the cmd * would exceed the defined length of the cmd queue the cmd will * only be queued if the CCP_CMD_MAY_BACKLOG flag is set and will - * result in a return code of -EBUSY. + * result in a return code of -EIOCBQUEUED; * * The callback routine specified in the ccp_cmd struct will be * called to notify the caller of completion (if the cmd was not @@ -280,7 +280,7 @@ EXPORT_SYMBOL_GPL(ccp_version); * * The cmd has been successfully queued if: * the return code is -EINPROGRESS or - * the return code is -EBUSY and CCP_CMD_MAY_BACKLOG flag is set + * the return code is -EIOCBQUEUED */ int ccp_enqueue_cmd(struct ccp_cmd *cmd) { @@ -307,8 +307,10 @@ int ccp_enqueue_cmd(struct ccp_cmd *cmd) if (ccp->cmd_count >= MAX_CMD_QLEN) { ret = -EBUSY; - if (cmd->flags & CCP_CMD_MAY_BACKLOG) + if (cmd->flags & CCP_CMD_MAY_BACKLOG) { list_add_tail(&cmd->entry, &ccp->backlog); + ret = -EIOCBQUEUED; + } } else { ret = -EINPROGRESS; ccp->cmd_count++; diff --git a/drivers/crypto/ccp/ccp-dmaengine.c b/drivers/crypto/ccp/ccp-dmaengine.c index e00be01..ab67304 100644 --- a/drivers/crypto/ccp/ccp-dmaengine.c +++ b/drivers/crypto/ccp/ccp-dmaengine.c @@ -146,7 +146,7 @@ static int ccp_issue_next_cmd(struct ccp_dma_desc *desc) desc->tx_desc.cookie, cmd); ret = ccp_enqueue_cmd(&cmd->ccp_cmd); - if (!ret || (ret == -EINPROGRESS) || (ret == -EBUSY)) + if (!ret || (ret == -EINPROGRESS) || (ret == -EIOCBQUEUED)) return 0; dev_dbg(desc->ccp->dev, "%s - error: ret=%d, tx %d, cmd=%p\n", __func__,