From: Gary R Hook Subject: Re: [PATCH v4 02/19] crypto: ccm: use -EAGAIN for transient busy indication Date: Tue, 8 Aug 2017 10:24:49 -0500 Message-ID: <4600c898-a2f2-f95f-15b4-0adcc6acc0b5__11767.675940837$1502205985$gmane$org@amd.com> References: <1502193834-11289-1-git-send-email-gilad@benyossef.com> <1502193834-11289-3-git-send-email-gilad@benyossef.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Cc: Ofir Drang To: Gilad Ben-Yossef , Herbert Xu , "David S. Miller" , Jonathan Corbet , David Howells , "Lendacky, Thomas" , Boris Brezillon , Arnaud Ebalard , Matthias Brugger , Alasdair Kergon , Mike Snitzer , "dm-devel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org" , Shaohua Li , Steve French , "Theodore Y. Ts'o" , Jaegeuk Kim , Mimi Zohar , Dmitry Kasatkin , James Morris , "Serge E. Hallyn" , "linux-crypto-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" In-Reply-To: <1502193834-11289-3-git-send-email-gilad-6S/DczAoZh3WXxRugSxzZg@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+glpam-linux-mediatek=m.gmane.org-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org List-Id: linux-crypto.vger.kernel.org On 08/08/2017 07:03 AM, Gilad Ben-Yossef wrote: > Replace -EBUSY with -EAGAIN when reporting transient busy > indication in the absence of backlog. > > Signed-off-by: Gilad Ben-Yossef Could we use "ccp" in the subject line, please? > --- > drivers/crypto/ccp/ccp-crypto-main.c | 8 +++----- > drivers/crypto/ccp/ccp-dev.c | 7 +++++-- > 2 files changed, 8 insertions(+), 7 deletions(-) > > 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++; >