From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01hn0239.outbound.protection.outlook.com [104.47.1.239]) by dpdk.org (Postfix) with ESMTP id 07D2D34F3 for ; Wed, 2 May 2018 19:10:31 +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=DdUoPrzLyA9g5mkqD0amJV38q70XQ/RpxULoAGVy2tw=; b=l0UYaU1cRJFuG/kNtntxVOYCoUfj4KGu7kJ7YLu3rEgz9neBTdBogtJzL2sFIu2q1rBo748Tn7DHm921yIXGCOz1+VshZ73p6cJLg4aDVahL+k9xkbQVv6t9W3Rdu7XG3I1gI21YUDa8iXNoR4Yn2w6PQcWxXx+NKFIRKxmrWSQ= 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 VI1PR0401MB2431.eurprd04.prod.outlook.com (2603:10a6:800:2a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.13; Wed, 2 May 2018 17:10:28 +0000 From: Nipun Gupta To: thomas@monjalon.net, hemant.agrawal@nxp.com, shreyansh.jain@nxp.com Cc: dev@dpdk.org, Nipun Gupta Date: Wed, 2 May 2018 22:39:29 +0530 Message-Id: <1525280972-27736-6-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1525280972-27736-1-git-send-email-nipun.gupta@nxp.com> References: <1525168731-30912-1-git-send-email-nipun.gupta@nxp.com> <1525280972-27736-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: MAXPR0101CA0016.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:c::26) To VI1PR0401MB2431.eurprd04.prod.outlook.com (2603:10a6:800:2a::24) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0401MB2431; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2431; 3:tH2rrAw0Ugsj3+SP08NpF9jU44LyXWeQCsZAV+kMye1wZY/GV87uQL45rdPCbV+rZc9iqJS5Yofns2xxVMg30StdOwu4r/3DSYf1JsqKrReUrQsKcHLe8XARX0i3eFUf2Gqy7HqSVh1EXTMz2IBVDtuhM3t1gu+mYx12eVkuq5+9BCo+CdbyjXkg6tnxLAUkqP+zyVv2o9C8HP2piy6RqHOuteTXkzwdBVq1Z75oej8eVktLhrWP5/Xj60tSgn/3; 25:Hy/OzTMyWTnOSerJ9DKOB9owFKebXo0gp/TwUcq4ZboRuq2RJWnhnn871YkNM9hHbK3hVjhuyzgDMm5aAVlRMaHgFHtJ5aeXNm+uDW536qr++gO5JmRBmTvlp8JF2t6wKQAlmUjFMUap6xTyN1vKybxJ1WWPoc5qySdXSw/wzWtG+XW4wjKdHnXIoBump7dbKqX/gVHVvT5frSh4QPXYTcu9tZEbjZfUwYVZWJqBi9jq5yiwgjmVZt8DLPaKupjBUEoL+b6ynktzds6yuuUiLgSVDoUVMhQPi4YGDRSgKHBUdUMhPn6VNuvl59g7cvUZ9xOwHBDOiZTHKOB5mSH+Sg==; 31:8zqhVqgWephBg8F34aAv7wd00ysrsYD3m+y9AF1VAhhjbyA8DjKQ+CFLPNhhLxFgl0Oi+m4FPng2IKBvcPZF07GojLBhlFRJ316yhY23twa3qGEp+0a0K+X329uwkZutLa7DjceOzPZAlrTsS4cwZuCidckS3BIurEO3/DTqLtgFdBVcRqkZPJJQSvyE8ynCEF7eVNi/pPE81i+E68ohJroOsUJo4O9ziFi/SqB55iU= X-MS-TrafficTypeDiagnostic: VI1PR0401MB2431: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2431; 20:84oH1XOQA8Do1+aMwKtswfbEW5EqUECDQmZvAjaTyJipVvhjA7Q56vfiH9x6kUM+WYUJ3cfkOwFadl7N8a9r/Z/0sqK3xX5h3iPC5FtRPjFvWYppURZDVajOTlIBURQKEl+z0oK7VNtorXH4Fz3qz1gAQcfED/IsLmxGWXO4HbRyviB9DTQmZZhtoxicCI1WogtQqHBexiNV4vlzmskpzDWILslikZy8TH42LaLIdgX+eU7Z6dbbhRLB3PBIW/5+lnq5iNU37Rbemc/yTBbxJXeaDfAJaDkVtTh95oKxwjbd1NHGkHMxXab55FUbB+4PyW3DFdNHI9NB5OYQtZPU9S3abfoIKAjOsLHGwsUjCRMNT3xRKOpeP323z3lKP0SWzq1OcrpcN83T6cssHjkb0tUZXcHUG+mXwVvfIppV4qYr28v0Z8eJXAoJXL8dtk2QOLoCIRBPSf/g/FUY9PSzkNDtz5ggmoSRY6PCVCzwSMtFjrtnXx6n1JPeZpONQcPM; 4:PZlaOvqMDU1hgbhrGzXcBngK+nzJyI2QnFmjmmxdBfi+NcAaJ56Cq4Fff1B2pxRjlsYzFEzo37CbB18pS+5AkP0Uc34ajJyd0enf584ovHCP5Np6j9KkHef35NBoaOP3VL+TvysNDJlFzvL4e49tizWE19KzyFIeBPS/Jtk/rBPEdZ2LigAodVXdh8+sKjqK8Ir26aKHpJC8kwExMIFodoHUsdY8RwKhrdipc429sU6VPxlzqXxvL6Leyyc3EY805vONQmhPe2mt/8+IsQ4bv2R0pe0DjnPPoToEwXzP8S5xrrGrDu1IH2lU7Iv93lT6pnkjINUGKuzvdXX+MeaVv1CdjyzmZqvhNp6nGp4smOOqs9q34nMEXzzG06L76s1Y 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)(8121501046)(5005006)(10201501046)(3002001)(3231254)(2232076)(944501410)(52105095)(93006095)(93001095)(6055026)(6041310)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:VI1PR0401MB2431; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0401MB2431; X-Forefront-PRVS: 06607E485E X-Forefront-Antispam-Report: SFV:SPM; SFS:(10009020)(39860400002)(366004)(39380400002)(376002)(346002)(396003)(189003)(199004)(106356001)(2616005)(305945005)(6636002)(16526019)(50466002)(7736002)(5660300001)(48376002)(6486002)(25786009)(478600001)(53936002)(105586002)(97736004)(4326008)(59450400001)(44832011)(186003)(26005)(47776003)(8676002)(956004)(52116002)(81156014)(5009440100003)(51416003)(386003)(486006)(476003)(6512007)(2906002)(8936002)(3846002)(6506007)(68736007)(6116002)(66066001)(446003)(11346002)(76176011)(36756003)(16586007)(316002)(55236004)(86362001)(575784001)(81166006)(50226002)(59010400001); DIR:OUT; SFP:1501; SCL:5; SRVR:VI1PR0401MB2431; H:b27504-OptiPlex-790.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0401MB2431; 23:qZaA29PwawuMwy73396FDy2trQ/4wWhvSMYcAFo?= =?us-ascii?Q?CZfSEbA7iw4qXDlF2ZNI2mJvKJrWMYUXRSjDexgtLFlNIUDZ/7bg42AwbkGS?= =?us-ascii?Q?zxHZMZYAL2zQl2vE+it0dcRoLDO85+6U3fTr01rr9Zp928TADqez3zcZBuI2?= =?us-ascii?Q?c1b8zP7hYfesBMtVP4rey/IPvCtnnMHYgbfmbprYTEp489CRluhBrHD8wigi?= =?us-ascii?Q?qnAlUAqNhjJWz6Jjz/FGhYcmVg5QX93A3sNfaYmtaNQICn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+IqMb38vkjMWZON6I2kXUUqCgDeySJm8UlSPkPXxvl/es6KY7dfRVf3PjTRr3y5mVmqG7Wt0LYJ1fN0WHeSwpUxU01vsw+bDOXatYjrRa58WrlHL1AWy9yZvtfBV9R8nm+3jeRHW9vi6GoouNFGH9Lp0heYm5vbUWF1/Nj1wIl/60VfYAZon1t6bZqAfkTyXj6BL4MRjg8dzxi17G8pFNwvnqIUFHhj/8lXQ/ALiOXOMxRLbeJFFy2RG7DYEvq+D2z4hUvaCHiIuMvPfuMboeggxVdRmbb1/d3MEHM6ZDezabGoqCg+w4prcCxtnZ+FzK6y65oAskvwWetzZXK0RTniNEvQz4THk0zqdn; 5:4S8INlRrGVix8vBcnrrcSGbMemnFZC/O5p38KGJsCP+1hQKrb6OnlcB36KTP50sDJT7StUNDg0SKDBmykHZHWZI58fnCQf/Y0q/2RtRqEtHELXS880wZeuiXHhAlvvSoU23/82OsWyaCHmdSkE8jlU7DqIDQnHgoyR63G9k8d9w=; 24:N7eiFdeWxq8BnCN9u2Zm188PadGoTswbRay6XCnqHqMCrtYH8n9IL+Gd09mlsEJ6CtcpohGJM0RdLSdxSvBxKA== SpamDiagnosticOutput: 1:22 X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2431; 7:KuNM77E3xg07X7enHfMxPaTYJBYrfICSoD+WUZkHVDiWo8R7VzT0R4yVW75cNFInD9pyvAFV0XAprfomYd8f2ug1P34uPlW4eOofmWQKgkLz1Pp/JCixTR8A1ZD1/QoP3yXQJJBbFHb6JHJz2BKE982nsUFnAaHdyPfek+Dmx09Ot9xFnwiI/qqp1TVVmmx84zrqBwuD8tPAStX+B1jvvSmOYs13Rc9znNi4JzqmL+gEMeziFPha6QZsOC+/OJd3 X-MS-Office365-Filtering-Correlation-Id: a9f72bf0-567d-4b9e-8657-08d5b04f9b6e X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 May 2018 17:10:28.6284 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a9f72bf0-567d-4b9e-8657-08d5b04f9b6e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2431 Subject: [dpdk-dev] [PATCH v6 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: Wed, 02 May 2018 17:10:31 -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 | 34 +++ 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, 472 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 ce06e93..5ca021d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -805,6 +805,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..3b5a45a --- /dev/null +++ b/drivers/raw/dpaa2_qdma/Makefile @@ -0,0 +1,34 @@ +# 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_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..cf14c01 --- /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