From patchwork Mon Aug 14 15:21:12 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: 110030 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp4477111qge; Mon, 14 Aug 2017 08:22:24 -0700 (PDT) X-Received: by 10.98.66.136 with SMTP id h8mr25093875pfd.54.1502724144404; Mon, 14 Aug 2017 08:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502724144; cv=none; d=google.com; s=arc-20160816; b=K+UcbNQx/Hz1s+mZXzHq3NDNEppZvgSC+A1HOYzfRCauJPoYO3YeRIZWfLQaJQKBWa U1KFsZbUDyhn3k+y84PmvrvTER+VdZvXNOQbJ2sw9yQIAxyGb2tIqQgBLQ28DN+BDGrI QOG8rAI1DtFJ7nmsFlCv0aXXoCAZYPMzGNTeEk3dWjZoj1iuN2QihJjXI68yoTfdD1EO 6Vsdr6WmZ6w7gJ1zZyaOjTWD3uz3OOpQkDcM4RC+eNIozL7qJw5mTsueNU01sqklAO/b +CZruNnTuqJvTLLb9XRhJJGoM2n2rcOgLH6FC8niASUniQQTDhdpk4GY9adhyFXvt7+9 7kig== 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=VOFtKFWBMXT2wTKHeGH1SgTJ6mtKfheoHEpnJxaLxoU=; b=gMP2BSkXYUtFV1IEi30RsoQOAuP7j46bPyLmfzRFWiNdfzdb53EwfyGSBnZWzaAZpV D86qCegOU9o94/F+6HwAMQ/cA6x1qugViYvg9MYhqHzlkdXtt8xp0i2/FQEDMttizIRj sMqaksgiCo3+FvC1D697L7c2ZepScBITzMU/zZbiChti+jDxGKJORtnlxW65fFupkKRn g6pw6OUIARqe0rzcOKckV81mVL3DTEbBk1mTLZ6q4E+rm1JbICkb5H+2cEg4NuY8EGGr jn6lTm0MqzQmsTmehpWYzBdZl/P5h2elgb8K0WFO3Tj47V62K0nxJL1/IFfFtL02gfMh Rmdw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 o7si4288123pfa.597.2017.08.14.08.22.24; Mon, 14 Aug 2017 08:22:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752973AbdHNPWT (ORCPT + 25 others); Mon, 14 Aug 2017 11:22:19 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:39620 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752900AbdHNPWO (ORCPT ); Mon, 14 Aug 2017 11:22:14 -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 246CE1682; Mon, 14 Aug 2017 08:22:14 -0700 (PDT) Received: from gby.kfn.arm.com (unknown [10.45.48.148]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3516C3F483; Mon, 14 Aug 2017 08:22:05 -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 v5 02/19] crypto: ccp: use -EAGAIN for transient busy indication Date: Mon, 14 Aug 2017 18:21:12 +0300 Message-Id: <1502724094-23305-3-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1502724094-23305-1-git-send-email-gilad@benyossef.com> References: <1502724094-23305-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace -EBUSY with -EAGAIN when reporting transient busy indication in the absence of backlog. Signed-off-by: Gilad Ben-Yossef --- drivers/crypto/ccp/ccp-crypto-main.c | 8 +++----- drivers/crypto/ccp/ccp-dev.c | 7 +++++-- 2 files changed, 8 insertions(+), 7 deletions(-) -- 2.1.4 diff --git a/drivers/crypto/ccp/ccp-crypto-main.c b/drivers/crypto/ccp/ccp-crypto-main.c index 35a9de7..403ff0a 100644 --- a/drivers/crypto/ccp/ccp-crypto-main.c +++ b/drivers/crypto/ccp/ccp-crypto-main.c @@ -222,9 +222,10 @@ static int ccp_crypto_enqueue_cmd(struct ccp_crypto_cmd *crypto_cmd) /* Check if the cmd can/should be queued */ if (req_queue.cmd_count >= CCP_CRYPTO_MAX_QLEN) { - ret = -EBUSY; - if (!(crypto_cmd->cmd->flags & CCP_CMD_MAY_BACKLOG)) + if (!(crypto_cmd->cmd->flags & CCP_CMD_MAY_BACKLOG)) { + ret = -EAGAIN; goto e_lock; + } } /* Look for an entry with the same tfm. If there is a cmd @@ -243,9 +244,6 @@ static int ccp_crypto_enqueue_cmd(struct ccp_crypto_cmd *crypto_cmd) ret = ccp_enqueue_cmd(crypto_cmd->cmd); if (!ccp_crypto_success(ret)) goto e_lock; /* Error, don't queue it */ - if ((ret == -EBUSY) && - !(crypto_cmd->cmd->flags & CCP_CMD_MAY_BACKLOG)) - goto e_lock; /* Not backlogging, don't queue it */ } if (req_queue.cmd_count >= CCP_CRYPTO_MAX_QLEN) { diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c index 4e029b1..3d637e3 100644 --- a/drivers/crypto/ccp/ccp-dev.c +++ b/drivers/crypto/ccp/ccp-dev.c @@ -292,9 +292,12 @@ int ccp_enqueue_cmd(struct ccp_cmd *cmd) i = ccp->cmd_q_count; if (ccp->cmd_count >= MAX_CMD_QLEN) { - ret = -EBUSY; - if (cmd->flags & CCP_CMD_MAY_BACKLOG) + if (cmd->flags & CCP_CMD_MAY_BACKLOG) { + ret = -EBUSY; list_add_tail(&cmd->entry, &ccp->backlog); + } else { + ret = -EAGAIN; + } } else { ret = -EINPROGRESS; ccp->cmd_count++;