With cq_all enabled, allocate one extra CQ line beyond the HW ring size
as HW is writing to Nth slot also and update the pending tail after
sym raw dequeue completes a request.

Signed-off-by: Tejasree Kondoj <[email protected]>
---
 drivers/common/cnxk/roc_cpt.c             | 7 +++++--
 drivers/crypto/cnxk/cn20k_cryptodev_ops.c | 1 +
 drivers/crypto/cnxk/cnxk_cryptodev_ops.c  | 1 +
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/common/cnxk/roc_cpt.c b/drivers/common/cnxk/roc_cpt.c
index 9ba591d724..8c60a28fff 100644
--- a/drivers/common/cnxk/roc_cpt.c
+++ b/drivers/common/cnxk/roc_cpt.c
@@ -704,8 +704,11 @@ cpt_lf_cq_init(struct roc_cpt_lf *lf)
        /* Disable CPT completion queue */
        roc_cpt_cq_disable(lf);
 
-       /* Set command queue base address */
-       len = PLT_ALIGN(lf->cq_size * (ROC_CPT_CQ_ENTRY_SIZE_UNIT << 
lf->cq_entry_size), ROC_ALIGN);
+       /* Set completion queue (CQ) base address */
+       len = lf->cq_size;
+       if (roc_model_is_cn20k() && lf->cq_all)
+               len++;
+       len = PLT_ALIGN(len * (ROC_CPT_CQ_ENTRY_SIZE_UNIT << 
lf->cq_entry_size), ROC_ALIGN);
        lf->cq_vaddr = plt_zmalloc(len, ROC_ALIGN);
        if (lf->cq_vaddr == NULL)
                return -ENOMEM;
diff --git a/drivers/crypto/cnxk/cn20k_cryptodev_ops.c 
b/drivers/crypto/cnxk/cn20k_cryptodev_ops.c
index 18100ff1f8..a63b97654b 100644
--- a/drivers/crypto/cnxk/cn20k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn20k_cryptodev_ops.c
@@ -1429,6 +1429,7 @@ cn20k_cpt_sym_raw_dequeue(void *qptr, uint8_t *drv_ctx, 
int *dequeue_status,
        if (unlikely(infl_req->op_flags & CPT_OP_FLAGS_METABUF))
                rte_mempool_put(qp->meta_info.pool, infl_req->mdata);
 
+       pend_q->tail = pq_tail;
        *dequeue_status = 1;
 exit:
        return opaque;
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c 
b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
index 6553ac90a1..1e0ea9d358 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
@@ -535,6 +535,7 @@ cnxk_cpt_queue_pair_setup(struct rte_cryptodev *dev, 
uint16_t qp_id,
                /* CQ entry size is 128B(32 << 2) */
                qp->lf.cq_entry_size = 2;
                qp->lf.cq_size = nb_desc;
+               qp->lf.cq_all = true;
        }
 
        ret = roc_cpt_lf_init(roc_cpt, &qp->lf);
-- 
2.43.0

Reply via email to