From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0085.outbound.protection.outlook.com [104.47.33.85]) by dpdk.org (Postfix) with ESMTP id 63B1C1B418 for ; Fri, 22 Dec 2017 16:17:52 +0100 (CET) Received: from DM5PR03CA0060.namprd03.prod.outlook.com (10.174.189.177) by CO2PR03MB2358.namprd03.prod.outlook.com (10.166.93.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.14; Fri, 22 Dec 2017 15:17:51 +0000 Received: from BL2FFO11FD016.protection.gbl (2a01:111:f400:7c09::175) by DM5PR03CA0060.outlook.office365.com (2603:10b6:4:3b::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.345.14 via Frontend Transport; Fri, 22 Dec 2017 15:17:51 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD016.mail.protection.outlook.com (10.173.160.224) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.302.6 via Frontend Transport; Fri, 22 Dec 2017 15:17:35 +0000 Received: from sunil-OptiPlex-790.ap.freescale.net (sunil-OptiPlex-790.ap.freescale.net [10.232.132.53]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vBMFHVf3024113; Fri, 22 Dec 2017 08:17:49 -0700 From: Sunil Kumar Kori To: CC: , Date: Fri, 22 Dec 2017 20:47:23 +0530 Message-ID: <20171222151725.11273-10-sunil.kori@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171222151725.11273-1-sunil.kori@nxp.com> References: <20171215130828.14218-7-sunil.kori@nxp.com> <20171222151725.11273-1-sunil.kori@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131584294561191652; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(336005)(39380400002)(39860400002)(376002)(396003)(346002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(2351001)(50466002)(106466001)(81156014)(8676002)(316002)(54906003)(36756003)(5660300001)(51416003)(498600001)(81166006)(48376002)(85426001)(8656006)(76176011)(16586007)(104016004)(47776003)(2906002)(53936002)(50226002)(86362001)(68736007)(356003)(6916009)(8936002)(1076002)(97736004)(4326008)(6666003)(2950100002)(105606002)(77096006)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR03MB2358; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD016; 1:TIJ70VbMd7x5fXEERN6BB5f2cB4fRCKjpTv8ec8NGj3UUMbmwQH1Wcq+vbNm9u37nrL3vO632E/0L5wWjArJqppts6xfW70GyTG8/xL9Jv19BcJ6y3mVs0SZzC2fuYWV MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 57634ac8-bf56-4e81-16e4-08d5494f21ce X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:CO2PR03MB2358; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2358; 3:3DFOBlnhyr1wOgDM5iR9KUk/AMaR/jRAYtUIxofbIweFZHcJummmlP0l9guzOgbUzlZrVtAlY7Bc7ciN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rEneIXbWxVc7uaH2lY2QbCbPRg+kxLK8pY2ENr4hTpCmtPdUTFvCnYm3k33QOpFzzQjwY8L6DZSFbj7QXDT939sNwYbBRV5OubElmK3iuPWCZhV4UMK45y2VwvfnIrw1CuunZG+Td8NAo9fI4iqFmi138NqG0hyvrj01tJkS6ROJiY/kdJ1De0+cYVipbm0hD647aA7vjp47Am8nwSTjdidCQBnd0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(3231023)(10201501046)(6055026)(6096035)(20161123561025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123556025)(20161123563025)(20161123559100)(20161123565025)(201708071742011); SRVR:CO2PR03MB2358; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:CO2PR03MB2358; X-Forefront-PRVS: 05299D545B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR03MB2358; 23:3udPPkK1v2n8BUPIziAkAr6RYTuW5gh5DyhAgdTvV?= =?us-ascii?Q?8HmrRg/+j9STQgghBYLg4fF6+eKv/FD0tErFltOjuFbpqxzP0BPuqjjMzP+O?= =?us-ascii?Q?ci7V4xHM1QXoe9ty+j4y9ZiGh0U/EGAwBL9q2RQu6mTwS0cfc58oMu+JcVoC?= =?us-ascii?Q?w5MRpNrI6cxGl1Wbb9DVH6G/244TJI+3TCL7Sa5SxkH/RyEjxbTT4xoFDaHR?= =?us-ascii?Q?K58STHxf2HGoVXmOaleq5moWaWIZFqw+ly5V5k7aCU325/rjW9KDM132jA6M?= =?us-ascii?Q?kGrBhggshHSucJYxsuqfXrpAFa0i81rppa3zk+FUjYHob9dR2i/zaIF8LcRL?= =?us-ascii?Q?88ojeyPsUpC3U3hgCn4f+UqVLn5ZU47pS76szWONlIDN/MhNfHZsTPaiilzc?= =?us-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0Jo5GlwmziXUyjJZuG5SHv2mB5jOl7PKaLPXhiEmcm5VNjKh8ZNfomUfxvHpWd1v3el+dGB/HLg/9OxyaAsDxLSZFNjAsnwR36GYwM2Bbp2j2vcRmkhwKIByAWg3qMFhZXoCzs3SjFZyzXR3NpnzEelrOCYBq4lbOA92/P4S9dxSHUsTi77kkdGZCSzxeHf3GZQu85bCQI=; 5:5ZK+w+zbAmxg79ClJLvJOWb8OB2Q0e/N57u2mIwzzOHNCjClr0UD78ERcOCU9orcMQkQ2plajL40JQVvc94pvQuMnwMRsdDYuWVjBYOCfYheSWHBag1SEU/rRYLdpqy6/OKbbw3+tZQPnl0TEgvW5idH51HgxKGq6yL+1R1OexI=; 24:Q1nm9+CKnYXIX0zqgLpqrw56YSa/Xx8e0utIAx+sbAasUG9cpNix0WO/GS9+P+x6Ggx4fP9oOBogD6NsJFClmHGnCl705zmx+OzFUe2RYwU=; 7:jz2VOabTPvkcCTruWoTQfixxTEYxElgGBBNnlHkSDPh39kgM7t6j2fJVDtrwwodruY0tOUeg4u42pRDrF32fsBU1ZKCaIbjApKfQJ6GAzINrn7I+yxfYPkg7MjHozEex0bgEalHng5858abjNVBsnowMu7NvB3V2/HfC0cq4UQ7TMuXeKXB6wXsySJxCMXi6Wxv3a5sMIOiVfoaEjLzQpz3lv9m+ndvtAtMqDqPUdMdUi4t9x/xUGNXuyTUC7YAY SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Dec 2017 15:17:35.9631 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 57634ac8-bf56-4e81-16e4-08d5494f21ce X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR03MB2358 Subject: [dpdk-dev] [PATCH v2 10/12] event/dpaa: add eventdev enqueue/dequeue 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: Fri, 22 Dec 2017 15:17:53 -0000 Signed-off-by: Sunil Kumar Kori --- drivers/event/dpaa/dpaa_eventdev.c | 114 +++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c index 13345da..64b9eb4 100644 --- a/drivers/event/dpaa/dpaa_eventdev.c +++ b/drivers/event/dpaa/dpaa_eventdev.c @@ -60,6 +60,116 @@ dpaa_event_dequeue_timeout_ticks(struct rte_eventdev *dev, uint64_t ns, } static void +dpaa_eventq_portal_add(u16 ch_id) +{ + uint32_t sdqcr; + + sdqcr = QM_SDQCR_CHANNELS_POOL_CONV(ch_id); + qman_static_dequeue_add(sdqcr, NULL); +} + +static uint16_t +dpaa_event_enqueue_burst(void *port, const struct rte_event ev[], + uint16_t nb_events) +{ + uint16_t i; + struct rte_mbuf *mbuf; + + RTE_SET_USED(port); + /*Release all the contexts saved previously*/ + for (i = 0; i < nb_events; i++) { + switch (ev[i].op) { + case RTE_EVENT_OP_RELEASE: + qman_dca_index(ev[i].impl_opaque, 0); + mbuf = DPAA_PER_LCORE_DQRR_MBUF(i); + mbuf->seqn = DPAA_INVALID_MBUF_SEQN; + DPAA_PER_LCORE_DQRR_HELD &= ~(1 << i); + DPAA_PER_LCORE_DQRR_SIZE--; + break; + default: + break; + } + } + + return nb_events; +} + +static uint16_t +dpaa_event_enqueue(void *port, const struct rte_event *ev) +{ + return dpaa_event_enqueue_burst(port, ev, 1); +} + +static uint16_t +dpaa_event_dequeue_burst(void *port, struct rte_event ev[], + uint16_t nb_events, uint64_t timeout_ticks) +{ + int ret; + u16 ch_id; + void *buffers[8]; + u32 num_frames, i; + uint64_t wait_time, cur_ticks, start_ticks; + struct dpaa_port *portal = (struct dpaa_port *)port; + struct rte_mbuf *mbuf; + + /* Affine current thread context to a qman portal */ + ret = rte_dpaa_portal_init((void *)0); + if (ret) { + DPAA_EVENTDEV_ERR("Unable to initialize portal"); + return ret; + } + + if (unlikely(!portal->is_port_linked)) { + /* + * Affine event queue for current thread context + * to a qman portal. + */ + for (i = 0; i < portal->num_linked_evq; i++) { + ch_id = portal->evq_info[i].ch_id; + dpaa_eventq_portal_add(ch_id); + } + portal->is_port_linked = true; + } + + /* Check if there are atomic contexts to be released */ + i = 0; + while (DPAA_PER_LCORE_DQRR_SIZE) { + if (DPAA_PER_LCORE_DQRR_HELD & (1 << i)) { + qman_dca_index(i, 0); + mbuf = DPAA_PER_LCORE_DQRR_MBUF(i); + mbuf->seqn = DPAA_INVALID_MBUF_SEQN; + DPAA_PER_LCORE_DQRR_HELD &= ~(1 << i); + DPAA_PER_LCORE_DQRR_SIZE--; + } + i++; + } + DPAA_PER_LCORE_DQRR_HELD = 0; + + if (portal->timeout == DPAA_EVENT_PORT_DEQUEUE_TIMEOUT_INVALID) + wait_time = timeout_ticks; + else + wait_time = portal->timeout; + + /* Lets dequeue the frames */ + start_ticks = rte_get_timer_cycles(); + wait_time += start_ticks; + do { + num_frames = qman_portal_dequeue(ev, nb_events, buffers); + if (num_frames != 0) + break; + cur_ticks = rte_get_timer_cycles(); + } while (cur_ticks < wait_time); + + return num_frames; +} + +static uint16_t +dpaa_event_dequeue(void *port, struct rte_event *ev, uint64_t timeout_ticks) +{ + return dpaa_event_dequeue_burst(port, ev, 1, timeout_ticks); +} + +static void dpaa_event_dev_info_get(struct rte_eventdev *dev, struct rte_event_dev_info *dev_info) { @@ -494,6 +604,10 @@ dpaa_event_dev_create(const char *name) } eventdev->dev_ops = &dpaa_eventdev_ops; + eventdev->enqueue = dpaa_event_enqueue; + eventdev->enqueue_burst = dpaa_event_enqueue_burst; + eventdev->dequeue = dpaa_event_dequeue; + eventdev->dequeue_burst = dpaa_event_dequeue_burst; /* For secondary processes, the primary has done all the work */ if (rte_eal_process_type() != RTE_PROC_PRIMARY) -- 2.9.3