From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70073.outbound.protection.outlook.com [40.107.7.73]) by dpdk.org (Postfix) with ESMTP id 73A702BF7 for ; Thu, 30 Aug 2018 07:35:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ElSI8/MafyvhjtEwqPrzEtQzq3WMUY4EoxWJ2Rld2t8=; b=V4ch8zzDb4YC3+Zv+FH5m4KCTB0xpU1ziQ5yHq3CtACDChoAYgPMcyJszMJjlGGhATHNx1kj8O4xYoASdLKxhVBDH1D7icI6xwsf1exJ9JLu1VHZp4sF3ctzB2mbKvJuCPE8FAcJZmMnsCdYNAuvMGfrhTIqCZD6sL45pNvMRCU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; Received: from bf-netperf1.ap.freescale.net (14.143.30.134) by VI1PR0401MB2544.eurprd04.prod.outlook.com (2603:10a6:800:56::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Thu, 30 Aug 2018 05:35:20 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: jerin.jacob@caviumnetworks.com, nipun.gupta@nxp.com Date: Thu, 30 Aug 2018 11:03:16 +0530 Message-Id: <1535607196-26782-2-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535607196-26782-1-git-send-email-hemant.agrawal@nxp.com> References: <1535607196-26782-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.143.30.134] X-ClientProxiedBy: BM1PR01CA0082.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1::22) To VI1PR0401MB2544.eurprd04.prod.outlook.com (2603:10a6:800:56::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b28ff111-0657-4b71-f17d-08d60e3a60d3 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0401MB2544; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2544; 3:kT7vj+trLbcQ8RwgSFI631SK7g7NZPdXSL8JzsKxUdhcC+Sxl7hICr2b31+jy6NYyBLUtE9Klop5eSbUgfGl/cVtX8woY8ZPqvE1rbYsMCNfaA+jRInT1tdo94+JzyMD5Zbv5oYxf+abgsa4W2Rqi6MiVAdvR/rounN/Yc+zamZzePWllJEm2+tgUKI6ducftwk7K4RYm4QAONY7YV1pI5gr2CDpjtCIHPedwrPli/9guYVHLZFFY4r0XGh7i4T4; 25:zvbrF9Hv+vf4iuhKL0BZWbu7R0GTo6WrQxe5W2T28tU0hNe/Fa59LdtKgtYFLMxzg++nkDJE2mMb+V0FT9ejLD53GwUOiM8HBZVugcEeeFbvr26ovNGjOvuapbu3eRn3xJKP7cYWGZMiq4JGs/MGL+FVYLd6xbrwBmK5E+2Z1P9KUohpXovwhNuugJdMIJGw+Vf4Wj44VsmvMBeO4zG1LHgjqJKRTdY3BCkK+L8tML5oYjkSe+j3mYBSUyeXLzqJ6H/AkixfRszwHg/u+Jn2wOECB+kBsaauqf5CjIJspi9eH00601fkKbwBGGnyv32OnWalHZI238odbPCKrdEnrw==; 31:n9X9oJ6gmgBtMBg46UTDKAv4ijxRa/cZm3mUunNbc7RGkWlMicUCJpDNSRJCcKUZJqrasgX+RY5PH8T8TS0stGF/3ldlbBGMJJQKLgVsRUsSrsaVfqW6j51TxNAluQXa1HxrKGaKvi6Hi7Z4A7TjD3hQP8vSV23WQjPjWbNInDjZNNLoJ7wNEsSsDnpiFM64TR7gtp2PPAxZhHHGy3kwvpZ1nQEmnOMxaOEnZZQtYJ4= X-MS-TrafficTypeDiagnostic: VI1PR0401MB2544: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2544; 20:R9HryF0Td+AlXNZYZTF75JsrWB6yck5Gz1Qy+sX4feThroUH51q8f5nPwyl/an+kxG3n5f+YiNugflQSqERHMhGA8UmqkhtDDaZbB3sZXrmLW6FHnS786oXQIyP5F7lrNe54yeyXwl4+Id8HDoO02hpq5uv6aExgDjU9Yhit83cSZiIZ5eiooyFdJ9VfRrDC6+JlyWum8L/9EhL626fn+E00erLQ8xsPXU2g8Rx5fPEzCILPZ10U8CuomhqBfukLhNz9fxzQf0TiIGW8OtjVgYlKX4ELOT6RtcntPNwtJEScb9LrGaGFC0/UdZmM79oBTLoAIXZyyGNxQ7VcSk3p/ZWci1UW8pTejjkNG+7dPdzd+k255EO8gH2S4HeFN0MS8tGlsDwjQMMeVurW8REAzzbcP1bKRpea1NvjCgm8orj6mm/OvNyoQUvORzEjcF6hH7fYgdr9fiX9LgbDETDty5UXgzC/kXFWgnfepecd1BqDwVwC3R0rkA0awrm8a+7t; 4:FeIt0KAp9AvJZ9quqD07ewCLn6K6TSL0WlIljKKGQptdSZNEuIrFMIk4m/BJ2lG61MoAYGle23aajZzzbG4lMHcvLXmq/qX9bTtRGGrHpsvakFSszqcbsDpp2dwNuhwPsR28PfP+CWuRSKIdfaVlp8UK1rGLti2TFEL8PsMT0KpPJ4SO3c5cQjipsjtbAzykAkAdb/Rf2+AVJa5T43PPSUPyZypl5GGt4ZN+AM1NK8VwBrAxGbUAW8t7rOm8UgcrU7NWWGxpWScIHH/JRZAho6t9Wq5cYAjJE/qUplUq9ITq8uF8oQ//wfATpQHfYVzZhWHg0Wsi4E/UmCGHLtnHVLw0HvwxxD8YEgvNqkIkdW4= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(227817650892897); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(823301075)(3231311)(944501410)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(201708071742011)(7699016); SRVR:VI1PR0401MB2544; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0401MB2544; X-Forefront-PRVS: 07807C55DC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(346002)(396003)(136003)(199004)(189003)(4326008)(8936002)(5009440100003)(76176011)(6916009)(305945005)(3846002)(186003)(48376002)(16526019)(6666003)(478600001)(2361001)(25786009)(105586002)(68736007)(7736002)(47776003)(44832011)(50226002)(2351001)(106356001)(6116002)(66066001)(97736004)(36756003)(16586007)(51416003)(8676002)(6512007)(55236004)(81166006)(81156014)(386003)(6506007)(316002)(956004)(50466002)(26005)(5660300001)(2906002)(2616005)(6486002)(86362001)(53936002)(52116002)(11346002)(486006)(476003)(446003)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0401MB2544; H:bf-netperf1.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0401MB2544; 23:3xgDq1FGqVT2WIPg1rTQCIUkL1/kdDGtsaLC+JZ?= =?us-ascii?Q?mpQ6C9q3z/s++2xC0GdI05ssgvZzT/9rGssJGRIISE6PReUayz12tcmaR8ER?= =?us-ascii?Q?xVcQP79og/mCotNIqxerZCzRcYwVpxUXUnOh6C3UlxlEMXEpxTdTM+iXBw48?= =?us-ascii?Q?k0Y/NFYcmM1LvXcvKtV/0A18hBRlXQXuYE6aeTX/Nyt+XWEAokyuIaPBFnf0?= =?us-ascii?Q?PbuPAlX45WDKaDr7CXYB9/ou52yMS81RP2XULQHbnfOi1s6nexXgluI4h2pC?= =?us-ascii?Q?8UHTbqSHTvfNO1Zou8SIBvN5pwAw1ATH8MSQE/5bsNYNJo2PBHqyjBUHY7W5?= =?us-ascii?Q?qITleIkomkq0RE8fmHi+SOTP7klMZPc6QeiBGDh4xzVqcqnKxdTgSubeZsoT?= =?us-ascii?Q?iBz+PWPpS1Op7HCW2n/jzKGweRfQwbA8Mi0H7at70n1Mnz+NABh/fQ8Cl6lz?= =?us-ascii?Q?wx3v+BFTa3x9ZRQvB1W7Ora3EoqqosTs6nOkZiLdO8k582fXSdMSFulpudrs?= =?us-ascii?Q?NZeuLwtoHuCilLxDX6yOS5lPM4qucrJQgB2Rraj86QGafumvw9H4CefVs0iS?= =?us-ascii?Q?FLoX51T7asW0R0vjxQ5menyKRM9mWiGDKXsGtwbyiWiMXwcCTT02CLGr8oGk?= =?us-ascii?Q?khQdBbfKUa/ZoztDJncr7li3kIAqCG0sJTwMp1DNybCOCIXB+Qu2ftq5o6Id?= =?us-ascii?Q?tKNSgQK/CV4VIfBNKq6IGCLn8Td85XodMsLSafwLtr5jpmeUNrrVI/HC8JSt?= =?us-ascii?Q?59HTaDZVqKtN57BQHHfkzYOboeiB0oHAr+v9Y8bbOgFXIVPy+7+Wvb6rW5sE?= =?us-ascii?Q?HOI6oYNJT9M/G4+URQoiWdB1RkzEiHrvE+3ckb+8CfrkHU/FN3jHnmgRUX1e?= =?us-ascii?Q?6B3qR8Y+7c/zgh+cZj/ay62JIDbC9+L9kb9m/nlEwFrPMpcVic+5lPPI4EU5?= =?us-ascii?Q?RkBOdirY3IUId+1K3RmxJC8dIo3ZmjcX6j77JoLIEn1s2W83wMULrLaOzkpC?= =?us-ascii?Q?G+sVhC3DbyU4b4Tb6kDKhFrOZkqgmY/q7gLZiTRdT8BtNiPGuKykwSilN6qq?= =?us-ascii?Q?OifhuOXDrD45VOtZSkDpAD8VHEFBf15/qVuO6bk/20jLVn5k5gvlUe9eGEap?= =?us-ascii?Q?qj3jRMva71D+MmnExd7CS5aQh2ktY9y8V2m7IgpXzez700RB8chfx0s9pns9?= =?us-ascii?Q?NX0yREGoF/HtTGsz0Wp3uJTdVbURo8gzJKtjuFMybLOdrtC/YyizuX6qCDRE?= =?us-ascii?Q?zwxxC301m5IpMDrZnyOKDHzlQbzNlDAJpetYrUFwSNvDT3FWTcNbuZYM5Dim?= =?us-ascii?Q?GvpJBf67W9SnLAOV7O6zU48g=3D?= X-Microsoft-Antispam-Message-Info: EypVijYICKkKqyQ+qYNuqdyFm5Q0eWkQx2nja9uWMczQBXksYSZwGUmAMXNknVWZfcyLqktTZIerZguQeOn243FhoYRoe/qZcsbCoj2C1his/Hfa+rbml7wtHNsRo+93ynb9FKJ/JgtJqFD/OqIfxqeo3XpZ2fT1K/CyfMY59RH1CE7GhGOmSVb3FHEkxHHqy1oT06DlgFGJmIxNlB1WEy7RBGSMdAT6q71W3LNds5oAnR8AzFvinrZh0r6B0uUlsf9l5KCr7EM7iOVq3HLalEaQAWjk2wqHjIRoTDPowclJjTfnLuIvKEGp7tTBqhF3kwmLeSmM2ehtP1yIBufTKU6v2zMvd8ysTorhmLXxiZs= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2544; 6:QtBjnkSVXXo/DbYHVphGH2wXR0wvLWl/SgYT18HZDSe85JvvcxlneawJe56c17vyxLfthCl174njp0wY1fTU7xyhPtFFtBg8Qulzn4GITdspqED375bZA1NXwLxBiIsjqlmSGSbcHsq+ZTKV0CNNp+GkSBDBdCssHdH9Ei9fPvr5LufSgYIMDL2OXMnAgcuF13icpDBbO3ehwppwjPjYm/RgA6C+MV4l6mmTSIcIkvGfCRja9b/ErHflmv72CQwdVdrMcv0WamX/G4G4XeuzTZEM2zrRFpuFdMaSWvo460ZWhmF9UxhneurgjCeNKIPnGoi8jiK17FZTUI4Y2oehWQ7JxqFbhcciERF/pSf1ewYHmbmaf3fPoyTxFoeDpVF/LcrzbUcUW+F+jqkHPEJkJevW6x6i8Kr9e7v5u3+784/37+tpzSvc+FATYRGloJHA9B/YBm9s+iOm+8XXEpA2Jg==; 5:c6eniW/pj+ad2hWHWrUpjNlXyyF97ENQpg9kgerdlO5n6I6ksA2NuFcJeDPBVwPWYkxupYxloDo0IKXqYGw8v40qyMTauI/dUGsvwUW+yiXJrn8jhafr8N/EwcC8e583GRiizfADCoImL+tAtrtC1o0YpWMMfOFjeOdhhdqJpgE=; 7:8tL1QTKdsgdmdGy+B9EBakY2CDGxnLz8k5xVPE/ciMOc9e8mgwnoKZkex/rKY/YRYQJCrp22mg/wJMq7L5IPRGd7X9hvWtMJ9oXYlKmGAoPXcx0O6ymAWBD5HARYyGeU9nLGoupM7D2wUj2U+vU41YnkCJ1WAq6Whc/gBWfL1jkY4rUP80+cxLIBybvDL0/ElzhP9DnKEyF6xZ+aqe9L0iV94i6eV3E7LbBRVhGN4B9CFoGCJAs+GKu/hKzee6OH SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2018 05:35:20.7292 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b28ff111-0657-4b71-f17d-08d60e3a60d3 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2544 Subject: [dpdk-dev] [PATCH 2/2] event/dpaa: add select based event support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2018 05:35:22 -0000 Signed-off-by: Hemant Agrawal --- config/common_base | 1 + config/defconfig_arm64-dpaa-linuxapp-gcc | 1 + drivers/event/dpaa/dpaa_eventdev.c | 148 +++++++++++++++++++++++-------- drivers/event/dpaa/dpaa_eventdev.h | 8 +- 4 files changed, 115 insertions(+), 43 deletions(-) diff --git a/config/common_base b/config/common_base index 4bcbaf9..01a6f17 100644 --- a/config/common_base +++ b/config/common_base @@ -199,6 +199,7 @@ CONFIG_RTE_LIBRTE_DPAA_BUS=n CONFIG_RTE_LIBRTE_DPAA_MEMPOOL=n CONFIG_RTE_LIBRTE_DPAA_PMD=n CONFIG_RTE_LIBRTE_DPAA_HWDEBUG=n +CONFIG_RTE_LIBRTE_DPAA_EVENT_INTR_MODE=n # # Compile NXP DPAA2 FSL-MC Bus diff --git a/config/defconfig_arm64-dpaa-linuxapp-gcc b/config/defconfig_arm64-dpaa-linuxapp-gcc index c47aec0..cdaaa4c 100644 --- a/config/defconfig_arm64-dpaa-linuxapp-gcc +++ b/config/defconfig_arm64-dpaa-linuxapp-gcc @@ -21,3 +21,4 @@ CONFIG_RTE_PKTMBUF_HEADROOM=128 # NXP DPAA Bus CONFIG_RTE_LIBRTE_DPAA_DEBUG_DRIVER=n CONFIG_RTE_LIBRTE_DPAA_HWDEBUG=n +CONFIG_RTE_LIBRTE_DPAA_EVENT_INTR_MODE=y diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c index 9ddaf30..b82a8a9 100644 --- a/drivers/event/dpaa/dpaa_eventdev.c +++ b/drivers/event/dpaa/dpaa_eventdev.c @@ -47,14 +47,18 @@ static int dpaa_event_dequeue_timeout_ticks(struct rte_eventdev *dev, uint64_t ns, uint64_t *timeout_ticks) { - uint64_t cycles_per_second; - EVENTDEV_INIT_FUNC_TRACE(); RTE_SET_USED(dev); +#ifdef RTE_LIBRTE_DPAA_EVENT_INTR_MODE + *timeout_ticks = ns/1000; +#else + uint64_t cycles_per_second; + cycles_per_second = rte_get_timer_hz(); - *timeout_ticks = ns * (cycles_per_second / NS_PER_S); + *timeout_ticks = (ns * cycles_per_second) / NS_PER_S; +#endif return 0; } @@ -100,6 +104,58 @@ dpaa_event_enqueue(void *port, const struct rte_event *ev) return dpaa_event_enqueue_burst(port, ev, 1); } +#ifdef RTE_LIBRTE_DPAA_EVENT_INTR_MODE +static void drain_4_bytes(int fd, fd_set *fdset) +{ + if (FD_ISSET(fd, fdset)) { + /* drain 4 bytes */ + uint32_t junk; + ssize_t sjunk = read(qman_thread_fd(), &junk, sizeof(junk)); + if (sjunk != sizeof(junk)) + DPAA_EVENTDEV_ERR("UIO irq read error"); + } +} + +static inline int +dpaa_event_dequeue_wait(uint64_t timeout_ticks) +{ + int fd_qman, nfds; + int ret; + fd_set readset; + + /* Go into (and back out of) IRQ mode for each select, + * it simplifies exit-path considerations and other + * potential nastiness. + */ + struct timeval tv = { + .tv_sec = timeout_ticks / 1000000, + .tv_usec = timeout_ticks % 1000000 + }; + + fd_qman = qman_thread_fd(); + nfds = fd_qman + 1; + FD_ZERO(&readset); + FD_SET(fd_qman, &readset); + + qman_irqsource_add(QM_PIRQ_DQRI); + + ret = select(nfds, &readset, NULL, NULL, &tv); + if (ret < 0) + return ret; + /* Calling irqsource_remove() prior to thread_irq() + * means thread_irq() will not process whatever caused + * the interrupts, however it does ensure that, once + * thread_irq() re-enables interrupts, they won't fire + * again immediately. + */ + qman_irqsource_remove(~0); + drain_4_bytes(fd_qman, &readset); + qman_thread_irq(); + + return ret; +} +#endif + static uint16_t dpaa_event_dequeue_burst(void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks) @@ -107,8 +163,8 @@ dpaa_event_dequeue_burst(void *port, struct rte_event ev[], int ret; u16 ch_id; void *buffers[8]; - u32 num_frames, i; - uint64_t wait_time, cur_ticks, start_ticks; + u32 num_frames, i, irq = 0; + uint64_t cur_ticks = 0, wait_time_ticks = 0; struct dpaa_port *portal = (struct dpaa_port *)port; struct rte_mbuf *mbuf; @@ -147,20 +203,32 @@ dpaa_event_dequeue_burst(void *port, struct rte_event ev[], } DPAA_PER_LCORE_DQRR_HELD = 0; - if (portal->timeout == DPAA_EVENT_PORT_DEQUEUE_TIMEOUT_INVALID) - wait_time = timeout_ticks; + if (timeout_ticks) + wait_time_ticks = timeout_ticks; else - wait_time = portal->timeout; + wait_time_ticks = portal->timeout_us; - /* Lets dequeue the frames */ - start_ticks = rte_get_timer_cycles(); - wait_time += start_ticks; +#ifndef RTE_LIBRTE_DPAA_EVENT_INTR_MODE + wait_time_ticks += rte_get_timer_cycles(); +#endif do { + /* Lets dequeue the frames */ num_frames = qman_portal_dequeue(ev, nb_events, buffers); - if (num_frames != 0) + if (irq) + irq = 0; + if (num_frames) break; +#ifdef RTE_LIBRTE_DPAA_EVENT_INTR_MODE + if (wait_time_ticks) { /* wait for time */ + if (dpaa_event_dequeue_wait(wait_time_ticks) > 0) { + irq = 1; + continue; + } + break; /* no event after waiting */ + } +#endif cur_ticks = rte_get_timer_cycles(); - } while (cur_ticks < wait_time); + } while (cur_ticks < wait_time_ticks); return num_frames; } @@ -184,7 +252,7 @@ dpaa_event_dev_info_get(struct rte_eventdev *dev, dev_info->max_dequeue_timeout_ns = DPAA_EVENT_MAX_DEQUEUE_TIMEOUT; dev_info->dequeue_timeout_ns = - DPAA_EVENT_MIN_DEQUEUE_TIMEOUT; + DPAA_EVENT_PORT_DEQUEUE_TIMEOUT_NS; dev_info->max_event_queues = DPAA_EVENT_MAX_QUEUES; dev_info->max_event_queue_flows = @@ -230,15 +298,6 @@ dpaa_event_dev_configure(const struct rte_eventdev *dev) priv->nb_event_port_enqueue_depth = conf->nb_event_port_enqueue_depth; priv->event_dev_cfg = conf->event_dev_cfg; - /* Check dequeue timeout method is per dequeue or global */ - if (priv->event_dev_cfg & RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT) { - /* - * Use timeout value as given in dequeue operation. - * So invalidating this timetout value. - */ - priv->dequeue_timeout_ns = 0; - } - ch_id = rte_malloc("dpaa-channels", sizeof(uint32_t) * priv->nb_event_queues, RTE_CACHE_LINE_SIZE); @@ -260,24 +319,34 @@ dpaa_event_dev_configure(const struct rte_eventdev *dev) /* Lets prepare event ports */ memset(&priv->ports[0], 0, sizeof(struct dpaa_port) * priv->nb_event_ports); + + /* Check dequeue timeout method is per dequeue or global */ if (priv->event_dev_cfg & RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT) { - for (i = 0; i < priv->nb_event_ports; i++) { - priv->ports[i].timeout = - DPAA_EVENT_PORT_DEQUEUE_TIMEOUT_INVALID; - } - } else if (priv->dequeue_timeout_ns == 0) { - for (i = 0; i < priv->nb_event_ports; i++) { - dpaa_event_dequeue_timeout_ticks(NULL, - DPAA_EVENT_PORT_DEQUEUE_TIMEOUT_NS, - &priv->ports[i].timeout); - } + /* + * Use timeout value as given in dequeue operation. + * So invalidating this timeout value. + */ + priv->dequeue_timeout_ns = 0; + + } else if (conf->dequeue_timeout_ns == 0) { + priv->dequeue_timeout_ns = DPAA_EVENT_PORT_DEQUEUE_TIMEOUT_NS; } else { - for (i = 0; i < priv->nb_event_ports; i++) { - dpaa_event_dequeue_timeout_ticks(NULL, - priv->dequeue_timeout_ns, - &priv->ports[i].timeout); - } + priv->dequeue_timeout_ns = conf->dequeue_timeout_ns; } + + for (i = 0; i < priv->nb_event_ports; i++) { +#ifdef RTE_LIBRTE_DPAA_EVENT_INTR_MODE + priv->ports[i].timeout_us = priv->dequeue_timeout_ns/1000; +#else + uint64_t cycles_per_second; + + cycles_per_second = rte_get_timer_hz(); + priv->ports[i].timeout_us = + (priv->dequeue_timeout_ns * cycles_per_second) + / NS_PER_S; +#endif + } + /* * TODO: Currently portals are affined with threads. Maximum threads * can be created equals to number of lcore. @@ -454,7 +523,8 @@ dpaa_event_port_unlink(struct rte_eventdev *dev, void *port, event_queue->event_port = NULL; } - event_port->num_linked_evq = event_port->num_linked_evq - i; + if (event_port->num_linked_evq) + event_port->num_linked_evq = event_port->num_linked_evq - i; return (int)i; } diff --git a/drivers/event/dpaa/dpaa_eventdev.h b/drivers/event/dpaa/dpaa_eventdev.h index 3994bd6..2021339 100644 --- a/drivers/event/dpaa/dpaa_eventdev.h +++ b/drivers/event/dpaa/dpaa_eventdev.h @@ -12,8 +12,8 @@ #define EVENTDEV_NAME_DPAA_PMD event_dpaa1 -#define DPAA_EVENT_MAX_PORTS 8 -#define DPAA_EVENT_MAX_QUEUES 16 +#define DPAA_EVENT_MAX_PORTS 4 +#define DPAA_EVENT_MAX_QUEUES 8 #define DPAA_EVENT_MIN_DEQUEUE_TIMEOUT 1 #define DPAA_EVENT_MAX_DEQUEUE_TIMEOUT (UINT32_MAX - 1) #define DPAA_EVENT_MAX_QUEUE_FLOWS 2048 @@ -21,7 +21,7 @@ #define DPAA_EVENT_MAX_EVENT_PRIORITY_LEVELS 0 #define DPAA_EVENT_MAX_EVENT_PORT RTE_MIN(RTE_MAX_LCORE, INT8_MAX) #define DPAA_EVENT_MAX_PORT_DEQUEUE_DEPTH 8 -#define DPAA_EVENT_PORT_DEQUEUE_TIMEOUT_NS 100UL +#define DPAA_EVENT_PORT_DEQUEUE_TIMEOUT_NS 100000UL #define DPAA_EVENT_PORT_DEQUEUE_TIMEOUT_INVALID ((uint64_t)-1) #define DPAA_EVENT_MAX_PORT_ENQUEUE_DEPTH 1 #define DPAA_EVENT_MAX_NUM_EVENTS (INT32_MAX - 1) @@ -54,7 +54,7 @@ struct dpaa_port { struct dpaa_eventq evq_info[DPAA_EVENT_MAX_QUEUES]; uint8_t num_linked_evq; uint8_t is_port_linked; - uint64_t timeout; + uint64_t timeout_us; }; struct dpaa_eventdev { -- 2.7.4