From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03hn0228.outbound.protection.outlook.com [104.47.10.228]) by dpdk.org (Postfix) with ESMTP id 518172C23 for ; Thu, 3 May 2018 18:06:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=aARAjlqbQq7vHdi8kpRYYLC5G2p+AzoF6ZyJRtSyZKE=; b=yIB6CUB3vvhAm7f9dbj2M3JIk30Yl1XgTgosW5aUeuOH+OiZBF6CiASlrXM4cgUhP2P15tQne5D32XDQ47uqRTYuQb954y3FBo8QMCWp8w1n8ZbViJLfxsBJHkC+HakAJIk058Sx/PO6cYGtoG3psR5KF4NZjwY+PhaG8vVhdL0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=nipun.gupta@nxp.com; Received: from b27504-OptiPlex-790.ap.freescale.net (14.142.187.166) by HE1PR0401MB2427.eurprd04.prod.outlook.com (2603:10a6:3:25::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.715.23; Thu, 3 May 2018 16:06:48 +0000 From: Nipun Gupta To: thomas@monjalon.net, hemant.agrawal@nxp.com, shreyansh.jain@nxp.com Cc: dev@dpdk.org, Nipun Gupta Date: Thu, 3 May 2018 21:36:07 +0530 Message-Id: <1525363570-23542-6-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1525363570-23542-1-git-send-email-nipun.gupta@nxp.com> References: <1525280972-27736-1-git-send-email-nipun.gupta@nxp.com> <1525363570-23542-1-git-send-email-nipun.gupta@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: MA1PR01CA0105.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::21) To HE1PR0401MB2427.eurprd04.prod.outlook.com (2603:10a6:3:25::24) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(2017052603328)(7153060)(7193020); SRVR:HE1PR0401MB2427; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0401MB2427; 3:fomflIrrdYYE5tnxp3MVCgIue70xc/OizUq1Y4CehTJw3U2bO1CdoqPGAUjKB88qx9gomgsZJNtJCQ7gUeUvFcLLoYKhowXz2FnpwuD4g4foFBagGPvmA9Ce1pEo1QGQmfqeuTpgVaGGRizcMdTCT5hBMohjbvZtDgubeySk3PJFrZElFtzb0KS8VQb4ed7o7UA9jUlTV0MLV992fVO+MhUIiJQ1IFse7EDcUWYUNksGTs8uLF57ZopnvA4W8QFc; 25:Pb5z6mlJ7srCjGPn+GkC+u+LHudV0iwGR51Bhrux+b6SPBD5FJ+iiNJ8M0IH7Wi26j1Mdu+Ak1cVy/CF0/gihfJcj3ZnPX1pNZnRSzlIMJeqf5+EzMRelHPfNmCgg06Y+ZN6eNdNy9kxeM3uiwhTMPfZEL1K8iMiHRWF5Q8lbUxyt1V38i3ajFFxEjS1QS2TiHWjO0yqxdMBR9p0rk+KfqPlt5VsezeTMHMUrgko6SaUBmQPi6DB/hJs2T/0Di8AzoIvtbxTDIQtzhHvHqkuFHmHSHswIgQ9U3ihKwAvbeQ9fJJbAAbvV2wzVY5RfkHKSm+L+w2tEB/uI7ddsnvbRg==; 31:xkmhRm8mym9eMHeOlt856YCpxkGGJ4AxF20uiAGtjM5Cx1Kcz8F3R5hzmddVv/HYJnyQDevs4PDh7pHTOgrOnbkDWVrQdQFGtQt88hu2uQcphdJ9N0LLmtk4xIMDQlFkf6+K1HbYFmrvnYQMHZ/9096TcUkLBlNdMxiIVHjHIyrySf5YYjai7v8OpVSRKlKrZivsYSRj7McAGQMiiSbBSRbIYvrsN22l5z1G1ALKrIc= X-MS-TrafficTypeDiagnostic: HE1PR0401MB2427: X-Microsoft-Exchange-Diagnostics: 1; HE1PR0401MB2427; 20:BTjur5BTF3JRBdp7lWPL9yG60uL4VogEVemhX5S3jWBLYyujJymnL6v/nt6E3uJBiGhW18E3XOTaETencI6vo3v8GkQ6RB/xgAv4Myka+qR/cbU3ciZHruyebJY161eGl4y7acfnDck/IKSqdYCNktj78AcPkPmzPpu8edW4IF8mAoAs1pDeEfvq3avuHL+syiB1tBDpbEBeM9tSeq72lo2HH6JBHvH4Td1zY61OiQyV/ljnqZWRUvk6NcUAG87q75J8Bw2J2tG8oUSwrrNJVtA0Q35ZHIt7mmxrufdgKxbK/ylRX7cQtTtfvJs7EqlsNRraH3L63KnhqkG4vWX746oHr6MQFTaN9jmQGdyQPhLZMOSvgnViR+FjgarDfPE5vdqSqxWwINpGkbvJrwd1UrN00eN9gzdaW2YripYHOyMugt2FAL1X620EbOynev5YhJ08vuEeNdb5W4g5G/J/fpy4eoVVrRVVW5JqJRgIs2tmQ52vkSDmNqBY7PFi16JT; 4:0pJ6cJaq/51YF6ExBuQ2OchvWIPw3rarY6TmPoSHRpPCP3V+F58cItk0kbtpYoTueDtl5aQiRWPHqSoQoxeJKv+fDXi17oC5EE4IXnVhMqS9gGH6c9C1JXJOP262g+naDPF4w5SlO5fmnwVyRm7ssoyu4D0y7xoA78g0IISflM6BtjK9+ftJpPbbkMkH48/yNu/XTyVURv7hl1g/UHrcT+rSRdDDCpNbllGDNUjfQJB0DHK5TXleW68yZ89mlWcmu3X9CknwzpBc9Vcoo8a5LblKX7M49ZYUvwI2UyjuJMogF93RWKE6nVkPXqPJo0bsmYawPWuHD+YqRLvBspAd+WtKRV/NtHCmlDuFb7mQN1ajWVLVCTQZjm3ttjiWgEoK X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(66839620246622)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231254)(2232076)(944501410)(52105095)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:HE1PR0401MB2427; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0401MB2427; X-Forefront-PRVS: 066153096A X-Forefront-Antispam-Report: SFV:SPM; SFS:(10009020)(366004)(376002)(39380400002)(39860400002)(346002)(396003)(199004)(189003)(5660300001)(26005)(186003)(47776003)(16526019)(6506007)(386003)(51416003)(55236004)(52116002)(2906002)(50226002)(59450400001)(97736004)(486006)(105586002)(25786009)(44832011)(106356001)(575784001)(76176011)(81156014)(86362001)(68736007)(36756003)(6636002)(6512007)(2616005)(11346002)(53936002)(956004)(50466002)(7736002)(81166006)(8676002)(16586007)(6116002)(478600001)(446003)(5009440100003)(48376002)(6666003)(316002)(476003)(3846002)(305945005)(4326008)(66066001)(8936002)(6486002)(59010400001); DIR:OUT; SFP:1501; SCL:5; SRVR:HE1PR0401MB2427; H:b27504-OptiPlex-790.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0401MB2427; 23:HIgYbAqN13YOrodiJ9zQoD/YgtN6n8MV2aVJ1aP?= =?us-ascii?Q?6Nc7djvCEPmOmWeFuVLWPXERCAbWd0ebGb6OCGyEac446lwRtMg2jj0g/S35?= =?us-ascii?Q?wQFhj4tn8baYLcmTelXcPU49rfx7UD0FNZBcytgwYzXVq4t1JBVOYvl2ePeF?= =?us-ascii?Q?bOnoUWdYVGf4nIQxXt9ASnGdBklABvLdJIjOtmyfLwSfdqd5w35wIJGKvWlD?= =?us-ascii?Q?IasGO/XTJLC6pr2lEhshffABH+c4tsIj+XtUcMc0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4ygC398uRkaR+RAiKykU797UgKpk5fRi8/OnzkFAsbvtylhxtDD9FSt4hHfv9iK82kHYJElVZznfNeo/n/rQi9+YSOx9DJwGHOBgh1Mx2ObPc2OdTLSMGgMfqMbwH0SbnKJn9OPIPfAA67R4WajEFn9YFnPQ2Tdy2KlyC6gPGLwx/SKi11yER5usZD+cpAsNE5s8TQg4RCb14pA0cki5B3SotHQpbu5+b+Iecdt6t4CtMwNtyjn0lyf31hqrhabGeVAaH+yEyvCmbnZvrMaIefo1ZfBIlFkC/F10Uz+Lj6FHIZcOxxoPMjPJtMfDt41tO535YP1A0Gw+qdx8A4CAoYGEdviB7bBXNB5DZ; 5:nzb8c0ckQKam1baKYQZEuGbeNp1buSjznntztaxDekPtXkCDl6haUMF6EmCJRwjIZeUwyxVb2oxcLoong6Rzp8Gt/Th8wJLg2cSSx6jkAN1ISXAN5U8d2Dr8bosi/fr5H0dF8fbTC+6Gr9iuhIQZKLGGVIVtocu6pOQWZmBHOgc=; 24:V408ivBxRuz8q3Ymw3M7owesPYRY5wDKSLrz4B1L7bGdbB293Hfu8THxVqOjHLISBX9+/S+LaV6o/rmMlaqBgg== SpamDiagnosticOutput: 1:22 X-Microsoft-Exchange-Diagnostics: 1; HE1PR0401MB2427; 7:vXwWG/wo3xQ9uHr6YBs71T5KuthyJZSIq3uyLOCAhPEX9W6IZs4LtOspLBJ+WD9Hl+/1JvcwdDe8jkGaQX0j+r/cR6EwV/l7/86FsSQrWUkCcoVw7oRqz3gvDAY/m81EDm7N0Q5qBkxK8Pu8Dhcmkznm6FE88MK6iEBUAV+m4FDbMRInkp1EDoFZuH9U6jN7qlciDtagPydgEMVbFBkNn0AqR4qV0O+vRYGN7P4ng4on+Fn3U462DFHV3zq743v5 X-MS-Office365-Filtering-Correlation-Id: 4c9f9ddc-ce1f-4754-653b-08d5b10fe0f3 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2018 16:06:48.4310 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4c9f9ddc-ce1f-4754-653b-08d5b10fe0f3 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0401MB2427 Subject: [dpdk-dev] [PATCH RESEND v7 5/8] raw/dpaa2_qdma: introduce the DPAA2 QDMA driver 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: Thu, 03 May 2018 16:06:51 -0000 DPAA2 QDMA driver uses MC DPDMAI object. This driver enables the user (app) to perform data DMA without involving CPU in the DMA process Signed-off-by: Nipun Gupta Acked-by: Shreyansh Jain --- MAINTAINERS | 8 + config/common_base | 5 + config/common_linuxapp | 1 + drivers/raw/Makefile | 3 + drivers/raw/dpaa2_qdma/Makefile | 35 +++ drivers/raw/dpaa2_qdma/dpaa2_qdma.c | 294 +++++++++++++++++++++ drivers/raw/dpaa2_qdma/dpaa2_qdma.h | 66 +++++ drivers/raw/dpaa2_qdma/dpaa2_qdma_logs.h | 46 ++++ drivers/raw/dpaa2_qdma/meson.build | 7 + .../raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map | 4 + drivers/raw/meson.build | 2 +- mk/rte.app.mk | 3 + 12 files changed, 473 insertions(+), 1 deletion(-) create mode 100644 drivers/raw/dpaa2_qdma/Makefile create mode 100644 drivers/raw/dpaa2_qdma/dpaa2_qdma.c create mode 100644 drivers/raw/dpaa2_qdma/dpaa2_qdma.h create mode 100644 drivers/raw/dpaa2_qdma/dpaa2_qdma_logs.h create mode 100644 drivers/raw/dpaa2_qdma/meson.build create mode 100644 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map diff --git a/MAINTAINERS b/MAINTAINERS index a482470..f8017d3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -802,6 +802,14 @@ F: doc/guides/cryptodevs/zuc.rst F: doc/guides/cryptodevs/features/zuc.ini +Rawdev Drivers +-------------- + +NXP DPAA2 QDMA +M: Nipun Gupta +F: drivers/raw/dpaa2_qdma/ + + Eventdev Drivers ---------------- M: Jerin Jacob diff --git a/config/common_base b/config/common_base index 03a8688..9b48bcb 100644 --- a/config/common_base +++ b/config/common_base @@ -618,6 +618,11 @@ CONFIG_RTE_RAWDEV_MAX_DEVS=10 CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV=y # +# Compile PMD for NXP DPAA2 QDMA raw device +# +CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=n + +# # Compile librte_ring # CONFIG_RTE_LIBRTE_RING=y diff --git a/config/common_linuxapp b/config/common_linuxapp index 14e56cb..21b3fe3 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -38,3 +38,4 @@ CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL=y CONFIG_RTE_LIBRTE_DPAA2_PMD=y CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV=y CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC=y +CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=y diff --git a/drivers/raw/Makefile b/drivers/raw/Makefile index da7c8b4..0f2b076 100644 --- a/drivers/raw/Makefile +++ b/drivers/raw/Makefile @@ -5,5 +5,8 @@ include $(RTE_SDK)/mk/rte.vars.mk # DIRS-$() += DIRS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV) += skeleton_rawdev +ifeq ($(CONFIG_RTE_EAL_VFIO)$(CONFIG_RTE_LIBRTE_FSLMC_BUS),yy) +DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += dpaa2_qdma +endif include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/raw/dpaa2_qdma/Makefile b/drivers/raw/dpaa2_qdma/Makefile new file mode 100644 index 0000000..68c785a --- /dev/null +++ b/drivers/raw/dpaa2_qdma/Makefile @@ -0,0 +1,35 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018 NXP + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_dpaa2_qdma.a + +CFLAGS += -DALLOW_EXPERIMENTAL_API +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) + +CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal +CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc +CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/qbman/include + +LDLIBS += -lrte_bus_fslmc +LDLIBS += -lrte_eal +LDLIBS += -lrte_mempool +LDLIBS += -lrte_mempool_dpaa2 +LDLIBS += -lrte_rawdev +LDLIBS += -lrte_ring + +EXPORT_MAP := rte_pmd_dpaa2_qdma_version.map + +LIBABIVER := 1 + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += dpaa2_qdma.c + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c new file mode 100644 index 0000000..9288350 --- /dev/null +++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c @@ -0,0 +1,294 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "dpaa2_qdma.h" +#include "dpaa2_qdma_logs.h" + +/* Dynamic log type identifier */ +int dpaa2_qdma_logtype; + +/* QDMA device */ +static struct qdma_device qdma_dev; + +/* QDMA H/W queues list */ +TAILQ_HEAD(qdma_hw_queue_list, qdma_hw_queue); +static struct qdma_hw_queue_list qdma_queue_list + = TAILQ_HEAD_INITIALIZER(qdma_queue_list); + +static const struct rte_rawdev_ops dpaa2_qdma_ops; + +static int +add_hw_queues_to_list(struct dpaa2_dpdmai_dev *dpdmai_dev) +{ + struct qdma_hw_queue *queue; + int i; + + DPAA2_QDMA_FUNC_TRACE(); + + for (i = 0; i < dpdmai_dev->num_queues; i++) { + queue = rte_zmalloc(NULL, sizeof(struct qdma_hw_queue), 0); + if (!queue) { + DPAA2_QDMA_ERR( + "Memory allocation failed for QDMA queue"); + return -ENOMEM; + } + + queue->dpdmai_dev = dpdmai_dev; + queue->queue_id = i; + + TAILQ_INSERT_TAIL(&qdma_queue_list, queue, next); + qdma_dev.num_hw_queues++; + } + + return 0; +} + +static void +remove_hw_queues_from_list(struct dpaa2_dpdmai_dev *dpdmai_dev) +{ + struct qdma_hw_queue *queue = NULL; + struct qdma_hw_queue *tqueue = NULL; + + DPAA2_QDMA_FUNC_TRACE(); + + TAILQ_FOREACH_SAFE(queue, &qdma_queue_list, next, tqueue) { + if (queue->dpdmai_dev == dpdmai_dev) { + TAILQ_REMOVE(&qdma_queue_list, queue, next); + rte_free(queue); + queue = NULL; + } + } +} + +static int +dpaa2_dpdmai_dev_uninit(struct rte_rawdev *rawdev) +{ + struct dpaa2_dpdmai_dev *dpdmai_dev = rawdev->dev_private; + int ret, i; + + DPAA2_QDMA_FUNC_TRACE(); + + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + + /* Remove HW queues from global list */ + remove_hw_queues_from_list(dpdmai_dev); + + ret = dpdmai_disable(&dpdmai_dev->dpdmai, CMD_PRI_LOW, + dpdmai_dev->token); + if (ret) + DPAA2_QDMA_ERR("dmdmai disable failed"); + + /* Set up the DQRR storage for Rx */ + for (i = 0; i < DPDMAI_PRIO_NUM; i++) { + struct dpaa2_queue *rxq = &(dpdmai_dev->rx_queue[i]); + + if (rxq->q_storage) { + dpaa2_free_dq_storage(rxq->q_storage); + rte_free(rxq->q_storage); + } + } + + /* Close the device at underlying layer*/ + ret = dpdmai_close(&dpdmai_dev->dpdmai, CMD_PRI_LOW, dpdmai_dev->token); + if (ret) + DPAA2_QDMA_ERR("Failure closing dpdmai device"); + + return 0; +} + +static int +dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id) +{ + struct dpaa2_dpdmai_dev *dpdmai_dev = rawdev->dev_private; + struct dpdmai_rx_queue_cfg rx_queue_cfg; + struct dpdmai_attr attr; + struct dpdmai_rx_queue_attr rx_attr; + struct dpdmai_tx_queue_attr tx_attr; + int ret, i; + + DPAA2_QDMA_FUNC_TRACE(); + + /* For secondary processes, the primary has done all the work */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + + /* Open DPDMAI device */ + dpdmai_dev->dpdmai_id = dpdmai_id; + dpdmai_dev->dpdmai.regs = rte_mcp_ptr_list[MC_PORTAL_INDEX]; + ret = dpdmai_open(&dpdmai_dev->dpdmai, CMD_PRI_LOW, + dpdmai_dev->dpdmai_id, &dpdmai_dev->token); + if (ret) { + DPAA2_QDMA_ERR("dpdmai_open() failed with err: %d", ret); + return ret; + } + + /* Get DPDMAI attributes */ + ret = dpdmai_get_attributes(&dpdmai_dev->dpdmai, CMD_PRI_LOW, + dpdmai_dev->token, &attr); + if (ret) { + DPAA2_QDMA_ERR("dpdmai get attributes failed with err: %d", + ret); + goto init_err; + } + dpdmai_dev->num_queues = attr.num_of_priorities; + + /* Set up Rx Queues */ + for (i = 0; i < attr.num_of_priorities; i++) { + struct dpaa2_queue *rxq; + + memset(&rx_queue_cfg, 0, sizeof(struct dpdmai_rx_queue_cfg)); + ret = dpdmai_set_rx_queue(&dpdmai_dev->dpdmai, + CMD_PRI_LOW, + dpdmai_dev->token, + i, &rx_queue_cfg); + if (ret) { + DPAA2_QDMA_ERR("Setting Rx queue failed with err: %d", + ret); + goto init_err; + } + + /* Allocate DQ storage for the DPDMAI Rx queues */ + rxq = &(dpdmai_dev->rx_queue[i]); + rxq->q_storage = rte_malloc("dq_storage", + sizeof(struct queue_storage_info_t), + RTE_CACHE_LINE_SIZE); + if (!rxq->q_storage) { + DPAA2_QDMA_ERR("q_storage allocation failed"); + ret = -ENOMEM; + goto init_err; + } + + memset(rxq->q_storage, 0, sizeof(struct queue_storage_info_t)); + ret = dpaa2_alloc_dq_storage(rxq->q_storage); + if (ret) { + DPAA2_QDMA_ERR("dpaa2_alloc_dq_storage failed"); + goto init_err; + } + } + + /* Get Rx and Tx queues FQID's */ + for (i = 0; i < DPDMAI_PRIO_NUM; i++) { + ret = dpdmai_get_rx_queue(&dpdmai_dev->dpdmai, CMD_PRI_LOW, + dpdmai_dev->token, i, &rx_attr); + if (ret) { + DPAA2_QDMA_ERR("Reading device failed with err: %d", + ret); + goto init_err; + } + dpdmai_dev->rx_queue[i].fqid = rx_attr.fqid; + + ret = dpdmai_get_tx_queue(&dpdmai_dev->dpdmai, CMD_PRI_LOW, + dpdmai_dev->token, i, &tx_attr); + if (ret) { + DPAA2_QDMA_ERR("Reading device failed with err: %d", + ret); + goto init_err; + } + dpdmai_dev->tx_queue[i].fqid = tx_attr.fqid; + } + + /* Enable the device */ + ret = dpdmai_enable(&dpdmai_dev->dpdmai, CMD_PRI_LOW, + dpdmai_dev->token); + if (ret) { + DPAA2_QDMA_ERR("Enabling device failed with err: %d", ret); + goto init_err; + } + + /* Add the HW queue to the global list */ + ret = add_hw_queues_to_list(dpdmai_dev); + if (ret) { + DPAA2_QDMA_ERR("Adding H/W queue to list failed"); + goto init_err; + } + DPAA2_QDMA_DEBUG("Initialized dpdmai object successfully"); + + return 0; +init_err: + dpaa2_dpdmai_dev_uninit(rawdev); + return ret; +} + +static int +rte_dpaa2_qdma_probe(struct rte_dpaa2_driver *dpaa2_drv, + struct rte_dpaa2_device *dpaa2_dev) +{ + struct rte_rawdev *rawdev; + int ret; + + DPAA2_QDMA_FUNC_TRACE(); + + rawdev = rte_rawdev_pmd_allocate(dpaa2_dev->device.name, + sizeof(struct dpaa2_dpdmai_dev), + rte_socket_id()); + if (!rawdev) { + DPAA2_QDMA_ERR("Unable to allocate rawdevice"); + return -EINVAL; + } + + dpaa2_dev->rawdev = rawdev; + rawdev->dev_ops = &dpaa2_qdma_ops; + rawdev->device = &dpaa2_dev->device; + rawdev->driver_name = dpaa2_drv->driver.name; + + /* Invoke PMD device initialization function */ + ret = dpaa2_dpdmai_dev_init(rawdev, dpaa2_dev->object_id); + if (ret) { + rte_rawdev_pmd_release(rawdev); + return ret; + } + + return 0; +} + +static int +rte_dpaa2_qdma_remove(struct rte_dpaa2_device *dpaa2_dev) +{ + struct rte_rawdev *rawdev = dpaa2_dev->rawdev; + int ret; + + DPAA2_QDMA_FUNC_TRACE(); + + dpaa2_dpdmai_dev_uninit(rawdev); + + ret = rte_rawdev_pmd_release(rawdev); + if (ret) + DPAA2_QDMA_ERR("Device cleanup failed"); + + return 0; +} + +static struct rte_dpaa2_driver rte_dpaa2_qdma_pmd = { + .drv_type = DPAA2_QDMA, + .probe = rte_dpaa2_qdma_probe, + .remove = rte_dpaa2_qdma_remove, +}; + +RTE_PMD_REGISTER_DPAA2(dpaa2_qdma, rte_dpaa2_qdma_pmd); + +RTE_INIT(dpaa2_qdma_init_log); +static void +dpaa2_qdma_init_log(void) +{ + dpaa2_qdma_logtype = rte_log_register("pmd.raw.dpaa2.qdma"); + if (dpaa2_qdma_logtype >= 0) + rte_log_set_level(dpaa2_qdma_logtype, RTE_LOG_INFO); +} diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/dpaa2_qdma.h new file mode 100644 index 0000000..8b3b1b9 --- /dev/null +++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.h @@ -0,0 +1,66 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#ifndef __DPAA2_QDMA_H__ +#define __DPAA2_QDMA_H__ + +/** + * Represents a QDMA device. + * A single QDMA device exists which is combination of multiple DPDMAI rawdev's. + */ +struct qdma_device { + /** total number of hw queues. */ + uint16_t num_hw_queues; + /** + * Maximum number of hw queues to be alocated per core. + * This is limited by MAX_HW_QUEUE_PER_CORE + */ + uint16_t max_hw_queues_per_core; + /** Maximum number of VQ's */ + uint16_t max_vqs; + /** mode of operation - physical(h/w) or virtual */ + uint8_t mode; + /** Device state - started or stopped */ + uint8_t state; + /** FLE pool for the device */ + struct rte_mempool *fle_pool; + /** FLE pool size */ + int fle_pool_count; + /** A lock to QDMA device whenever required */ + rte_spinlock_t lock; +}; + +/** Represents a QDMA H/W queue */ +struct qdma_hw_queue { + /** Pointer to Next instance */ + TAILQ_ENTRY(qdma_hw_queue) next; + /** DPDMAI device to communicate with HW */ + struct dpaa2_dpdmai_dev *dpdmai_dev; + /** queue ID to communicate with HW */ + uint16_t queue_id; + /** Associated lcore id */ + uint32_t lcore_id; + /** Number of users of this hw queue */ + uint32_t num_users; +}; + +/** Represents a DPDMAI raw device */ +struct dpaa2_dpdmai_dev { + /** Pointer to Next device instance */ + TAILQ_ENTRY(dpaa2_qdma_device) next; + /** handle to DPDMAI object */ + struct fsl_mc_io dpdmai; + /** HW ID for DPDMAI object */ + uint32_t dpdmai_id; + /** Tocken of this device */ + uint16_t token; + /** Number of queue in this DPDMAI device */ + uint8_t num_queues; + /** RX queues */ + struct dpaa2_queue rx_queue[DPDMAI_PRIO_NUM]; + /** TX queues */ + struct dpaa2_queue tx_queue[DPDMAI_PRIO_NUM]; +}; + +#endif /* __DPAA2_QDMA_H__ */ diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma_logs.h b/drivers/raw/dpaa2_qdma/dpaa2_qdma_logs.h new file mode 100644 index 0000000..fafe352 --- /dev/null +++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma_logs.h @@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#ifndef __DPAA2_QDMA_LOGS_H__ +#define __DPAA2_QDMA_LOGS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int dpaa2_qdma_logtype; + +#define DPAA2_QDMA_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, dpaa2_qdma_logtype, "dpaa2_qdma: " \ + fmt "\n", ## args) + +#define DPAA2_QDMA_DEBUG(fmt, args...) \ + rte_log(RTE_LOG_DEBUG, dpaa2_qdma_logtype, "dpaa2_qdma: %s(): " \ + fmt "\n", __func__, ## args) + +#define DPAA2_QDMA_FUNC_TRACE() DPAA2_QDMA_LOG(DEBUG, ">>") + +#define DPAA2_QDMA_INFO(fmt, args...) \ + DPAA2_QDMA_LOG(INFO, fmt, ## args) +#define DPAA2_QDMA_ERR(fmt, args...) \ + DPAA2_QDMA_LOG(ERR, fmt, ## args) +#define DPAA2_QDMA_WARN(fmt, args...) \ + DPAA2_QDMA_LOG(WARNING, fmt, ## args) + +/* DP Logs, toggled out at compile time if level lower than current level */ +#define DPAA2_QDMA_DP_LOG(level, fmt, args...) \ + RTE_LOG_DP(level, PMD, "dpaa2_qdma: " fmt "\n", ## args) + +#define DPAA2_QDMA_DP_DEBUG(fmt, args...) \ + DPAA2_QDMA_DP_LOG(DEBUG, fmt, ## args) +#define DPAA2_QDMA_DP_INFO(fmt, args...) \ + DPAA2_QDMA_DP_LOG(INFO, fmt, ## args) +#define DPAA2_QDMA_DP_WARN(fmt, args...) \ + DPAA2_QDMA_DP_LOG(WARNING, fmt, ## args) + +#ifdef __cplusplus +} +#endif + +#endif /* __DPAA2_QDMA_LOGS_H__ */ diff --git a/drivers/raw/dpaa2_qdma/meson.build b/drivers/raw/dpaa2_qdma/meson.build new file mode 100644 index 0000000..b747500 --- /dev/null +++ b/drivers/raw/dpaa2_qdma/meson.build @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018 NXP + +deps += ['rawdev', 'mempool_dpaa2', 'ring'] +sources = files('dpaa2_qdma.c') + +allow_experimental_apis = true diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map new file mode 100644 index 0000000..33d2379 --- /dev/null +++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map @@ -0,0 +1,4 @@ +EXPERIMENTAL { + + local: *; +}; diff --git a/drivers/raw/meson.build b/drivers/raw/meson.build index 24c82ff..1b298f8 100644 --- a/drivers/raw/meson.build +++ b/drivers/raw/meson.build @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright 2018 NXP -drivers = ['skeleton_rawdev'] +drivers = ['skeleton_rawdev', 'dpaa2_qdma'] std_deps = ['rawdev'] config_flag_fmt = 'RTE_LIBRTE_PMD_@0@_RAWDEV' driver_name_fmt = 'rte_pmd_@0@' diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 29a2a60..26a6b0c 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -251,6 +251,9 @@ endif # CONFIG_RTE_LIBRTE_EVENTDEV ifeq ($(CONFIG_RTE_LIBRTE_RAWDEV),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV) += -lrte_pmd_skeleton_rawdev +ifeq ($(CONFIG_RTE_EAL_VFIO)$(CONFIG_RTE_LIBRTE_FSLMC_BUS),yy) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += -lrte_pmd_dpaa2_qdma +endif # CONFIG_RTE_LIBRTE_FSLMC_BUS endif # CONFIG_RTE_LIBRTE_RAWDEV -- 1.9.1