crypto: omap-sham - change the DMA threshold value to a define
authorTero Kristo <t-kristo@ti.com>
Mon, 19 Sep 2016 15:22:16 +0000 (18:22 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 22 Sep 2016 10:32:50 +0000 (18:32 +0800)
Currently the threshold value was hardcoded in the driver. Having a define
for it makes it easier to configure.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/omap-sham.c

index 8558989..5c95bf9 100644 (file)
 #define OMAP_ALIGNED           __attribute__((aligned(sizeof(u32))))
 
 #define BUFLEN                 PAGE_SIZE
+#define OMAP_SHA_DMA_THRESHOLD 256
 
 struct omap_sham_dev;
 
@@ -1435,10 +1436,11 @@ static int omap_sham_final(struct ahash_request *req)
        /*
         * OMAP HW accel works only with buffers >= 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 buffersize is less than DMA_THRESHOLD, we use fallback
+        * SW encoding, as using DMA + HW in this case doesn't provide
+        * any benefit.
         */
-       if (!ctx->digcnt && ctx->bufcnt < 240)
+       if (!ctx->digcnt && ctx->bufcnt < OMAP_SHA_DMA_THRESHOLD)
                return omap_sham_final_shash(req);
        else if (ctx->bufcnt)
                return omap_sham_enqueue(req, OP_FINAL);