Skip to content

Commit

Permalink
crypto: hifn_795x - Fix queue processing
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick McHardy <[email protected]>
Signed-off-by: Evgeniy Polyakov <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
kaber authored and herbertx committed Dec 25, 2008
1 parent 5df4c0c commit ed4f92e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/crypto/hifn_795x.c
Original file line number Diff line number Diff line change
Expand Up @@ -2158,20 +2158,24 @@ static int hifn_setup_crypto_req(struct ablkcipher_request *req, u8 op,

static int hifn_process_queue(struct hifn_device *dev)
{
struct crypto_async_request *async_req;
struct crypto_async_request *async_req, *backlog;
struct hifn_context *ctx;
struct ablkcipher_request *req;
unsigned long flags;
int err = 0;

while (dev->started < HIFN_QUEUE_LENGTH) {
spin_lock_irqsave(&dev->lock, flags);
backlog = crypto_get_backlog(&dev->queue);
async_req = crypto_dequeue_request(&dev->queue);
spin_unlock_irqrestore(&dev->lock, flags);

if (!async_req)
break;

if (backlog)
backlog->complete(backlog, -EINPROGRESS);

ctx = crypto_tfm_ctx(async_req->tfm);
req = container_of(async_req, struct ablkcipher_request, base);

Expand Down Expand Up @@ -2575,6 +2579,9 @@ static void hifn_tasklet_callback(unsigned long data)
* context or update is atomic (like setting dev->sa[i] to NULL).
*/
hifn_check_for_completion(dev, 0);

if (dev->started < HIFN_QUEUE_LENGTH && dev->queue.qlen)
hifn_process_queue(dev);
}

static int hifn_probe(struct pci_dev *pdev, const struct pci_device_id *id)
Expand Down

0 comments on commit ed4f92e

Please sign in to comment.