Skip to content

Commit 2c5bd1e

Browse files
Tero Kristoherbertx
authored andcommitted
crypto: omap-sham - change the DMA threshold value to a define
Currently the threshold value was hardcoded in the driver. Having a define for it makes it easier to configure. Signed-off-by: Tero Kristo <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent f19de1b commit 2c5bd1e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/crypto/omap-sham.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137
#define OMAP_ALIGNED __attribute__((aligned(sizeof(u32))))
138138

139139
#define BUFLEN PAGE_SIZE
140+
#define OMAP_SHA_DMA_THRESHOLD 256
140141

141142
struct omap_sham_dev;
142143

@@ -1435,10 +1436,11 @@ static int omap_sham_final(struct ahash_request *req)
14351436
/*
14361437
* OMAP HW accel works only with buffers >= 9.
14371438
* HMAC is always >= 9 because ipad == block size.
1438-
* If buffersize is less than 240, we use fallback SW encoding,
1439-
* as using DMA + HW in this case doesn't provide any benefit.
1439+
* If buffersize is less than DMA_THRESHOLD, we use fallback
1440+
* SW encoding, as using DMA + HW in this case doesn't provide
1441+
* any benefit.
14401442
*/
1441-
if (!ctx->digcnt && ctx->bufcnt < 240)
1443+
if (!ctx->digcnt && ctx->bufcnt < OMAP_SHA_DMA_THRESHOLD)
14421444
return omap_sham_final_shash(req);
14431445
else if (ctx->bufcnt)
14441446
return omap_sham_enqueue(req, OP_FINAL);

0 commit comments

Comments
 (0)