From: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
To: linux-crypto@vger.kernel.org, linux-samsung-soc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, vzapolskiy@gmail.com,
herbert@gondor.apana.org.au, naveenkrishna.ch@gmail.com,
cpgs@samsung.com, t.figa@samsung.com, davem@davemloft.net
Subject: [PATCH 7/7 v8] crypto:s5p-sss: Look for the next request in the queue
Date: Mon, 28 Apr 2014 16:14:59 +0530 [thread overview]
Message-ID: <1398681899-20782-8-git-send-email-ch.naveen@samsung.com> (raw)
In-Reply-To: <1398681899-20782-1-git-send-email-ch.naveen@samsung.com>
Currently, the driver enqueues a request only if the busy bit is
false. And every request initiates a dequeue. If 2 requests arrive
simultaneously, only one of them will be dequeued.
To avoid this senario, we will enqueue the next request irrespective
of the system condition (that is what queue is here for). Also
schedule at a tasklet immediatly after the current request is done.
The tasklet will dequeue the next request in the queue, giving
continuous loop. tasklet will exit if there are no requests in the
queue.
Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
CC: David S. Miller <davem@davemloft.net>
CC: Vladimir Zapolskiy <vzapolskiy@gmail.com>
TO: <linux-crypto@vger.kernel.org>
CC: <linux-samsung-soc@vger.kernel.org>
---
Changes since v7:
Added Acked-by from Herbert Xu
Changes since v6:
None
drivers/crypto/s5p-sss.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
index ea7d478..47c568e 100644
--- a/drivers/crypto/s5p-sss.c
+++ b/drivers/crypto/s5p-sss.c
@@ -330,8 +330,12 @@ static void s5p_aes_tx(struct s5p_aes_dev *dev)
}
s5p_set_dma_outdata(dev, dev->sg_dst);
- } else
+ } else {
s5p_aes_complete(dev, err);
+
+ dev->busy = true;
+ tasklet_schedule(&dev->tasklet);
+ }
}
static void s5p_aes_rx(struct s5p_aes_dev *dev)
@@ -469,10 +473,13 @@ static void s5p_tasklet_cb(unsigned long data)
spin_lock_irqsave(&dev->lock, flags);
backlog = crypto_get_backlog(&dev->queue);
async_req = crypto_dequeue_request(&dev->queue);
- spin_unlock_irqrestore(&dev->lock, flags);
- if (!async_req)
+ if (!async_req) {
+ dev->busy = false;
+ spin_unlock_irqrestore(&dev->lock, flags);
return;
+ }
+ spin_unlock_irqrestore(&dev->lock, flags);
if (backlog)
backlog->complete(backlog, -EINPROGRESS);
@@ -491,14 +498,13 @@ static int s5p_aes_handle_req(struct s5p_aes_dev *dev,
int err;
spin_lock_irqsave(&dev->lock, flags);
+ err = ablkcipher_enqueue_request(&dev->queue, req);
if (dev->busy) {
- err = -EAGAIN;
spin_unlock_irqrestore(&dev->lock, flags);
goto exit;
}
dev->busy = true;
- err = ablkcipher_enqueue_request(&dev->queue, req);
spin_unlock_irqrestore(&dev->lock, flags);
tasklet_schedule(&dev->tasklet);
@@ -683,6 +689,7 @@ static int s5p_aes_probe(struct platform_device *pdev)
}
}
+ pdata->busy = false;
pdata->variant = variant;
pdata->dev = dev;
platform_set_drvdata(pdev, pdata);
--
1.7.9.5
next prev parent reply other threads:[~2014-04-28 10:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-28 10:44 [PATCH 0/7 v8] crypto:s5p-sss: Add Device tree and Exynos support Naveen Krishna Chatradhi
2014-04-28 10:44 ` [PATCH 1/7 v8] crypto:s5p-sss: Use platform_get_irq() instead of _byname() Naveen Krishna Chatradhi
2014-04-28 10:44 ` [PATCH 2/7 v8] crypto:s5p-sss: Add device tree support Naveen Krishna Chatradhi
2014-04-28 10:44 ` [PATCH 3/7 v8] crypto:s5p-sss: Add support for SSS module on Exynos Naveen Krishna Chatradhi
2014-04-28 10:44 ` [PATCH 4/7 v8] crypto:s5p-sss: Kconfig: Let Exynos SoCs select SSS driver Naveen Krishna Chatradhi
2014-04-28 10:44 ` [PATCH 5/7 v8] crypto:s5p-sss: validate iv before memcpy Naveen Krishna Chatradhi
2014-04-28 10:44 ` [PATCH 6/7 v8] crypto:s5p-sss: Use clk_prepare/clk_unprepare Naveen Krishna Chatradhi
2014-04-28 10:44 ` Naveen Krishna Chatradhi [this message]
2014-04-30 11:08 ` [PATCH 0/7 v8] crypto:s5p-sss: Add Device tree and Exynos support Naveen Krishna Ch
2014-04-30 12:14 ` Herbert Xu
2014-04-30 12:19 ` Naveen Krishna Ch
2014-04-30 19:51 ` Vladimir Zapolskiy
2014-05-08 14:01 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1398681899-20782-8-git-send-email-ch.naveen@samsung.com \
--to=ch.naveen@samsung.com \
--cc=cpgs@samsung.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=naveenkrishna.ch@gmail.com \
--cc=t.figa@samsung.com \
--cc=vzapolskiy@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®