diff mbox series

[03/10] bus/dpaa: optimize the fq callback routine

Message ID 1529574244-18997-3-git-send-email-hemant.agrawal@nxp.com
State Superseded
Headers show
Series [01/10] bus/dpaa: fix phandle support for kernel 4.16 | expand

Commit Message

Hemant Agrawal June 21, 2018, 9:43 a.m. UTC
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>

---
 drivers/bus/dpaa/base/qbman/qman.c | 15 +++++++--------
 drivers/net/dpaa/dpaa_rxtx.c       |  2 +-
 2 files changed, 8 insertions(+), 9 deletions(-)

-- 
2.7.4
diff mbox series

Patch

diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c
index 27d98cc..13c4315 100644
--- a/drivers/bus/dpaa/base/qbman/qman.c
+++ b/drivers/bus/dpaa/base/qbman/qman.c
@@ -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);
diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c
index 1316d2a..805bc30 100644
--- a/drivers/net/dpaa/dpaa_rxtx.c
+++ b/drivers/net/dpaa/dpaa_rxtx.c
@@ -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;