crypto: ccp - Refactor code to enable checks for queue space.
authorGary R Hook <gary.hook@amd.com>
Wed, 27 Jul 2016 00:10:13 +0000 (19:10 -0500)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 9 Aug 2016 10:47:10 +0000 (18:47 +0800)
Available queue space is used to decide (by counting free slots)
if we have to put a command on hold or if it can be sent
to the engine immediately.

Signed-off-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ccp/ccp-dev-v3.c
drivers/crypto/ccp/ccp-dev.h
drivers/crypto/ccp/ccp-ops.c

index 373ac4fa4a479f02e3ecf94f33bc546c19bfee1c..02c8c95fdc2d4593abc472929c186ba5c40fae81 100644 (file)
@@ -70,6 +70,11 @@ static void ccp_free_ksb(struct ccp_cmd_queue *cmd_q, unsigned int start,
        wake_up_interruptible_all(&ccp->sb_queue);
 }
 
+static unsigned int ccp_get_free_slots(struct ccp_cmd_queue *cmd_q)
+{
+       return CMD_Q_DEPTH(ioread32(cmd_q->reg_status));
+}
+
 static int ccp_do_cmd(struct ccp_op *op, u32 *cr, unsigned int cr_count)
 {
        struct ccp_cmd_queue *cmd_q = op->cmd_q;
@@ -357,7 +362,7 @@ static int ccp_init(struct ccp_device *ccp)
                cmd_q->int_ok = 1 << (i * 2);
                cmd_q->int_err = 1 << ((i * 2) + 1);
 
-               cmd_q->free_slots = CMD_Q_DEPTH(ioread32(cmd_q->reg_status));
+               cmd_q->free_slots = ccp_get_free_slots(cmd_q);
 
                init_waitqueue_head(&cmd_q->int_queue);
 
@@ -559,6 +564,7 @@ static const struct ccp_actions ccp3_actions = {
        .sbfree = ccp_free_ksb,
        .init = ccp_init,
        .destroy = ccp_destroy,
+       .get_free_slots = ccp_get_free_slots,
        .irqhandler = ccp_irq_handler,
 };
 
index 0c44c5e049f5cfae574de1c8f3d49fabf1c5851d..de907029c6ee29dfc71ff84ae11ba0099b3d8383 100644 (file)
@@ -458,6 +458,7 @@ struct ccp_actions {
        u32 (*sballoc)(struct ccp_cmd_queue *, unsigned int);
        void (*sbfree)(struct ccp_cmd_queue *, unsigned int,
                               unsigned int);
+       unsigned int (*get_free_slots)(struct ccp_cmd_queue *);
        int (*init)(struct ccp_device *);
        void (*destroy)(struct ccp_device *);
        irqreturn_t (*irqhandler)(int, void *);
index bd9eb1d4512a8b6e3343a2c0fff56b7b4c10f64e..fdab0ae4f7c9f41a9a9130c7d5d2424c0073d6b6 100644 (file)
@@ -1765,7 +1765,7 @@ int ccp_run_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)
        cmd->engine_error = 0;
        cmd_q->cmd_error = 0;
        cmd_q->int_rcvd = 0;
-       cmd_q->free_slots = CMD_Q_DEPTH(ioread32(cmd_q->reg_status));
+       cmd_q->free_slots = cmd_q->ccp->vdata->perform->get_free_slots(cmd_q);
 
        switch (cmd->engine) {
        case CCP_ENGINE_AES:
This page took 0.029872 seconds and 5 git commands to generate.