From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nipun Gupta Subject: [PATCH 20/21 v5] event/dpaa2: handle timeout using interrupts in dequeue Date: Fri, 30 Jun 2017 14:24:34 +0530 Message-ID: <1498812875-6945-21-git-send-email-nipun.gupta@nxp.com> References: <1495735361-4840-1-git-send-email-nipun.gupta@nxp.com> <1498812875-6945-1-git-send-email-nipun.gupta@nxp.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , , , , , Nipun Gupta To: Return-path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0042.outbound.protection.outlook.com [104.47.41.42]) by dpdk.org (Postfix) with ESMTP id 67FE67D18 for ; Fri, 30 Jun 2017 10:55:51 +0200 (CEST) In-Reply-To: <1498812875-6945-1-git-send-email-nipun.gupta@nxp.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- drivers/event/dpaa2/dpaa2_eventdev.c | 37 +++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c index a7f8516..80ee65c 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev.c +++ b/drivers/event/dpaa2/dpaa2_eventdev.c @@ -162,6 +162,32 @@ 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 +230,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 +254,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); -- 1.9.1