summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/cavium
diff options
context:
space:
mode:
authorNagadheeraj Rottela <rnagadheeraj@marvell.com>2019-01-14 13:52:24 +0000
committerHerbert Xu <herbert@gondor.apana.org.au>2019-01-25 18:37:58 +0800
commit356690d029e10f1aadebc49819d3908d5f6389fb (patch)
tree0cb4118ed75200054ed8aa0f03d8dbd7feda3fee /drivers/crypto/cavium
parentd45a90cb5d061fa7d411b974b950fe0b8bc5f265 (diff)
downloadlinux-356690d029e10f1aadebc49819d3908d5f6389fb.tar.bz2
crypto: cavium/nitrox - Invoke callback after DMA unmap
In process_response_list() invoke the callback handler after unmapping the DMA buffers. It ensures DMA data is synced form device to cpu before the client code access the data from callback handler. Fixes: c9613335bf4f ("crypto: cavium/nitrox - Added AEAD cipher support") Signed-off-by: Nagadheeraj Rottela <rnagadheeraj@marvell.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/cavium')
-rw-r--r--drivers/crypto/cavium/nitrox/nitrox_reqmgr.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c b/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c
index fe070d75c842..4c97478d44bd 100644
--- a/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c
+++ b/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c
@@ -537,6 +537,8 @@ static void process_response_list(struct nitrox_cmdq *cmdq)
struct nitrox_device *ndev = cmdq->ndev;
struct nitrox_softreq *sr;
int req_completed = 0, err = 0, budget;
+ completion_t callback;
+ void *cb_arg;
/* check all pending requests */
budget = atomic_read(&cmdq->pending_count);
@@ -564,13 +566,13 @@ static void process_response_list(struct nitrox_cmdq *cmdq)
smp_mb__after_atomic();
/* remove from response list */
response_list_del(sr, cmdq);
-
/* ORH error code */
err = READ_ONCE(*sr->resp.orh) & 0xff;
-
- if (sr->callback)
- sr->callback(sr->cb_arg, err);
+ callback = sr->callback;
+ cb_arg = sr->cb_arg;
softreq_destroy(sr);
+ if (callback)
+ callback(cb_arg, err);
req_completed++;
}