[dpdk-dev,19/20] event/dpaa2: handle timeout using interrupts in dequeue

Message ID 1495735671-4917-20-git-send-email-nipun.gupta@nxp.com (mailing list archive)
State Superseded, archived
Delegated to: Jerin Jacob
Headers

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK

Commit Message

Nipun Gupta May 25, 2017, 6:07 p.m. UTC
  This patch adds support for interrupt handling on the event port.
These interrupts facilitates managing of timeout ticks in the
event dequeue functions.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/event/dpaa2/dpaa2_eventdev.c | 36 +++++++++++++++++++++++++++++++++---
 1 file changed, 33 insertions(+), 3 deletions(-)
  

Comments

Jerin Jacob May 31, 2017, 3:49 p.m. UTC | #1
-----Original Message-----
> Date: Thu, 25 May 2017 23:37:50 +0530
> From: Nipun Gupta <nipun.gupta@nxp.com>
> To: dev@dpdk.org
> CC: hemant.agrawal@nxp.com, jerin.jacob@caviumnetworks.com,
>  harry.van.haaren@intel.com, bruce.richardson@intel.com,
>  gage.eads@intel.com, shreyansh.jain@nxp.com, Nipun Gupta
>  <nipun.gupta@nxp.com>
> Subject: [PATCH 19/20] event/dpaa2: handle timeout using interrupts in
>  dequeue
> X-Mailer: git-send-email 1.9.1
> 
> This patch adds support for interrupt handling on the event port.
> These interrupts facilitates managing of timeout ticks in the
> event dequeue functions.
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>

Please check the check-patch errors.
http://dpdk.org/dev/patchwork/project/dpdk/list/?submitter=Nipun
  
Nipun Gupta June 1, 2017, 11:42 a.m. UTC | #2
> -----Original Message-----
> From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> Sent: Wednesday, May 31, 2017 21:19
> To: Nipun Gupta <nipun.gupta@nxp.com>
> Cc: dev@dpdk.org; Hemant Agrawal <hemant.agrawal@nxp.com>;
> harry.van.haaren@intel.com; bruce.richardson@intel.com;
> gage.eads@intel.com; Shreyansh Jain <shreyansh.jain@nxp.com>
> Subject: Re: [PATCH 19/20] event/dpaa2: handle timeout using interrupts in
> dequeue
> 
> -----Original Message-----
> > Date: Thu, 25 May 2017 23:37:50 +0530
> > From: Nipun Gupta <nipun.gupta@nxp.com>
> > To: dev@dpdk.org
> > CC: hemant.agrawal@nxp.com, jerin.jacob@caviumnetworks.com,
> >  harry.van.haaren@intel.com, bruce.richardson@intel.com,
> >  gage.eads@intel.com, shreyansh.jain@nxp.com, Nipun Gupta
> >  <nipun.gupta@nxp.com>
> > Subject: [PATCH 19/20] event/dpaa2: handle timeout using interrupts in
> >  dequeue
> > X-Mailer: git-send-email 1.9.1
> >
> > This patch adds support for interrupt handling on the event port.
> > These interrupts facilitates managing of timeout ticks in the
> > event dequeue functions.
> >
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> 
> Please check the check-patch errors.
> http://dpdk.org/dev/patchwork/project/dpdk/list/?submitter=Nipun

Somehow they managed to peek in. Ill fix them in next version.
  

Patch

diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 3f3e4a6..a24b751 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -162,6 +162,31 @@ 
 	return dpaa2_eventdev_enqueue_burst(port, ev, 1);
 }
 
+static void dpaa2_eventdev_dequeue_wait(uint64_t timeout_ticks)
+{
+	struct epoll_event epoll_ev;
+	int ret, i = 0;
+
+	qbman_swp_interrupt_clear_status(DPAA2_PER_LCORE_PORTAL,
+					 QBMAN_SWP_INTERRUPT_DQRI);
+
+RETRY:
+	ret = epoll_wait(DPAA2_PER_LCORE_DPIO->epoll_fd,
+			 &epoll_ev, 1, timeout_ticks);
+	if (ret < 1) {
+		/* sometimes due to some spurious interrupts epoll_wait fails
+		with errno EINTR. so here we are retrying epoll_wait in such
+		case to avoid the problem.*/
+		if (errno == EINTR) {
+			PMD_DRV_LOG(DEBUG, PMD, "epoll_wait fails\n");
+			if (i++ > 10)
+				PMD_DRV_LOG(DEBUG, PMD,
+					    "Dequeue burst Failed\n");
+		goto RETRY;
+		}
+	}
+}
+
 static void dpaa2_eventdev_process_parallel(struct qbman_swp *swp,
 					    const struct qbman_fd *fd,
 					    const struct qbman_result *dq,
@@ -204,7 +229,6 @@  static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 	int num_pkts = 0, ret, i = 0;
 
 	RTE_SET_USED(port);
-	RTE_SET_USED(timeout_ticks);
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
@@ -229,8 +253,14 @@  static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 
 	do {
 		dq = qbman_swp_dqrr_next(swp);
-		if (!dq)
-			return 0;
+		if (!dq) {
+			if (!num_pkts && timeout_ticks) {
+				dpaa2_eventdev_dequeue_wait(timeout_ticks);
+				timeout_ticks = 0;
+				continue;
+			}
+			return num_pkts;
+		}
 
 		fd = qbman_result_DQ_fd(dq);