crypto/cnxk: fix update of number of descriptors

Pending queue also need to be adjusted while updating the number of
descriptors.

Fixes: a455fd869c ("common/cnxk: align CPT queue depth to power of 2")
Cc: stable@dpdk.org

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
This commit is contained in:
Anoob Joseph 2022-01-31 18:00:29 +05:30 committed by Akhil Goyal
parent aa6db9037e
commit a45f37334b
2 changed files with 6 additions and 5 deletions

View File

@ -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)

View File

@ -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) {