From patchwork Tue Sep 5 12:38:41 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: 111669 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp2782327qge; Tue, 5 Sep 2017 05:39:57 -0700 (PDT) X-Google-Smtp-Source: ADKCNb6OmnXyZm9Vld0zFOCko+E1G0VNMZdVQUtIRuvu+q9xQm27GMe66J0We/AI0YDZL3gtreFU X-Received: by 10.101.81.195 with SMTP id i3mr4028729pgq.246.1504615197825; Tue, 05 Sep 2017 05:39:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504615197; cv=none; d=google.com; s=arc-20160816; b=KHhQpKwaJ0viLIuS6e0Vl7Dcg2gvDbnvRqTK3Rgof22YxA8DdFlm3GzJQVW32rQvsV FVq1Ez8OCyn8+UuDbU0sxiveTnJq5CDg83zzp9Jkz7RuQiojSmt96TVC+5iTaagBgCe9 85A87EBBxJGIBsqZxyJ2Uq6DRngc4FeifxRutpG0bxoQcaeIb6gj4q16T7D7EBNaccCj Pcz5bG9DYKkMpbROnp/CX3kpo6kOjhOh/QBl7AilgGL3qY+k0nI/b+5kTPx2cPD/JEaf pR71Q7ClMqEaa8CY+nuBz0xUpTZrtv1rBgzeIEhbb0FufdDsNyQ5K6XY2o3J9uzNuE4/ yK6A== 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=DKt0fGd3ED+OQtQ7v54132dGwRcA27EW1LVW4ooRB3I=; b=OyWziH0LdB2RHGH9azDVKq8u9s94htsd3tF8h2PmKIhJ8icGNOKiVEcQIQGKySYd45 /9wnyO1h7HJqBRi0n6R+1zXH7PlZCngl53VD2TgvNnb4THpNLEX/WijhvIL8cGD3N0hF Dj2hRoFPLxUTyd31VWFwWenFrdz5BzInElQpw1rbym8RJBvnBqHWLgzDZt4/Z2rleWTb aHE6bJVWucN6X05qd6EFxo3/m4thXZaQLrVnUPD0V6hrrCpDmOwAt8NcAnqaedqSreNQ dcZd5hNOKA3OUw5Vm9nvWKa7vDB1/Nv3b5HyX5Rus9E31iT7IDN0zfkA8zQ9Znv3jknt ZmWw== 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 r1si196243pge.629.2017.09.05.05.39.57; Tue, 05 Sep 2017 05:39: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 S1751564AbdIEMjz (ORCPT + 1 other); Tue, 5 Sep 2017 08:39:55 -0400 Received: from foss.arm.com ([217.140.101.70]:38974 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751538AbdIEMju (ORCPT ); Tue, 5 Sep 2017 08:39: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 910141650; Tue, 5 Sep 2017 05:39:49 -0700 (PDT) Received: from gby.kfn.arm.com (unknown [10.45.48.140]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1853D3F3E1; Tue, 5 Sep 2017 05:39:39 -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 , Steffen Klassert , Alexey Kuznetsov , Hideaki YOSHIFUJI , 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, netdev@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 v8 02/20] crypto: ccp: use -EAGAIN for transient busy indication Date: Tue, 5 Sep 2017 15:38:41 +0300 Message-Id: <1504615144-29770-3-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1504615144-29770-1-git-send-email-gilad@benyossef.com> References: <1504615144-29770-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 -EAGAIN when reporting transient busy indication in the absence of backlog. Signed-off-by: Gilad Ben-Yossef Reviewed-by: Gary R Hook --- Please squash this patch with the previous one when merging upstream. --- 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++;