From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0066.outbound.protection.outlook.com [104.47.33.66]) by dpdk.org (Postfix) with ESMTP id 07F6C1B022 for ; Tue, 16 Jan 2018 12:43:18 +0100 (CET) Received: from BN3PR03CA0107.namprd03.prod.outlook.com (2603:10b6:400:4::25) by SN2PR03MB2366.namprd03.prod.outlook.com (2603:10b6:804:e::17) 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:17 +0000 Received: from BL2FFO11FD050.protection.gbl (2a01:111:f400:7c09::137) by BN3PR03CA0107.outlook.office365.com (2603:10b6:400:4::25) 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:17 +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 BL2FFO11FD050.mail.protection.outlook.com (10.173.161.212) 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:17 +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 w0GBgtjP014705; Tue, 16 Jan 2018 04:43:15 -0700 From: Nipun Gupta To: CC: , , Date: Tue, 16 Jan 2018 23:27:58 +0530 Message-ID: <1516125485-28919-6-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: 131605765978048365; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(376002)(396003)(346002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(106466001)(2351001)(105606002)(305945005)(104016004)(356003)(8656006)(48376002)(50466002)(6666003)(2950100002)(97736004)(36756003)(6916009)(4326008)(47776003)(5660300001)(59450400001)(50226002)(53936002)(498600001)(575784001)(77096006)(81156014)(8676002)(51416003)(68736007)(81166006)(54906003)(16586007)(85426001)(316002)(296002)(76176011)(2906002)(8936002)(86362001)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR03MB2366; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD050; 1:pt5psK4ku4EOyanFV1U/h4XNSm4CJuv+eP74Rn3WnEn74d59UHzmxjFAhCMKyeaEWM+VDyh5kFouPzmfr5ONZ2vQqpx23j8Y87IJhWozDDoq+EjGXviND6pwSraz7pN/ MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 98507020-2c74-40e6-c76d-08d55cd655fa X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:SN2PR03MB2366; X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2366; 3:3NyayEZ9MDbYGuiNhqMxdZJrIcZAewERu7TyfxxNIHZ8oGT4fcql6Hnij+qaVcQ0AdEUpupKTnnxqGzf8IVBEfAM9WMqL5Eid0wxPr3Yoy0eZkI8RHu1He1WTAW85rpz5CEsQ4+p2HezwuafeR9wSIxtM/ROMd7BIPMxIjHelZ0rI125ynDNpRZFNGv2ZaU5FuKCca32sixVxNatiJLqRqxZ3AuOCcBofBDfAYyh9UEN45gOt/QM14XFIZHtDOK4sVpFg5b6y1d83rAeXL7HgNnRE9IQMlQpXDT1iwWqQgvMBoG3yrku7lVlxj8yOfHQIMhhfaz8L6G+OL2DLqMFk6lT3BzTz1BCWQtWRszrad8=; 25:fWNrk+XI1VTezcOL7HvWR15ZtI1C49aRHjVDNo3DFrK+O0l1tTMDrAoMZiRA3q5HOb/I/B8gZgl4SfG4F42Vy4424GEzEJZhmzInpSCom9+wd6AzgoAkpeF8ri7GgzseeEj5UZVTPJFn2EWUCYlERXeZslZxBbbbI5vVMaSZJlwTVgzn/PMUyAn0/cgOC+e/s4t1W7oH5w6ETf9+cCKa1TXS3TlylkB8q2VHgAxlsXolFNy+O/EPFC15O8eApb3gHgl8dskxN3w5dVcYpYIUObV0UkaJxgJTKT4vIHolxc0pQf1ruwfoQhCVctOFp2jhTpJjZGC7nOWp4eLUTCOwxw== X-MS-TrafficTypeDiagnostic: SN2PR03MB2366: X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2366; 31:EJzwJfd4m11oA9NTgdKZh/O/PXHE63KRJhx+nQKmVOKICRL5ezk3fF2J5ByInfXApOHSai2bUVwp4Yz5YvdB0KOJWnYpBvuhXb+s+tJLw4JKwjhtYrIBBYwwx06DTLPPn3K3pWF0GUnHUqAh825Ep67GWihzGnn6iMfgSmSLVOIBeLWOAka1yrD+kc/jXGztJxlOU7f0CL7TOI0jPOSahVwG3aEfNs+gEd5L0P4U1Rs=; 4:xQouIouSowKkoArYNBD1lv6HwkxCNsIXQelt8Vkf0HvXRGv9C+hnhdWxXCgutp+adPC1cZ++rvoCxcmJHAaW+OYPNf5r2LnIcIC7ywbVGPn+7VL9WWXVusJZZSteiCw8gu2NYANyCz03iBovvNwzfOXcocmuSao30RklI1F1L6gUvx9watp9UA9/NJgF2W89pgty7Z3fkV9Am8YmVi0DBFzLtlIwJyr/hhAbS53XhAGXG64jo2NTjCymJ7THDorWoCnccQSA13UhtxWb/vSp4IZQ0lADFnV22l/xDNntZ/EE1yjw9nr5ME1gRpNDT2I+pQt/J871T0lzajx4Tr9LaRjcjY7b4bba/bdtYw0Hh3WYjorVnojWXQDQ0EOWViRaTFZf1qcxvDIsccaHW49dHOext6+aYFO8hdzbs0vgOWI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(227817650892897)(275809806118684)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(10201501046)(3231023)(944501161)(3002001)(93006095)(93001095)(6055026)(6096035)(20161123565025)(20161123563025)(201703131430075)(201703131520075)(201703131448075)(201703131433075)(201703151042153)(20161123561025)(20161123559100)(20161123556025)(201708071742011); SRVR:SN2PR03MB2366; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:SN2PR03MB2366; X-Forefront-PRVS: 0554B1F54F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR03MB2366; 23:ZjzS3OXD5TieY2orzfwhREJ+khCx0QIXaAWGQ+4Q0?= =?us-ascii?Q?LOlZJ8GQ5TDl0Gc1mnyxXDjh/XVafWT2K5XrBe69Uce1p+RWkEs1aryU0iGC?= =?us-ascii?Q?JOTaYxaPnilWjOBGT4+zRyro9DmDd7gXBW2z7cZu1JX/Fbgxl/kti3/UJhSt?= =?us-ascii?Q?4xQt275vIslaKNAogjhASg8rkmL1dDRXSFzPPR4Mce9x0CrZ/EDzDxJVmhYm?= =?us-ascii?Q?VPJNAfjqEAOxiYrWNAKE6EoK68/84tWELjiZIqpjdXM/X5zmXc4Yt/LbSrlm?= =?us-ascii?Q?/a5nG0yWIvLXW9dTzxIlXq17ZxS5IaF5QR3IXVRTYyr7MmUx8ESf8q1POrao?= =?us-ascii?Q?jxp1WdzlDf6cXGOMpI0vh5JA/yg9XgTX7FuG5NFXlxAW07LoO+P+ay/gYIyz?= =?us-ascii?Q?WojO5NpF5cK8MkvbJm9oDf7Nij89O8BY16PD0PfpKswtT9b10oLh/Sq8B+z3?= =?us-ascii?Q?mGxVUzmDWJYQSnF6TnjGcx0+5VqG0/I6UEHpjYSoIt5WCvgscmyJTU4oa+Pc?= =?us-ascii?Q?SsrUXawFMeYwz1/ss1SV2gXbbjiE7TJgVU91ymrh7xi3u4lDaFQ6dWKI7Z5I?= =?us-ascii?Q?0kfTRUDF93yXFHwE2TMxTnetUYyFAUtAkKeJBJLycU88V0uuwQ2rYrljacjU?= =?us-ascii?Q?GA3PP0spopU6wBureNWPvCnXy3RQsHxEOruFzFscZoERdcJxjghutnZGlWY0?= =?us-ascii?Q?CPNLJk/Jg6cpX2wp5zQqtDJ176i3u175XUch3yyl7qw+elu/HCSm4inoNevF?= =?us-ascii?Q?ZCwOPo0WsNSS/Sig4iBgWpsqIPA67JJPjPREo1JZ8yHAkNDOG91mAa+HY50F?= =?us-ascii?Q?+pUDYLBNsiyhWr6IwSfo3NK0OExJMKDXeThMDrBAo6JYbQaNW+aOfAVMaWs2?= =?us-ascii?Q?LkOabx351LYlRmbasYdCcJiKnOLvAs9aFYOG+U0zPR2URyNTq8iS8IMjHxns?= =?us-ascii?Q?KdXTHjbclRKTLj0S0OAhWv7kfYI1Lk014/wo8ELDOrTZ0Y1QYMkgE7XENdQ8?= =?us-ascii?Q?z91axzgzmCENyZx6ZlLylYjYvwJY5fkEhcHC57TVhGDtWn1E363GPkCsrRet?= =?us-ascii?Q?IVxq77bLAO5oFlNDbip/HtNgkrXbOXEw73u07Sxn66WKd4mlHlTcOlnc3pIP?= =?us-ascii?Q?oYto7S4PqAUXp+7gxk4isdk2TcHkAQr?= X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2366; 6:2nGak73tdP9UgMMX7oSWsHXw3cY6+rIr+c7inmB/bjCXQ6OuMEMYpb2MYBR2KF12J6A8uFzwQLHHHp92GuNG1d0T/RwAarFMHvkIsKZ6qRnkCOvwPp+z+TFAMRM9lOKZBelsK3jcxQBVf0mFv+h8xwczw2MIoxFPScTq1KDLFP46YSTyy1lDchORRZ38fykXnjtGA+p3FHuWtuFKuRLJG2LLU65BNC1Nv2eIO1jC6yAhu/21qPIDZCH0yj4fmntpTHMrpKEd+24fjpx2KpoHYLXgqOjPi0yu8v7rWVIdG5Narnri5ljcsMjp7mYAkWKw02HXGisnMV0Qk42ndSgwz5WKjvLQwHMAXYn5aOqY8sQ=; 5:C9aWUdDf/WV3XsXr+DMQvP1vDFu4iEhtuKWRMKTqKJKCgEc8oo1/0EJUiA6QGCyKhL2AI/rjpFJzgFiXmg12cv7ihUfwGifH/pq1yy7+t4jO9U6d/g5f+x8evlDlUnAWHdu2IH1Ob30rOHItPeAObmKaFPmM0ENa/ulqrib2yFQ=; 24:VwR6fSr7OrdvdCVn+Ole/4U05un691W5jbg7Yk4cU7A90ED9PaUCLQ08wiV9Vgp8VUoUZG1juAfqlhIl6FCUi0bgg9W6e0R4O9h3y2Ho6xA=; 7:jWiLYwfpABjNjdFqQRDZy3rjmZfctmTDcNzUWQFdsrH0GkrEXhf/uXLa7KOXeGMN7uEGSGXoo6Qf/gMN+SPtcs+Q++/preJlm7ZMiSLuTpusWL/6EP4FkGGhbIRazFwR6TrI3RwwyOs/kz7AO8RVNd0BadosmGv/RCBYdawXxs9pU3BW7ZL+2cEufQpwCtmVTaHYeCD4Z21RvREgxQzE/JmD7VLUpspJAvO4IQ5/NpuSFeLpUKpiYESZIOUMWvON SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2018 11:43:17.6332 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 98507020-2c74-40e6-c76d-08d55cd655fa 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: SN2PR03MB2366 Subject: [dpdk-dev] [PATCH 05/12 v3] event/dpaa: add eventdev PMD 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:19 -0000 From: Sunil Kumar Kori Signed-off-by: Sunil Kumar Kori Acked-by: Hemant Agrawal --- MAINTAINERS | 5 + drivers/event/Makefile | 1 + drivers/event/dpaa/Makefile | 37 +++ drivers/event/dpaa/dpaa_eventdev.c | 269 ++++++++++++++++++++++ drivers/event/dpaa/dpaa_eventdev.h | 81 +++++++ drivers/event/dpaa/rte_pmd_dpaa_event_version.map | 4 + 6 files changed, 397 insertions(+) create mode 100644 drivers/event/dpaa/Makefile create mode 100644 drivers/event/dpaa/dpaa_eventdev.c create mode 100644 drivers/event/dpaa/dpaa_eventdev.h create mode 100644 drivers/event/dpaa/rte_pmd_dpaa_event_version.map diff --git a/MAINTAINERS b/MAINTAINERS index dbfd3f7..fff842e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -704,6 +704,11 @@ M: Nipun Gupta F: drivers/event/dpaa2/ F: doc/guides/eventdevs/dpaa2.rst +NXP DPAA eventdev +M: Hemant Agrawal +M: Sunil Kumar Kori +F: drivers/event/dpaa/ + Software Eventdev PMD M: Harry van Haaren F: drivers/event/sw/ diff --git a/drivers/event/Makefile b/drivers/event/Makefile index 7f68440..0cbf2e4 100644 --- a/drivers/event/Makefile +++ b/drivers/event/Makefile @@ -9,5 +9,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += octeontx DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV) += dpaa2 DIRS-$(CONFIG_RTE_LIBRTE_PMD_OPDL_EVENTDEV) += opdl +DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA_EVENTDEV) += dpaa include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/event/dpaa/Makefile b/drivers/event/dpaa/Makefile new file mode 100644 index 0000000..bd0b6c9 --- /dev/null +++ b/drivers/event/dpaa/Makefile @@ -0,0 +1,37 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2017 NXP +# + +include $(RTE_SDK)/mk/rte.vars.mk +RTE_SDK_DPAA=$(RTE_SDK)/drivers/net/dpaa + +# +# library name +# +LIB = librte_pmd_dpaa_event.a + +CFLAGS := -I$(SRCDIR) $(CFLAGS) +CFLAGS += -O3 $(WERROR_FLAGS) +CFLAGS += -Wno-pointer-arith +CFLAGS += -I$(RTE_SDK_DPAA)/ +CFLAGS += -I$(RTE_SDK_DPAA)/include +CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa +CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/include/ +CFLAGS += -I$(RTE_SDK)/drivers/mempool/dpaa +CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include +CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal/include + +EXPORT_MAP := rte_pmd_dpaa_event_version.map + +LIBABIVER := 1 + +# Interfaces with DPDK +SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA_EVENTDEV) += dpaa_eventdev.c + +LDLIBS += -lrte_bus_dpaa +LDLIBS += -lrte_mempool_dpaa +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring +LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs +LDLIBS += -lrte_eventdev -lrte_pmd_dpaa -lrte_bus_vdev + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c new file mode 100644 index 0000000..0bd74bb --- /dev/null +++ b/drivers/event/dpaa/dpaa_eventdev.c @@ -0,0 +1,269 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2017 NXP + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "dpaa_eventdev.h" +#include + +/* + * Clarifications + * Evendev = Virtual Instance for SoC + * Eventport = Portal Instance + * Eventqueue = Channel Instance + * 1 Eventdev can have N Eventqueue + */ + +static int +dpaa_event_dequeue_timeout_ticks(struct rte_eventdev *dev, uint64_t ns, + uint64_t *timeout_ticks) +{ + uint64_t cycles_per_second; + + EVENTDEV_DRV_FUNC_TRACE(); + + RTE_SET_USED(dev); + + cycles_per_second = rte_get_timer_hz(); + *timeout_ticks = ns * (cycles_per_second / NS_PER_S); + + return 0; +} + +static void +dpaa_event_dev_info_get(struct rte_eventdev *dev, + struct rte_event_dev_info *dev_info) +{ + EVENTDEV_DRV_FUNC_TRACE(); + + RTE_SET_USED(dev); + dev_info->driver_name = "event_dpaa"; + dev_info->min_dequeue_timeout_ns = + DPAA_EVENT_MIN_DEQUEUE_TIMEOUT; + dev_info->max_dequeue_timeout_ns = + DPAA_EVENT_MAX_DEQUEUE_TIMEOUT; + dev_info->dequeue_timeout_ns = + DPAA_EVENT_MIN_DEQUEUE_TIMEOUT; + dev_info->max_event_queues = + DPAA_EVENT_MAX_QUEUES; + dev_info->max_event_queue_flows = + DPAA_EVENT_MAX_QUEUE_FLOWS; + dev_info->max_event_queue_priority_levels = + DPAA_EVENT_MAX_QUEUE_PRIORITY_LEVELS; + dev_info->max_event_priority_levels = + DPAA_EVENT_MAX_EVENT_PRIORITY_LEVELS; + dev_info->max_event_ports = + DPAA_EVENT_MAX_EVENT_PORT; + dev_info->max_event_port_dequeue_depth = + DPAA_EVENT_MAX_PORT_DEQUEUE_DEPTH; + dev_info->max_event_port_enqueue_depth = + DPAA_EVENT_MAX_PORT_ENQUEUE_DEPTH; + /* + * TODO: Need to find out that how to fetch this info + * from kernel or somewhere else. + */ + dev_info->max_num_events = + DPAA_EVENT_MAX_NUM_EVENTS; + dev_info->event_dev_cap = + RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED | + RTE_EVENT_DEV_CAP_BURST_MODE | + RTE_EVENT_DEV_CAP_MULTIPLE_QUEUE_PORT | + RTE_EVENT_DEV_CAP_NONSEQ_MODE; +} + +static int +dpaa_event_dev_configure(const struct rte_eventdev *dev) +{ + struct dpaa_eventdev *priv = dev->data->dev_private; + struct rte_event_dev_config *conf = &dev->data->dev_conf; + int ret, i; + uint32_t *ch_id; + + EVENTDEV_DRV_FUNC_TRACE(); + + priv->dequeue_timeout_ns = conf->dequeue_timeout_ns; + priv->nb_events_limit = conf->nb_events_limit; + priv->nb_event_queues = conf->nb_event_queues; + priv->nb_event_ports = conf->nb_event_ports; + priv->nb_event_queue_flows = conf->nb_event_queue_flows; + priv->nb_event_port_dequeue_depth = conf->nb_event_port_dequeue_depth; + 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); + if (ch_id == NULL) { + EVENTDEV_DRV_ERR("Fail to allocate memory for dpaa channels\n"); + return -ENOMEM; + } + /* Create requested event queues within the given event device */ + ret = qman_alloc_pool_range(ch_id, priv->nb_event_queues, 1, 0); + if (ret < 0) { + EVENTDEV_DRV_ERR("Failed to create internal channel\n"); + rte_free(ch_id); + return ret; + } + for (i = 0; i < priv->nb_event_queues; i++) + priv->evq_info[i].ch_id = (u16)ch_id[i]; + + /* Lets prepare event ports */ + memset(&priv->ports[0], 0, + sizeof(struct dpaa_port) * priv->nb_event_ports); + 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); + } + } else { + for (i = 0; i < priv->nb_event_ports; i++) { + dpaa_event_dequeue_timeout_ticks(NULL, + priv->dequeue_timeout_ns, + &priv->ports[i].timeout); + } + } + /* + * TODO: Currently portals are affined with threads. Maximum threads + * can be created equals to number of lcore. + */ + rte_free(ch_id); + EVENTDEV_DRV_LOG("Configured eventdev devid=%d", dev->data->dev_id); + + return 0; +} + +static int +dpaa_event_dev_start(struct rte_eventdev *dev) +{ + EVENTDEV_DRV_FUNC_TRACE(); + RTE_SET_USED(dev); + + return 0; +} + +static void +dpaa_event_dev_stop(struct rte_eventdev *dev) +{ + EVENTDEV_DRV_FUNC_TRACE(); + RTE_SET_USED(dev); +} + +static int +dpaa_event_dev_close(struct rte_eventdev *dev) +{ + EVENTDEV_DRV_FUNC_TRACE(); + RTE_SET_USED(dev); + + return 0; +} + + + +static const struct rte_eventdev_ops dpaa_eventdev_ops = { + .dev_infos_get = dpaa_event_dev_info_get, + .dev_configure = dpaa_event_dev_configure, + .dev_start = dpaa_event_dev_start, + .dev_stop = dpaa_event_dev_stop, + .dev_close = dpaa_event_dev_close, +}; + +static int +dpaa_event_dev_create(const char *name) +{ + struct rte_eventdev *eventdev; + struct dpaa_eventdev *priv; + + eventdev = rte_event_pmd_vdev_init(name, + sizeof(struct dpaa_eventdev), + rte_socket_id()); + if (eventdev == NULL) { + EVENTDEV_DRV_ERR("Failed to create eventdev vdev %s", name); + goto fail; + } + + eventdev->dev_ops = &dpaa_eventdev_ops; + + /* For secondary processes, the primary has done all the work */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + + priv = eventdev->data->dev_private; + priv->max_event_queues = DPAA_EVENT_MAX_QUEUES; + + return 0; +fail: + return -EFAULT; +} + +static int +dpaa_event_dev_probe(struct rte_vdev_device *vdev) +{ + const char *name; + + name = rte_vdev_device_name(vdev); + EVENTDEV_DRV_LOG("Initializing %s", name); + + return dpaa_event_dev_create(name); +} + +static int +dpaa_event_dev_remove(struct rte_vdev_device *vdev) +{ + const char *name; + + name = rte_vdev_device_name(vdev); + EVENTDEV_DRV_LOG("Closing %s", name); + + return rte_event_pmd_vdev_uninit(name); +} + +static struct rte_vdev_driver vdev_eventdev_dpaa_pmd = { + .probe = dpaa_event_dev_probe, + .remove = dpaa_event_dev_remove +}; + +RTE_PMD_REGISTER_VDEV(EVENTDEV_NAME_DPAA_PMD, vdev_eventdev_dpaa_pmd); diff --git a/drivers/event/dpaa/dpaa_eventdev.h b/drivers/event/dpaa/dpaa_eventdev.h new file mode 100644 index 0000000..306ab81 --- /dev/null +++ b/drivers/event/dpaa/dpaa_eventdev.h @@ -0,0 +1,81 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2017 NXP + */ + +#ifndef __DPAA_EVENTDEV_H__ +#define __DPAA_EVENTDEV_H__ + +#include +#include +#include +#include + +#define EVENTDEV_NAME_DPAA_PMD event_dpaa + +#define EVENTDEV_DRV_LOG(fmt, args...) \ + DPAA_EVENTDEV_INFO(fmt, ## args) +#define EVENTDEV_DRV_FUNC_TRACE() \ + DPAA_EVENTDEV_DEBUG("%s() Called:\n", __func__) +#define EVENTDEV_DRV_ERR(fmt, args...) \ + DPAA_EVENTDEV_ERR("%s(): " fmt "\n", __func__, ## args) + +#define DPAA_EVENT_MAX_PORTS 8 +#define DPAA_EVENT_MAX_QUEUES 16 +#define DPAA_EVENT_MIN_DEQUEUE_TIMEOUT 1 +#define DPAA_EVENT_MAX_DEQUEUE_TIMEOUT (UINT32_MAX - 1) +#define DPAA_EVENT_MAX_QUEUE_FLOWS 2048 +#define DPAA_EVENT_MAX_QUEUE_PRIORITY_LEVELS 8 +#define DPAA_EVENT_MAX_EVENT_PRIORITY_LEVELS 0 +#define DPAA_EVENT_MAX_EVENT_PORT RTE_MAX_LCORE +#define DPAA_EVENT_MAX_PORT_DEQUEUE_DEPTH 8 +#define DPAA_EVENT_PORT_DEQUEUE_TIMEOUT_NS 100UL +#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) + +#define DPAA_EVENT_DEV_CAP \ +do { \ + RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED | \ + RTE_EVENT_DEV_CAP_BURST_MODE; \ +} while (0) + +#define DPAA_EVENT_QUEUE_ATOMIC_FLOWS 0 +#define DPAA_EVENT_QUEUE_ORDER_SEQUENCES 2048 + +#define RTE_EVENT_ETH_RX_ADAPTER_DPAA_CAP \ + (RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT | \ + RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ | \ + RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID) + +struct dpaa_eventq { + /* Channel Id */ + uint16_t ch_id; + /* Configuration provided by the user */ + uint32_t event_queue_cfg; + uint32_t event_queue_id; + /* Event port */ + void *event_port; +}; + +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; +}; + +struct dpaa_eventdev { + struct dpaa_eventq evq_info[DPAA_EVENT_MAX_QUEUES]; + struct dpaa_port ports[DPAA_EVENT_MAX_PORTS]; + uint32_t dequeue_timeout_ns; + uint32_t nb_events_limit; + uint8_t max_event_queues; + uint8_t nb_event_queues; + uint8_t nb_event_ports; + uint8_t resvd; + uint32_t nb_event_queue_flows; + uint32_t nb_event_port_dequeue_depth; + uint32_t nb_event_port_enqueue_depth; + uint32_t event_dev_cfg; +}; +#endif /* __DPAA_EVENTDEV_H__ */ diff --git a/drivers/event/dpaa/rte_pmd_dpaa_event_version.map b/drivers/event/dpaa/rte_pmd_dpaa_event_version.map new file mode 100644 index 0000000..179140f --- /dev/null +++ b/drivers/event/dpaa/rte_pmd_dpaa_event_version.map @@ -0,0 +1,4 @@ +DPDK_18.02 { + + local: *; +}; -- 1.9.1