common/cnxk: align CPT queue depth to power of 2
authorAnoob Joseph <anoobj@marvell.com>
Mon, 18 Oct 2021 07:51:39 +0000 (13:21 +0530)
committerAkhil Goyal <gakhil@marvell.com>
Wed, 20 Oct 2021 13:56:46 +0000 (15:56 +0200)
Use CPT LF queue depth as power of 2 to aid in masked checks for pending
queue.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
drivers/common/cnxk/roc_cpt.c

index 74ada6e..5674418 100644 (file)
@@ -568,6 +568,9 @@ 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)