Commit 4e7813a0 authored by Tero Kristo's avatar Tero Kristo Committed by Herbert Xu

crypto: omap-sham - avoid executing tasklet where not needed

Some of the call paths of OMAP SHA driver can avoid executing the next
step of the crypto queue under tasklet; instead, execute the next step
directly via function call. This avoids a costly round-trip via the
scheduler giving a slight performance boost.
Signed-off-by: default avatarTero Kristo <t-kristo@ti.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 71f89917
...@@ -1005,9 +1005,6 @@ static void omap_sham_finish_req(struct ahash_request *req, int err) ...@@ -1005,9 +1005,6 @@ static void omap_sham_finish_req(struct ahash_request *req, int err)
if (req->base.complete) if (req->base.complete)
req->base.complete(&req->base, err); req->base.complete(&req->base, err);
/* handle new request */
tasklet_schedule(&dd->done_task);
} }
static int omap_sham_handle_queue(struct omap_sham_dev *dd, static int omap_sham_handle_queue(struct omap_sham_dev *dd,
...@@ -1018,6 +1015,7 @@ static int omap_sham_handle_queue(struct omap_sham_dev *dd, ...@@ -1018,6 +1015,7 @@ static int omap_sham_handle_queue(struct omap_sham_dev *dd,
unsigned long flags; unsigned long flags;
int err = 0, ret = 0; int err = 0, ret = 0;
retry:
spin_lock_irqsave(&dd->lock, flags); spin_lock_irqsave(&dd->lock, flags);
if (req) if (req)
ret = ahash_enqueue_request(&dd->queue, req); ret = ahash_enqueue_request(&dd->queue, req);
...@@ -1061,11 +1059,19 @@ static int omap_sham_handle_queue(struct omap_sham_dev *dd, ...@@ -1061,11 +1059,19 @@ static int omap_sham_handle_queue(struct omap_sham_dev *dd,
err = omap_sham_final_req(dd); err = omap_sham_final_req(dd);
} }
err1: err1:
if (err != -EINPROGRESS) dev_dbg(dd->dev, "exit, err: %d\n", err);
if (err != -EINPROGRESS) {
/* done_task will not finish it, so do it here */ /* done_task will not finish it, so do it here */
omap_sham_finish_req(req, err); omap_sham_finish_req(req, err);
req = NULL;
dev_dbg(dd->dev, "exit, err: %d\n", err); /*
* Execute next request immediately if there is anything
* in queue.
*/
goto retry;
}
return ret; return ret;
} }
...@@ -1653,6 +1659,10 @@ static void omap_sham_done_task(unsigned long data) ...@@ -1653,6 +1659,10 @@ static void omap_sham_done_task(unsigned long data)
dev_dbg(dd->dev, "update done: err: %d\n", err); dev_dbg(dd->dev, "update done: err: %d\n", err);
/* finish curent request */ /* finish curent request */
omap_sham_finish_req(dd->req, err); omap_sham_finish_req(dd->req, err);
/* If we are not busy, process next req */
if (!test_bit(FLAGS_BUSY, &dd->flags))
omap_sham_handle_queue(dd, NULL);
} }
static irqreturn_t omap_sham_irq_common(struct omap_sham_dev *dd) static irqreturn_t omap_sham_irq_common(struct omap_sham_dev *dd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment