linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: cavium/nitrox - Invoke callback after DMA unmap
@ 2019-01-14 13:52 Nagadheeraj Rottela
  2019-01-25 10:45 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Nagadheeraj Rottela @ 2019-01-14 13:52 UTC (permalink / raw)
  To: herbert, davem
  Cc: linux-crypto, linux-kernel, Srikanth Jampala, Nagadheeraj Rottela

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>
---
 drivers/crypto/cavium/nitrox/nitrox_reqmgr.c | 10 ++++++----
 1 file 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++;
 	}
-- 
2.13.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: cavium/nitrox - Invoke callback after DMA unmap
  2019-01-14 13:52 [PATCH] crypto: cavium/nitrox - Invoke callback after DMA unmap Nagadheeraj Rottela
@ 2019-01-25 10:45 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2019-01-25 10:45 UTC (permalink / raw)
  To: Nagadheeraj Rottela; +Cc: davem, linux-crypto, linux-kernel, Srikanth Jampala

On Mon, Jan 14, 2019 at 01:52:24PM +0000, Nagadheeraj Rottela wrote:
> 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>
> ---
>  drivers/crypto/cavium/nitrox/nitrox_reqmgr.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-25 10:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-14 13:52 [PATCH] crypto: cavium/nitrox - Invoke callback after DMA unmap Nagadheeraj Rottela
2019-01-25 10:45 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).