From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0046.outbound.protection.outlook.com [104.47.33.46]) by dpdk.org (Postfix) with ESMTP id CB99C1B291 for ; Tue, 16 Jan 2018 15:29:25 +0100 (CET) Received: from CY4PR03CA0019.namprd03.prod.outlook.com (2603:10b6:903:33::29) by SN2PR03MB2368.namprd03.prod.outlook.com (2603:10b6:804:e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Tue, 16 Jan 2018 14:29:24 +0000 Received: from BN1BFFO11FD005.protection.gbl (2a01:111:f400:7c10::1:146) by CY4PR03CA0019.outlook.office365.com (2603:10b6:903:33::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.407.7 via Frontend Transport; Tue, 16 Jan 2018 14:29:24 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; NXP1.onmicrosoft.com; dkim=none (message not signed) header.d=none;NXP1.onmicrosoft.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 BN1BFFO11FD005.mail.protection.outlook.com (10.58.144.68) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Tue, 16 Jan 2018 14:29:24 +0000 Received: from b27504-OptiPlex-790.ap.freescale.net (b27504-OptiPlex-790.ap.freescale.net [10.232.132.60]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id w0GESqAK024963; Tue, 16 Jan 2018 07:29:21 -0700 From: Nipun Gupta To: CC: , , Date: Wed, 17 Jan 2018 02:14:02 +0530 Message-ID: <1516135443-10509-10-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1516135443-10509-1-git-send-email-nipun.gupta@nxp.com> References: <20171215130828.14218-1-sunil.kori@nxp.com> <1516135443-10509-1-git-send-email-nipun.gupta@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131605865643625888; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39380400002)(346002)(39860400002)(396003)(376002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(5660300001)(316002)(77096006)(4326008)(54906003)(296002)(2950100002)(106466001)(6916009)(105606002)(16586007)(26005)(2351001)(86362001)(48376002)(50226002)(97736004)(81166006)(8936002)(8676002)(85426001)(6666003)(8656006)(68736007)(498600001)(76176011)(356003)(305945005)(81156014)(104016004)(36756003)(51416003)(47776003)(50466002)(2906002)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR03MB2368; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD005; 1:lkbP1y2wfRI51FFPM2KiyHiEtnlZTXVCyTPvodcNj5KWai/Pd84exA8OAYRpH4YHsqr4exjcBG715GW+OF7FarwvKYgu6R0mvnLv8Cjoot+YtRJ4Hj34XphFd8IUabgQ MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3d2629eb-fb18-4a04-cda0-08d55ced8a82 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:SN2PR03MB2368; X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2368; 3:kme9eUf3IGmKvEhhD997OJtlQfb8LLf+vDrZZT3BE16tMDH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5SDwW1lO1/pvy2Wv0Cft0RAsTQsq3ao3L2RO5lv+erRExqDwkz9vJ9eE8+oyZ+8HKjBbf6cqos7F0hCz6mTNcGCwdyT3JgqzwPOZAD0uZ+Ul17T93dztHB7CCir2XqDkDj3ltFSLyFymab+kIqqQHZ5W9cZueN/V97dQStIxGJ8Zv9gdPb3TcrM21sEyScgkHViofXgm8YW5Sa3nqiLY7hwBfV5+ZGBh6p2GuRoNbIaJcCumduNj6PzjUkcZcADdO0irqKSIQzA= 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)(10201501046)(3231023)(944501161)(3002001)(93006095)(93001095)(6055026)(6096035)(20161123559100)(20161123556025)(20161123563025)(20161123565025)(201703131430075)(201703131520075)(201703131448075)(201703131433075)(201703151042153)(20161123561025)(201708071742011); SRVR:SN2PR03MB2368; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:SN2PR03MB2368; X-Forefront-PRVS: 0554B1F54F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR03MB2368; 23:E0lpuyiC0y+JdUQURRIKO0zhg5Up5muL0PL4KDAU5?= =?us-ascii?Q?Z8SMNpJL4JVm03CsFEIypIxWIHM5YpfzD7Dmbb8/fUz3dnaiZ6GWvHFbSY0l?= =?us-ascii?Q?qQqJT4MTLvmTM60fd3t62VyQW8d+Kdw7W2pezlICWar52WjMltTCVdjNNIvE?= =?us-ascii?Q?wjrv0+xdrNSrcoGZ7mybUE7NrRjj9s7rT0eKhC8YPVEego/JlOkl/eFNhphk?= =?us-ascii?Q?C7UfpJwK0sE7jwPFx39vbq4KrS+MDuVometkvbRt87cuRZA0vIk4U1DPeVHO?= =?us-ascii?Q?AGuf8qLPFuCs1FI95voR8RWdj0rxItr0Xf4FsFSqodHPaPjGM3sniFQCpzjF?= =?us-ascii?Q?c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Ib+0fUBxeSRR+3XKBmOK8lwvZ394tTr/yaAoI09gpoWb92hXSdI/UNi2Wxqh6LFd56jgPPEBnYC6EidaIhgweuvf9qc03i4wVQsws7FzUboAZ6FUiPWJkLSuOQcEeZGsHP6VGQrWbZXZ7R9dekfvGknYBcllql0OqBUzRl3dXOOV0fQWyeWa1BpkzxmcSdouvg7OEQRwN+XNwprVgKicBZqVEUd/IDiZEjsvlc8u5l+QiN7AMIpitKV3gX2up1LBXNGxpdpPj8=; 5:8ZVUL4IWuPmceM6C4Pz9v7G+h9cMz7doc4Bq5fI1XZmTb5RVzSs+4h6L+Al3NNY2HVRupLA0T6YM1l0W2/Jy3KmSH6AfcIP6AHTfJA2zWXoysjCWItszEunCbf9ZxnZXjCwqWK5DZ9m8Y4t5ADnejlVg8epZJXy6TiuHl0MjPZo=; 24:AEVKOAYi0oy5oWhipztM0xMDtQrFlKnaomIQWGTCUje1c7g8DxyukVjkUUqDi+281ASh6aKdrBAJbP0HYt46cLQuumT/uj1fuPbkx99jf3s=; 7:FzDNtQLJAo9C31fOEQPfoYQvV0/qZ6pjY72IJNVkaLDbwyypqzEgJn2AYcAf/AkuU627nmD95E0rpzqlji7juUAhFz9hB3CyNtIqmeCioVfvqpPPba46aIwDaYjvUGeL4RwPSB7vTB7eniUOiEvfaIvmBq27LldRgqORw49cGm66dBfUNZC7uurjsig9KQaHMuXBFw7NIKM2yV2iCOdsAMdEysBMjbSeP6RZZUvcA+j7Vs/I5s0wh0agkfzwc9O/ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2018 14:29:24.1909 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3d2629eb-fb18-4a04-cda0-08d55ced8a82 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: SN2PR03MB2368 Subject: [dpdk-dev] [PATCH 09/10 v4] 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: Tue, 16 Jan 2018 14:29:26 -0000 From: Sunil Kumar Kori Signed-off-by: Sunil Kumar Kori Acked-by: Hemant Agrawal --- 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 05469ae..7360fad 100644 --- a/drivers/event/dpaa/dpaa_eventdev.c +++ b/drivers/event/dpaa/dpaa_eventdev.c @@ -60,6 +60,116 @@ } 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) { @@ -496,6 +606,10 @@ } 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) -- 1.9.1