From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0084.outbound.protection.outlook.com [104.47.32.84]) by dpdk.org (Postfix) with ESMTP id 0451E1B40D for ; Fri, 22 Dec 2017 16:17:43 +0100 (CET) Received: from CY4PR03CA0084.namprd03.prod.outlook.com (10.171.242.153) by BN6PR03MB2690.namprd03.prod.outlook.com (10.173.144.9) 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:42 +0000 Received: from BN1AFFO11FD030.protection.gbl (2a01:111:f400:7c10::164) by CY4PR03CA0084.outlook.office365.com (2603:10b6:910:4d::25) 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:42 +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 BN1AFFO11FD030.mail.protection.outlook.com (10.58.52.168) 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:26 +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 vBMFHVew024113; Fri, 22 Dec 2017 08:17:39 -0700 From: Sunil Kumar Kori To: CC: , Date: Fri, 22 Dec 2017 20:47:18 +0530 Message-ID: <20171222151725.11273-5-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: 131584294470379493; (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)(396003)(376002)(39380400002)(346002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(2351001)(316002)(97736004)(47776003)(104016004)(1076002)(8656006)(51416003)(36756003)(85426001)(2906002)(54906003)(575784001)(86362001)(81166006)(48376002)(50466002)(81156014)(8676002)(77096006)(5660300001)(53936002)(6666003)(105606002)(68736007)(16586007)(6916009)(356003)(106466001)(305945005)(2950100002)(4326008)(76176011)(50226002)(8936002)(59450400001)(498600001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2690; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD030; 1:1nCMxTuokx1s3g54PY6zdtIv15r+AlsUgsUkJdIJMbpa6+dirQM1vAFBpa9FkAa52OwiP3cywjsQj/F/GG+lVcbAdqYWS38lWuVs9SguNXfmEeB5uKcde2Pp/KTI73b6 MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: d83997da-6023-45e1-67e5-08d5494f1c64 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:BN6PR03MB2690; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2690; 3:X4GsmMCLUm9aKaFNYQDzqNq3amSYNBlSmPeo25q4HfO3oC+dGh/gPOs9DVpeg2VMuxDXYO7pq3k/bP6HUzr4jV2/JcIKsvB3dI7bWY4ETFZx+waL67txvTJAKA7mFLN9s2ZA+Z+MKYHBUIveUsHLQ3WAkqCj7umt5yublZtoYAwcaOlcRkBsGRMt/MmaYWs9Oe9+RWKspDzx25lGWD/K1JgCqoiwgqwl7lm1pORR843YsJY0YzIwzaphO9F9nzp2d2/wyP9+xEc5juTiv7uRaj9Cm7w8y+hZJZ3gTC8YfUF0keeI/S5qBpx6BS94UDcEhVw6BG+1PFilRT7jcdkWeZRMwzupAiqh9TaAUeoAYXw=; 25:+dOd7gqp41pz4sudRtJtQQGmbtDs/I0OwQ9Hz+zdiZTUyo6WqBzNdPU3RnwykLgfanHjKROhz2pEK/PnsONYvzaxC4NLxSyCJQbRKECzanQpnksa9oJYIf209Rie4NFJIUBHwzJyBseZ9CYVqFMOL6hRlPg/35PhguRGeJaJf1GupgsrBK55WtjgKSq9kwFcIAeoI767pDBmLjbkHwIofDkoCGQdKedDlLPgTqkHJoTYG/rVLTObKf0VJ2PAMqRtme1v7bL1rgcWbb8FY4nslfRWlG+s1S6Jih+kriCqCy+oyKv8BHg4lLn/bnWAbX7dD751YK7LaQXL7FdA1/mTDw== X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN6PR03MB2690: X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2690; 31:ZtGVEDC0O+pKeua3FZvBXKxgyHyPZd8rfUY9yeD1ujo8EGjPW29ityOEIPmr62giZY2cZHcxlBsZAilOsGvg5Z7moUGCKbpt6wCcbBOo9B3NpOxen+8flZGfC98e6A/TlBXgdAHU/tGrX8hY8doS+A52aJSqrSiTBHHDarUa4Sa19LE6493aR3ibKMbxziFdOx0VpFeujvCwdOz13jSNIpZBuR+LMFrFFN8e0425mDQ=; 4:386dmugWLZ2O95OZ13trwll0DkyUwvPS0mugAKxgJtcpxWTgu3asXKvs+ZGoTDBRwl1ZxXxFTXWYWAhqzD92nMaACK4wHYArnPmA0ftY/ztABrqzjKt0yI2imPKNekqBg+wObi6EIwiOIyMToekQWuFSmCoHJ2CnY7PBIa5Y+dtRSaulAGQiMo0WbYoBhIasIz37QPggU3Hy76928neKsM/CiqMjzLjq6+qMM8TdAGDnoAUotpmLOOATuAim5F3CEV+gazhsM1Wus3X71lGPgl2r8AkNWRhASQcKTZHJlp347V4xzH3Oydt+xlw1M3mKDMvv1Zn05lQni/OkBvxJEkrkrVIcMbXlc4DYEA7Me2OISssqQaS4TUMzExsI4OPe1UPUi6jK9Jtzb0KTYCONJH71RtXvg7x7qIGPUIyIzN8= 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)(3002001)(93006095)(93001095)(10201501046)(3231023)(6055026)(6096035)(20161123565025)(20161123559100)(20161123561025)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123563025)(20161123556025)(201708071742011); SRVR:BN6PR03MB2690; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BN6PR03MB2690; X-Forefront-PRVS: 05299D545B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR03MB2690; 23:ndKTcNgIKeqTlAuIk3mTFqXI4L5mW/RZJ/vcRlDF9?= =?us-ascii?Q?r57qYs4XxX/NcXreQKCnNlYWJZUH0LlPWgzB33Wimde9LquR12SbiWYG6zfQ?= =?us-ascii?Q?o3Q5Ns3fUWR/gTggJpz8xf+DxhxaSZQ6p/MZKQM2tFxdRHaUv2PiHcAum1TK?= =?us-ascii?Q?28qCBW+VvhwFJ+mSCrylfrxbFAkyn6ErhAHZdTFYD3XdPZY/nrJW/M5vcdv4?= =?us-ascii?Q?A9h+ARUSXLmcJgnl3/Z/vPVArrH2iadFt4IoEH2H3/sq1p25bbDMpIfWY0uk?= =?us-ascii?Q?UPva3H8IDF39OCDWY4ZilAACBpURSAAkiJxSw55nyIT9PZz2Sx8w6jD4xRKp?= =?us-ascii?Q?fKqB59M7iNtFAC5jlg6LmNBjlurq8BZVWDSLqzYXfWPo2pVEHW71KLeC11AV?= =?us-ascii?Q?j/KEFxMR0cf2XmlGAcpjerHlARm+6wIAoJHqlXb4A1Hdlsje7z/zYvgBA41X?= =?us-ascii?Q?LL54LJjzXR9eoEvqVELFshJ+oldWu7jtijsXghZ2CUr/uSrKMv8KHT2g1wyq?= =?us-ascii?Q?fExz8g/8AkHmkmcztqCk6W0//BD/wpSLu4OAyYaLFnZLCdxurI8C+9IrRBPP?= =?us-ascii?Q?EQsXBCSOIqUNoBLqCKbIJs+pnOH04oE2pP9Fn0opQN6r05vPHt8D7YjarYZm?= =?us-ascii?Q?d46DudQSgovoVMQDipakLLnOUCSUiXZok6U6bvxxZzrLM7IMeXEwwU0bO779?= =?us-ascii?Q?2ZI7Z/ueMwQx+rhObuf+ZxzsTfovVXr3tY9mTmTFuLeYfeQN7wAveyIpuQKB?= =?us-ascii?Q?XRQkBfGVhgqWyLnrDtXtbDplD+QRkLJdEiwzYaatE4drKweDp0wN2kvMPmOv?= =?us-ascii?Q?v8tT8kzi75JBLCS7cXfMiTE2ksUN1nchfFpuO8tW9Z9JTJKJevq2qE8uR5q0?= =?us-ascii?Q?UNdoDH6pal0KZSg7kmN/UmUwwcK0LtZeqR46mgIOIFBay0RhgJ7HEskJ+eVp?= =?us-ascii?Q?6te4mBcv5eICGxVdZaHBv+gc/ATuhpSQhSKqfLV9rD63TjuWOI52sK17xzpa?= =?us-ascii?Q?xaEgXXmILm3o1/K8r+7botfxmPtDb70QP4fNNX37oWuc35ne1WYl7VccJ1GK?= =?us-ascii?Q?ipJ+AY9If1I/O8FwMtSonw2KCE9RQAm3lbDDb3jErZInqonuOj2Pj69wmfnG?= =?us-ascii?Q?cxF7jHGoJDORqbBP6PaZbp3V1B3M8B/cec3L9Fi+kHdz15m/Ps2Yw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2690; 6:W2kxCQ4Tn7uBC1wxOMf/ejh5Ur4HQdTRBfhul4ZKuSTJQ+rMP8Ax0hJg6KiJkr/NhXmL5g3/rghZ84q37JdsI94md1UKVsKAeUwh2aorJoK6xM2KMQU1vVRy3at0h/ru8TCUk9dFFY5p69EJKpE4Pq4NptLC2Ofm9ZnOLSRFy5UkCu9TNDXqq2Hbx1QXCOSZ1ZH0uFaM1urd5dorPBXjl1uLVtkGpurCz1aISIb0lhbXWVgAMtwrWvZuBLjScCzXsGQcIGMDt30xD2mDtD2G2/137UiVVOfihGPgWV6kZRn5fybnjpti+hPa/8okYniI2YAiuJrFw9s3bDIuKfZqak9mVJi0ZgMwEKwuwoA9USI=; 5:nyBa+Slee1g0/ckKB1oxPHi/jK7oSP2wVPDjTDoDi/jUerisc5vlzjACCMolcI2uQgIrDVZhVbLoSF7Q3BH6oFytl4VIGzmuX3MU9SMyZOJxD/xx8ARiUPaxw/alAmBZ2xc695ZlcFb+YXQNjJh864LTpeuqiogHI8lP26gfiqU=; 24:egtLzM6HUllM8jTs1ThYXJVK54sXuyaDm6WsQOWXCE4dCjF2GoXmpIQs59lbzKLQMJNfclLuKCzZzy7cnr4gizzicIWLDWjcHPppwLssNZA=; 7:6bJlOAcUGAwlsoPaShGexdCvpfn6Te7l641j6GVbkY9W6/K4Bku7a+sSRY6vCw80onAzOeOQv3CutsIxP3EPaShZth6UZiQU6EUg9SExyjFbSekw6xpPrSZzLAzBNyx2A2oEaIDXkMCkQTxEGUkdpyjv8j568BK07+6WCZzFN2f3m78nrc9/J0wdrjakByuj/uom4dQXA7/R6wWfkz1A3KKE5tzvkUuf+YO22d0QqwRZV4GX1qaV5Q4BkMMBaysb SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Dec 2017 15:17:26.8663 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d83997da-6023-45e1-67e5-08d5494f1c64 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: BN6PR03MB2690 Subject: [dpdk-dev] [PATCH v2 05/12] 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: Fri, 22 Dec 2017 15:17:44 -0000 Signed-off-by: Sunil Kumar Kori --- MAINTAINERS | 5 + drivers/event/Makefile | 1 + drivers/event/dpaa/Makefile | 37 +++ drivers/event/dpaa/dpaa_eventdev.c | 267 ++++++++++++++++++++++ drivers/event/dpaa/dpaa_eventdev.h | 81 +++++++ drivers/event/dpaa/rte_pmd_dpaa_event_version.map | 4 + 6 files changed, 395 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 f0baeb4..bf4d0da 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -692,6 +692,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 1f9c0ba..c726234 100644 --- a/drivers/event/Makefile +++ b/drivers/event/Makefile @@ -35,5 +35,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_EVENTDEV) += skeleton 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_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..c4c81c9 --- /dev/null +++ b/drivers/event/dpaa/dpaa_eventdev.c @@ -0,0 +1,267 @@ +/* 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; +} + +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: *; +}; -- 2.9.3