From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0084.outbound.protection.outlook.com [104.47.38.84]) by dpdk.org (Postfix) with ESMTP id 6F21B2BC8 for ; Tue, 16 Jan 2018 12:43:34 +0100 (CET) Received: from BN3PR03CA0108.namprd03.prod.outlook.com (10.174.66.26) by MWHPR03MB2703.namprd03.prod.outlook.com (10.168.207.137) 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 11:43:33 +0000 Received: from BN1AFFO11FD008.protection.gbl (2a01:111:f400:7c10::193) by BN3PR03CA0108.outlook.office365.com (2603:10b6:400:4::26) 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 11:43:32 +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 BN1AFFO11FD008.mail.protection.outlook.com (10.58.52.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 11:43:32 +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 w0GBgtjU014705; Tue, 16 Jan 2018 04:43:29 -0700 From: Nipun Gupta To: CC: , , Date: Tue, 16 Jan 2018 23:28:03 +0530 Message-ID: <1516125485-28919-11-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1516125485-28919-1-git-send-email-nipun.gupta@nxp.com> References: <20171215130828.14218-1-sunil.kori@nxp.com> <1516125485-28919-1-git-send-email-nipun.gupta@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131605766123715152; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(376002)(39860400002)(346002)(39380400002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(48376002)(50466002)(6666003)(36756003)(2950100002)(5660300001)(104016004)(76176011)(51416003)(2906002)(6916009)(498600001)(106466001)(4326008)(53936002)(2351001)(68736007)(8676002)(81156014)(81166006)(77096006)(8936002)(50226002)(47776003)(105606002)(85426001)(16586007)(54906003)(86362001)(316002)(296002)(305945005)(356003)(8656006)(97736004)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2703; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD008; 1:+n4crbkkf5FoGAis5uazGPQSmUvODqycZU2eVZVHyDFR5jY1OP0x5NBM5PAacYZljQneCLDcAt1epNd3BfVQT+fsVyTHjuBCCFCq1vq8stQkoA1J3e+l4gYzLeaT6CKe MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9eea84a9-4fea-4bd8-7a50-08d55cd65ea9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:MWHPR03MB2703; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2703; 3:ArpZg/QxlEUC57GK2NN1JND8OmuKVAd91ePhjphBqUe9yFO0ohYLHMozhGHcykjOPCc4o4hidq9H7c6K/G20DQJ0Zqw2xULrqt26rDlV/rF9I2Ys+Zz8mdtSq4ScbgzPJosaU63LS5kjkryVuIK64AeLURLE2i0vATDTBcXkl5BiWmVLHL4NVy1Z5mCtg23EVWrMLhPxOJAV79Pc3CVpcdNoQ63LpKjuywDLQ9Dpa8lheumjIUuja0NjEDU786+COm5MlZQTzw6X791qzqeZ31Co52dn/8fsC444XIxzXKOVget+WEH3xoD9wF233k7Qp6/JrKAMIy1e0Ize9JFtKznI4NkXt8pJFL1/tDNAUko=; 25:S3SpQCzLTVl6d6u75I+zOubXcvFokGYuuIbJeg/xiBvrxUJRDXESWIWC2UCuGA3OGn6PrRCKx6lBJi1iCD/rrmKQ454H0piORL/Ocqi/tT/ZZpFEgVqt4GQpJVduNiq8cG8wa/P/lABYFgia5CKjQjtSgryXDylfMrZ55+hBwuljMA4G+57tZl/c/0zydlqqXNu9hqPPYMMwlRkwzKypD69RtJ1TmQFUB0516u2a88JITspx5XnZ53TWDNzA75YZ2A+g5W90KgRnApwXQzs31Cn86haASZkEGacN5L0xoSHy2/GhMG46VjmmAmW6cdtbakO9c741f69IFLDi0zWMFA== X-MS-TrafficTypeDiagnostic: MWHPR03MB2703: X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2703; 31:lEIryVaz8UPNnsTdipePEhqCkPd8BJGkCyHJuQBJrLxtP6zkssJFDwwff1xLvyGJZ2M779Wh7rBWHiD/inEp7jb/zh6NzPtnCHz9mim1+mgSFtDj813vy5TTSNmzVjyCXjUzgGCodlPdM/AKBR4lUb0a9FTdfOtck4esgLDYsfLihcxdzFfLmDYnF7V+e3fz9//UG8S4CQMTxyaL5GBxlqe2KqriPV17SYtl2DrY4hU=; 4:I42PKVUmGTaENaVgyPdK0scdXoXiD3tBMm+wPhaww2lqp1vfK79I6mdrpWOIbifb8GanJP5DsFW0sltTjZnHavoQSXFPluvjpdW7GNiIzdnvg+aF6VEDugBJCpNXzyMABCkEPiUrRlnTQqo2YlR/JRvtID0iOLk/VwtwNIXA50r6o7h/2i75WAdRj5dA0ioqLDzpYzb4ymmPTUgsV7guN7J7dBiBb4XuTI7aTnY6Db/0AjrTzIRxWo1S4q9MDeWfvTSUhj7QwkASZc933M34cfXy+VIOtQc6as8wYWNBqzqI2bTn6nuEkMEyZ8zm7U4r1qFUvj6PSkIoZ45XHx+MJNWn2XcHK26TS3Wozevu1rY= 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)(10201501046)(93006095)(93001095)(3231023)(944501161)(6055026)(6096035)(20161123559100)(201703131430075)(201703131520075)(201703131448075)(201703131433075)(201703151042153)(20161123556025)(20161123563025)(20161123565025)(20161123561025)(201708071742011); SRVR:MWHPR03MB2703; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:MWHPR03MB2703; X-Forefront-PRVS: 0554B1F54F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2703; 23:lQkLh28yS4WBQhjzhg3p8N2cJ1N/BbTuAnnzvhiA/?= =?us-ascii?Q?LUr+0UE+GP9mVTIRa2ZwD0Ztl3CTsdTgB3/3pBf1VvGRcGcHd6XCxxSKVEXa?= =?us-ascii?Q?9bk2++JnQjIChIZBTEhANTIdcPPqloJXSmjB7o7T/ziiTwHhRi94evQq5b9H?= =?us-ascii?Q?bKRIUBKE07Py5K0wLYo45M1Iqt+qGZ7wmfXWUFl1sC02EDQLWsHJcGXvezmK?= =?us-ascii?Q?kGnImMJaV6y8pO/UEF024HtAkmmexfqk+mZrSAoMpg+lLkTlKKLJtVAn0adf?= =?us-ascii?Q?zGctiHjx84fOSsN07HttPtfZJRZ3iDhfWAVyJvPPemcE9OUbeYaqrPF717Jv?= =?us-ascii?Q?0+YjgVxPwnh4VvFyvgvNxinqe4v6vytqs6KRy/xyf6jVLOP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dicfmgAGRoMgP4S2Xx6YmLPmd7mJB+XGVED+7rvSJzDMhyH8S5aPg7D0YCiSO2w5dCW3A6rI0xgOr0jMvleVThaH42rF62FcDbPPxTR7ilhhwtr0ZS+naqeJzgHm2ctMzdiPa/33uoEXx1lRmCbc0XqTIBmoJGSgl5IUvmtTJZFXbhM04q1rVI/FsHzQQQiToG72vFz4GGVxbIY+Qai9le2seCYCObzg=; 5:vfooz6eO2UhIXGLU/4t9vZCGEVYyZDZcp+7/BpiPx/JXlUr7CVz/qdAcqz/JAEuvHlv7yOBfJWsKp0WeAWgBibTW5MNu5+FJ8lp8C9SYrDulHWmRHUi3jHe8KRYf2OM42vQYZZiKyG16BjXibvpey+gy7PVn0TWl6TgbNjnK6FU=; 24:yZi9LJE5Z22cOBcHxAy5f4maz4FS+0szO8OOiFsNow+Dh8vZ+AoVO0+czOMb+IvHrU7TypO5kJ6G24v67igzoa0UnSnjGFrorzTOjtJMxX0=; 7:ZI/RaZVDI+IkFdCG6RMjH06HWvVrKhd+cEMwRLkFyTKx+EW8Abm47lH6GbmOef/A2HFZ9GEeZ2UPYpEQsmQGeDDY1QMqR0XkJvNPDKM6UjW83oAw3kk6woz2aFkTN/f8ExB8AJ0YfO6WCQvLeyp0SSnmosrFLlvckhISFAt6lzgZI2Oe+XVgv0KUMxOd7sFYkmq8CqQckWMlNNdMMyjnTgTQIFr+jwriKJxaWNWKHSv4NaimFZLSd5hUt+hiJ9nW SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2018 11:43:32.1843 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9eea84a9-4fea-4bd8-7a50-08d55cd65ea9 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: MWHPR03MB2703 Subject: [dpdk-dev] [PATCH 10/12 v3] 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 11:43:35 -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 0d9037e..44e6314 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