2008-06-16 16:11:37

by Kim Phillips

[permalink] [raw]
Subject: [PATCH 3/4] crypto/talitos: fix premature done handling

Since the h/w doesn't support out-of-order processing within a channel,
abort channel flush processing in the no-done-bits-and-no-error case
so as to not allow premature passthrough to the callback (and thus
dropped packets).

Signed-off-by: Kim Phillips <[email protected]>
---
drivers/crypto/talitos.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index ce4787e..64ddad2 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -307,8 +307,13 @@ static void flush_channel(struct device *dev, int ch, int error, int reset_ch)

/* descriptors with their done bits set don't get the error */
rmb();
- status = ((request->desc->hdr & DESC_HDR_DONE)
- == DESC_HDR_DONE) ? 0 : error;
+ if ((request->desc->hdr & DESC_HDR_DONE) == DESC_HDR_DONE)
+ status = 0;
+ else
+ if (!error)
+ break;
+ else
+ status = error;

dma_unmap_single(dev, request->dma_desc,
sizeof(struct talitos_desc), DMA_BIDIRECTIONAL);
--
1.5.6.rc2.26.g8c37