From patchwork Tue Aug 8 12:03:33 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: 109615 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp3982098obb; Tue, 8 Aug 2017 05:04:42 -0700 (PDT) X-Received: by 10.99.126.86 with SMTP id o22mr3757091pgn.385.1502193882883; Tue, 08 Aug 2017 05:04:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502193882; cv=none; d=google.com; s=arc-20160816; b=oSLMaknBkCsFFalS6dEcmxrveQIqsvMnK5e2Sxi7KMZZni7ReK6DNr3ajauWEN508V Fdttex/PVrvGwhLQlnCX5e4IPpivzLDFGlh4ysn2f3qJAltUgGfRqZWrVqf5cbSAcoYS vAuzk4Jes2cuk7uDIiRelUUsZSOHFKJPZwRAZSKd+IWDtlTyAmEV0b/18z4vw34zHz0K 7Rei1Mh7BVhuvROsTXqaGkZ8pICmY557rbSBkSov+thyk9snVwNQVO7kg46eySvyyRGW jxaWXuCOS9FqiPb29e0SS8YSQXPwONdf3Sj2Gpkozuy5PciNAZk6pPZi/cLAvccmd418 H0LQ== 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=zr4O8eDbd1jpG6Tbr6Jn1JmqhvQB6pedF9xicBeTgOfxGaH/TfHy5CnJX3dFh2fTw8 BzpUz3R9Tb6/M7dBN83O7kxG8KMikeDYcSFyMj9b/7S1OQSs3XA7x984gEndVrQVKDtC Ld5MWUGrmbdOKbXbypsaTMC/i69azmiwZvKlRmkxijbcwuTaKWggLbPrFqR+J8sSTmAW jQL9NPxwbJkfsc9YCroUJF+NFMe/2Aj0WzZpOa7h+6OEho3TXKkPHys+sILNOWQFvzV/ e9bJg9YOJ3GMufA+B3r2P8hUjDn25JqB0POZBFEXJik4RumOG+gEvLVtkmnPtNkfoIK+ VwNQ== 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 12si851768pld.116.2017.08.08.05.04.42; Tue, 08 Aug 2017 05:04:42 -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 S1752475AbdHHMEk (ORCPT + 25 others); Tue, 8 Aug 2017 08:04:40 -0400 Received: from foss.arm.com ([217.140.101.70]:33286 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752427AbdHHMEg (ORCPT ); Tue, 8 Aug 2017 08:04:36 -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 A1057165D; Tue, 8 Aug 2017 05:04:35 -0700 (PDT) Received: from gby.kfn.arm.com (unknown [10.45.48.154]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 204A73F577; Tue, 8 Aug 2017 05:04:26 -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 v4 02/19] crypto: ccm: use -EAGAIN for transient busy indication Date: Tue, 8 Aug 2017 15:03:33 +0300 Message-Id: <1502193834-11289-3-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1502193834-11289-1-git-send-email-gilad@benyossef.com> References: <1502193834-11289-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++;