summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/cavium/nitrox/nitrox_lib.c
diff options
context:
space:
mode:
authorSrikanth Jampala <Jampala.Srikanth@cavium.com>2018-08-22 12:40:52 +0530
committerHerbert Xu <herbert@gondor.apana.org.au>2018-08-25 19:50:44 +0800
commit3d7c82060d1fe65bde4023aac41a0b1bd7718e07 (patch)
treededb0fda56b347d8bd3d7ca124ca17c68d36d0a2 /drivers/crypto/cavium/nitrox/nitrox_lib.c
parent0522236d4f9c5ab2e79889cb020d1acbe5da416e (diff)
downloadlinux-3d7c82060d1fe65bde4023aac41a0b1bd7718e07.tar.bz2
crypto: cavium/nitrox - fix for command corruption in queue full case with backlog submissions.
Earlier used to post the current command without checking queue full after backlog submissions. So, post the current command only after confirming the space in queue after backlog submissions. Maintain host write index instead of reading device registers to get the next free slot to post the command. Return -ENOSPC in queue full case. Signed-off-by: Srikanth Jampala <Jampala.Srikanth@cavium.com> Reviewed-by: Gadam Sreerama <sgadam@cavium.com> Tested-by: Jha, Chandan <Chandan.Jha@cavium.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/cavium/nitrox/nitrox_lib.c')
-rw-r--r--drivers/crypto/cavium/nitrox/nitrox_lib.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/crypto/cavium/nitrox/nitrox_lib.c b/drivers/crypto/cavium/nitrox/nitrox_lib.c
index ebe267379ac9..4d31df07777f 100644
--- a/drivers/crypto/cavium/nitrox/nitrox_lib.c
+++ b/drivers/crypto/cavium/nitrox/nitrox_lib.c
@@ -36,6 +36,7 @@ static int cmdq_common_init(struct nitrox_cmdq *cmdq)
cmdq->head = PTR_ALIGN(cmdq->head_unaligned, PKT_IN_ALIGN);
cmdq->dma = PTR_ALIGN(cmdq->dma_unaligned, PKT_IN_ALIGN);
cmdq->qsize = (qsize + PKT_IN_ALIGN);
+ cmdq->write_idx = 0;
spin_lock_init(&cmdq->response_lock);
spin_lock_init(&cmdq->cmdq_lock);