soc: fsl: dpio: properly compute the consumer index
authorIoana Ciornei <ioana.ciornei@nxp.com>
Tue, 5 May 2020 20:14:29 +0000 (23:14 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 May 2020 00:35:24 +0000 (17:35 -0700)
Mask the consumer index before using it. Without this, we would be
writing frame descriptors beyond the ring size supported by the QBMAN
block.

Fixes: 3b2abda7d28c ("soc: fsl: dpio: Replace QMAN array mode with ring mode enqueue")
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Acked-by: Li Yang <leoyang.li@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/soc/fsl/dpio/qbman-portal.c

index 804b8ba..23a1377 100644 (file)
@@ -669,6 +669,7 @@ int qbman_swp_enqueue_multiple_direct(struct qbman_swp *s,
                eqcr_ci = s->eqcr.ci;
                p = s->addr_cena + QBMAN_CENA_SWP_EQCR_CI;
                s->eqcr.ci = qbman_read_register(s, QBMAN_CINH_SWP_EQCR_CI);
+               s->eqcr.ci &= full_mask;
 
                s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
                                        eqcr_ci, s->eqcr.ci);