Commit 85e0687f authored by Bin Liu's avatar Bin Liu Committed by Herbert Xu

crypto: omap-sham - set sw fallback to 240 bytes

Adds software fallback support for small crypto requests. In these cases,
it is undesirable to use DMA, as setting it up itself is rather heavy
operation. Gives about 40% extra performance in ipsec usecase.
Signed-off-by: default avatarBin Liu <b-liu@ti.com>
[t-kristo@ti.com: dropped the extra traces, updated some comments
 on the code]
Signed-off-by: default avatarTero Kristo <t-kristo@ti.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent b973eaab
...@@ -1095,7 +1095,7 @@ static int omap_sham_update(struct ahash_request *req) ...@@ -1095,7 +1095,7 @@ static int omap_sham_update(struct ahash_request *req)
ctx->offset = 0; ctx->offset = 0;
if (ctx->flags & BIT(FLAGS_FINUP)) { if (ctx->flags & BIT(FLAGS_FINUP)) {
if ((ctx->digcnt + ctx->bufcnt + ctx->total) < 9) { if ((ctx->digcnt + ctx->bufcnt + ctx->total) < 240) {
/* /*
* OMAP HW accel works only with buffers >= 9 * OMAP HW accel works only with buffers >= 9
* will switch to bypass in final() * will switch to bypass in final()
...@@ -1151,9 +1151,13 @@ static int omap_sham_final(struct ahash_request *req) ...@@ -1151,9 +1151,13 @@ static int omap_sham_final(struct ahash_request *req)
if (ctx->flags & BIT(FLAGS_ERROR)) if (ctx->flags & BIT(FLAGS_ERROR))
return 0; /* uncompleted hash is not needed */ return 0; /* uncompleted hash is not needed */
/* OMAP HW accel works only with buffers >= 9 */ /*
/* HMAC is always >= 9 because ipad == block size */ * OMAP HW accel works only with buffers >= 9.
if ((ctx->digcnt + ctx->bufcnt) < 9) * HMAC is always >= 9 because ipad == block size.
* If buffersize is less than 240, we use fallback SW encoding,
* as using DMA + HW in this case doesn't provide any benefit.
*/
if ((ctx->digcnt + ctx->bufcnt) < 240)
return omap_sham_final_shash(req); return omap_sham_final_shash(req);
else if (ctx->bufcnt) else if (ctx->bufcnt)
return omap_sham_enqueue(req, OP_FINAL); return omap_sham_enqueue(req, OP_FINAL);
......
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