From patchwork Sun Oct 15 09:19:47 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: 115861 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2528306qgn; Sun, 15 Oct 2017 02:21:53 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBwhSd6xKssKDwm0ua5h8TV7XTBjEHB9Q6p/dtdFN4qcqxWlC+83Kc91cHQ2jD79+JuzLvW X-Received: by 10.99.109.73 with SMTP id i70mr5313916pgc.177.1508059313666; Sun, 15 Oct 2017 02:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508059313; cv=none; d=google.com; s=arc-20160816; b=gOTBvX608y31+j9tXpAmuQs3T2xPzHv4RsuTLOEtQm3p96OLfEC9lYgSvXgvclJ5vP 3UVQbr4wzHo4Vy/v/mo9EyHGxdCyk18n0RUum4uNIwLmoSvh6zlhvKQ9vY7N5OIj+Kx9 3TJ3xqf/w7evMkhHm/gpl+hOSogJRy4hSfr1FaSOIV6Yw4buHzWRIhZP4r1IZoINJxHD m5STyk7B/rfcIIxqK1olfoZ8atumDGkZ4xofU81fCKjahkh07kHp6ugk7IuHipNbUWEi X1v7nUQm+/OjcJryaIlbgZnjcEjJsbBvj07ByyrJMlYaDKWyxCEg373hrZWIH1M7Dimz Qq3A== 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=bF1u3iXhvjMyzS1yDK6fUfGsfBHR+qV3AQvqJ+aRXIY=; b=wqjQVCpk2cwBJslwQbMQieEK9jTlAe/odznRLybOUJ7uGj98bXjT9g15nzhXseshig +/FaYe4lG5rCBut3LapTWxsxFY9piyLsZ1KodQGVxHwFE80dfnU0j5OGEZRhghJhoCGO OHpK90qxTL8e+blCZUiCaAaTgwWj7B7DHza1A1AHdFJcTRkYQLG+dzW5qoq9ozuCVcWU Ufn1mftLRIYwl0dj0sHiJEG2J6KOQRHsHEA4lyyz8MaaT+HXtLYJP1mdU+yqSeEhzqBu IzLj+q/pi9aTIfwlbgbMbhOG3Ojs92EiYFIvk8W4jJsfTIvG3+wNqo5bITpNx+FktKiv JKIA== 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 y13si2890526pfj.546.2017.10.15.02.21.53; Sun, 15 Oct 2017 02:21:53 -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 S1751950AbdJOJVu (ORCPT + 27 others); Sun, 15 Oct 2017 05:21:50 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:47232 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751786AbdJOJVp (ORCPT ); Sun, 15 Oct 2017 05:21:45 -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 DB058164F; Sun, 15 Oct 2017 02:21:44 -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 4D9D33F3E1; Sun, 15 Oct 2017 02:21:36 -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, Steve French , "Theodore Y. Ts'o" , Jaegeuk Kim , Steffen Klassert , Alexey Kuznetsov , Hideaki YOSHIFUJI , Mimi Zohar , Dmitry Kasatkin , James Morris , "Serge E. Hallyn" Cc: Ofir Drang , 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-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 Subject: [PATCH v9 02/20] crypto: ccp: use -EAGAIN for transient busy indication Date: Sun, 15 Oct 2017 10:19:47 +0100 Message-Id: <1508059209-25529-3-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508059209-25529-1-git-send-email-gilad@benyossef.com> References: <1508059209-25529-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 --- 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.7.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++;