From patchwork Thu Aug 24 14:18:49 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: 110915 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp5746636qge; Thu, 24 Aug 2017 07:19:58 -0700 (PDT) X-Received: by 10.99.127.7 with SMTP id a7mr6375815pgd.56.1503584398333; Thu, 24 Aug 2017 07:19:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503584398; cv=none; d=google.com; s=arc-20160816; b=tUo1IIA52etPcpqqMelYP2DVwSR36WxAmSr2RpoJnFyRL2kT+BCJ3IhOJZi9skLBzB fe7JWojs81sgjSotXKDdDqsIa2FzGDX5ZlcsBZ3eEN8uIWK5vXlghMyrKLy0hwIK03Ke TNxwAqty6iKerdgLglipPkw2N9ZJx7i9CI/isE03y3EtVrMlzQulaUHtHWn2WUtfFX59 Hr3SqVm2AU7jzwMSCMCwHElnctgf46dZeyQJe/T2gj/TjD7vd2thJGXQ1OIpolOvOm2b TkCF68F72kA1uLWflfEJp9Syj+/Fut9felafeeZR2VFNRxltnB5en0lJCYnPfxzBHjmG Td3A== 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=xdHRX0FqeTmJcKLhlBAwhEUy6ZeKu5Fji+R3iOEXOCI=; b=cuoADXsHRNloT840RV/0MiMh7lGmf6wBJGI0eP4OeTvn5QUY7Y0QPlTo3riZWcbPVm ikVLvf/6lgW3fQOQEjrBRyWpX04HGFa2dwP+uyQugtM+/1xhBY8w9i4k9aKP3fsptQR9 klMNrOzfKFSlAYxJrgAnJB9QDSDfnMNPbs7kX71ixNbXDjVrdCVI7BwFRfhUmP2ys8yO c82fE5Yw/bfqXq2JpeWvZhvoY/a42VJ7NOko7rwm5TtW1L7rLh2CoobR6XV/w2yXvldE nGRBpZ89IzsDt8Uf4MiHQmWc7pKv7oZSfTxpyrPBJmZySrH4E8MD/ItO7y3Rsy4Oiy4b SVzA== 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 68si2875512pfe.594.2017.08.24.07.19.58; Thu, 24 Aug 2017 07:19:58 -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 S1753272AbdHXOTz (ORCPT + 26 others); Thu, 24 Aug 2017 10:19:55 -0400 Received: from foss.arm.com ([217.140.101.70]:41662 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752681AbdHXOTu (ORCPT ); Thu, 24 Aug 2017 10:19:50 -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 360A416A3; Thu, 24 Aug 2017 07:19:50 -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 43C4A3F540; Thu, 24 Aug 2017 07:19:42 -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 v7 02/19] crypto: ccp: use -EAGAIN for transient busy indication Date: Thu, 24 Aug 2017 17:18:49 +0300 Message-Id: <1503584350-7831-3-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1503584350-7831-1-git-send-email-gilad@benyossef.com> References: <1503584350-7831-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 Reviewed-by: Gary R Hook --- 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++;