diff --git a/drivers/common/cnxk/roc_cpt.c b/drivers/common/cnxk/roc_cpt.c index 89877d1b28..b3a3649fff 100644 --- a/drivers/common/cnxk/roc_cpt.c +++ b/drivers/common/cnxk/roc_cpt.c @@ -571,9 +571,6 @@ cpt_lf_init(struct roc_cpt_lf *lf) if (lf->nb_desc == 0 || lf->nb_desc > CPT_LF_MAX_NB_DESC) lf->nb_desc = CPT_LF_DEFAULT_NB_DESC; - /* Update nb_desc to next power of 2 to aid in pending queue checks */ - lf->nb_desc = plt_align32pow2(lf->nb_desc); - /* Allocate memory for instruction queue for CPT LF. */ iq_mem = plt_zmalloc(cpt_lf_iq_mem_calc(lf->nb_desc), ROC_ALIGN); if (iq_mem == NULL) diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c index 67a2d9b08e..a5fb68da02 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c +++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c @@ -361,6 +361,7 @@ cnxk_cpt_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id, struct roc_cpt *roc_cpt = &vf->cpt; struct rte_pci_device *pci_dev; struct cnxk_cpt_qp *qp; + uint32_t nb_desc; int ret; if (dev->data->queue_pairs[qp_id] != NULL) @@ -373,14 +374,17 @@ cnxk_cpt_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id, return -EIO; } - qp = cnxk_cpt_qp_create(dev, qp_id, conf->nb_descriptors); + /* Update nb_desc to next power of 2 to aid in pending queue checks */ + nb_desc = plt_align32pow2(conf->nb_descriptors); + + qp = cnxk_cpt_qp_create(dev, qp_id, nb_desc); if (qp == NULL) { plt_err("Could not create queue pair %d", qp_id); return -ENOMEM; } qp->lf.lf_id = qp_id; - qp->lf.nb_desc = conf->nb_descriptors; + qp->lf.nb_desc = nb_desc; ret = roc_cpt_lf_init(roc_cpt, &qp->lf); if (ret < 0) {