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: 106843 Delivered-To: patch@linaro.org Received: by 10.182.135.102 with SMTP id pr6csp8292734obb; Sun, 2 Jul 2017 07:43:58 -0700 (PDT) X-Received: by 10.99.49.20 with SMTP id x20mr5541063pgx.181.1499006638009; Sun, 02 Jul 2017 07:43:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499006638; cv=none; d=google.com; s=arc-20160816; b=ldkf4ZeQ/Vjex4iy9XqHTHLPML+5zNMU5jjPiAb8FFejrAkmfeRsGhJbEVpI8tjYSS w1eMW4qVebIc/mY6Ryt6q9hBIDCGOeZz3A27Y5CqG4y9dna5e9/dW7o6vS43VlSQTH4/ QtTXeWaUuFTXIZgO0pdPjL0wzo5rViGSUBYsK7SSB0FFVRdv8WnD/2SCBukz1bjbrKX7 +vjz7CL2wIf2zrbV73XItlSDOp39IyAgv5Zjfv/bLHa87sc5pQhljvqpEW0lsNEBISpN crfQ8DNKMUjEEC1fgDmFuFBv5XHqI5xCpG9Qepn7dZXbATQ3n1SOjsiEDtOcBGTNzF/3 OyLQ== 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=ZKvkf+MCOIK8f8xSWZnuT1SPOpefoHn4zrHuOPgaHgg=; b=LGnsW3srbM+2RJRoBcOaVNBNn0PJYqHR8v3It8ctsChQI7pbLruCdGzjsqFsmNrHs+ 4MRg0G5ETghHPtg4034nSjlCnM94PwrLqiSe/nglkcRNk5DdP90yJ70IEdpkoVKCyHdb cNT0vHyY4G+AaBrBtd4ziL4rf3foYsfnC+hovYTriJpkN0jinohbnD4iZ1qoPte4jKzc ENvz2b3WQLOXpIRbCSpGiYCDvQWnnjto7aRcLkhTWtrf5nsoUHtEisk61y/T/8FdT6l1 QJY8ep2YPT3cxVNZ6SalNmM+Z8tJONe4RTDYTkByQuhcYQGwoapNStTKP0tx1GKXTPuN dhnQ== 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 g16si10183773pfe.261.2017.07.02.07.43.57; Sun, 02 Jul 2017 07:43:57 -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 S1752211AbdGBOn0 (ORCPT + 1 other); Sun, 2 Jul 2017 10:43:26 -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-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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(-) -- 2.1.4 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__,