bus/dpaa: optimize fq callback routine
authorHemant Agrawal <hemant.agrawal@nxp.com>
Fri, 6 Jul 2018 08:10:03 +0000 (13:40 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 12 Jul 2018 12:35:33 +0000 (14:35 +0200)
Avoid array of fq as packets are dq only from a single q.

Signed-off-by: Sunil Kumar Kori <sunil.kori@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
drivers/bus/dpaa/base/qbman/qman.c
drivers/net/dpaa/dpaa_rxtx.c

index 27d98cc..13c4315 100644 (file)
@@ -1058,7 +1058,7 @@ unsigned int qman_portal_poll_rx(unsigned int poll_limit,
        struct qm_portal *portal = &p->p;
        register struct qm_dqrr *dqrr = &portal->dqrr;
        struct qm_dqrr_entry *dq[QM_DQRR_SIZE], *shadow[QM_DQRR_SIZE];
-       struct qman_fq *fq[QM_DQRR_SIZE];
+       struct qman_fq *fq;
        unsigned int limit = 0, rx_number = 0;
        uint32_t consume = 0;
 
@@ -1092,14 +1092,13 @@ unsigned int qman_portal_poll_rx(unsigned int poll_limit,
 
                /* SDQCR: context_b points to the FQ */
 #ifdef CONFIG_FSL_QMAN_FQ_LOOKUP
-               fq[rx_number] = qman_fq_lookup_table[be32_to_cpu(
-                                               dq[rx_number]->contextB)];
+               fq = qman_fq_lookup_table[be32_to_cpu(dq[rx_number]->contextB)];
 #else
-               fq[rx_number] = (void *)be32_to_cpu(
-                                               dq[rx_number]->contextB);
+               fq = (void *)be32_to_cpu(dq[rx_number]->contextB);
 #endif
-               fq[rx_number]->cb.dqrr_prepare(shadow[rx_number],
-                                                &bufs[rx_number]);
+               if (fq->cb.dqrr_prepare)
+                       fq->cb.dqrr_prepare(shadow[rx_number],
+                                           &bufs[rx_number]);
 
                consume |= (1 << (31 - DQRR_PTR2IDX(shadow[rx_number])));
                rx_number++;
@@ -1107,7 +1106,7 @@ unsigned int qman_portal_poll_rx(unsigned int poll_limit,
        } while (++limit < poll_limit);
 
        if (rx_number)
-               fq[0]->cb.dqrr_dpdk_pull_cb(fq, shadow, bufs, rx_number);
+               fq->cb.dqrr_dpdk_pull_cb(&fq, shadow, bufs, rx_number);
 
        /* Consume all the DQRR enries together */
        qm_out(DQRR_DCAP, (1 << 8) | consume);
index 1316d2a..805bc30 100644 (file)
@@ -431,7 +431,7 @@ dpaa_rx_cb(struct qman_fq **fq, struct qm_dqrr_entry **dqrr,
                }
 
                fd = &dqrr[i]->fd;
-               dpaa_intf = fq[i]->dpaa_intf;
+               dpaa_intf = fq[0]->dpaa_intf;
 
                format = (fd->opaque & DPAA_FD_FORMAT_MASK) >>
                                DPAA_FD_FORMAT_SHIFT;