From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01hn0233.outbound.protection.outlook.com [104.47.0.233]) by dpdk.org (Postfix) with ESMTP id 8DB29397D for ; Thu, 3 May 2018 17:52:41 +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=6z3FaEtw+Kn1+sj65+R2D0q763S1zCGHpca1eum3ZEo=; b=bCUHQvnAY6iKUNNmjK9Xmkhx1AiYdzpexaVJPplpMegnSe3wAsCmH6JWK60qtE1EWrOw0mKlvFlB4YMqDJA7bI1ECVeiRMwcH7iMWBKp4W/oD4eVd4D8odUI+alU6e+xQAq6+t+4y8o2zXNU3UKThP4vEqp7mmDOXq32EowZIJw= 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 VI1PR0401MB2429.eurprd04.prod.outlook.com (2603:10a6:800:2a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.715.24; Thu, 3 May 2018 15:52:38 +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:21:59 +0530 Message-Id: <1525362722-32726-6-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1525362722-32726-1-git-send-email-nipun.gupta@nxp.com> References: <1525280972-27736-1-git-send-email-nipun.gupta@nxp.com> <1525362722-32726-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: MA1PR0101CA0046.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::32) To VI1PR0401MB2429.eurprd04.prod.outlook.com (2603:10a6:800:2a::22) 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:VI1PR0401MB2429; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2429; 3:9uxfl/fmAXnyswsks93cdOt3tqPcHfJLRHA0Xr2ylXB2TKfwRu0GJlZ/mnbfL3ccc8TSoQt86DHY+KJUWPy6jktJL52317180r8rXsCQx/0lO1lN4fZssVeWGtWyPTnPpVIr/FQGRdYtH2wLnPHcQ9kXTnrXEIBzEpZaOcgjG3+unNOiYbVYVnJqaytL9IxKNYyMIYYH+XREtMuIS7EzeJ92M7EiFtpDoxnGHETrwWRcPfZ6TbIboq+2C8hLS0jm; 25:KQd6SIOMUa1CphkhO0CVf7LfTppPkEi9pnVQiJjr5tenvRfsZy879c0QmruQr9+UgArsngCh5IbyhxVlkQEQW21R/pom6p46WRX1GE0AwuSlMU+jQdtN802pdZF42KrnMAv6qyCEmO4UtqkRiU9SUvqF+CLp4vHFV0mcEdPPQ3GJSzVvu71mKOPk36pFd4YzCjg3+sKji+JHXkkESlp19xrOjxgn9nE+yAqp0NS54J7jgFJd1BLAwZzDfvqgAf9QJMlIh2MaxAGvfwIZowi7G5h+LBfKvr0Tz1yKhPvBNbU6iA7D621G3t5Di9HRwEKg4KuRzTGZYtbB8GKP8GRkRA==; 31:UG6NXaU5oOdHyBOCl+Q4K2xdJdAQ3YQNqvLCarJSp/EMnZCqzLrpIzPOe5gAJnJKxZQamdEV6i4KTBzrGF4/qkx6QovNdBjP1X/b7wSB6Uqcv5C8RZca/f06V5rMf2NJO+hfdgcfytGoTFljr3e7FLb3WHJyYq4vDe9fUoyvmk8/vKyOCvBLRaOD9I3zxDauFrlXOn3Z2kHz6n6/ZitvobXJJQjUWdwdLt9R6KEo5uQ= X-MS-TrafficTypeDiagnostic: VI1PR0401MB2429: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2429; 20:39yEmuORGIQLbhmO83WLeKOVnnRHvQqD7zlX4lhmi3S7PNKL7vpvL0IQ0L80ckzG72l8BEuxMKp5aixV8sucyakxu2SzwwIWrmosmm3I4Ddx495lbAgBAg+uWFI2fJ3A9hNh1LTAtZ913BpzqUfbYM6R0auQbvDr4S5CR3DRDwv16Ip680d705xNP0VCcto7KzWx05hq+Rh6an7l7T2qXwVK/bMjAitkalKAeFhFyrR2WWq4lOuLpGEZKQK+O2d3Hb+uJucV+cIygYy6XwW4nLxP/z2kcR9ilQpmVz4ntTo6VYaUkQsLLkjxWEKXk1oIATwN8hqYqycQeqLFs5XJieluZia/Rj0jP5PYjnqrfsUzCCi6NXjLBwwLuEVju3eEU9EyiUSAsmARN9WaAtz8QyHpD9P7Mkid2BuRR4Oq0G6aU0zTZdxujN1zLL55ZgOs6u+RHfC72crTmvbMOP0jsK4IZW01bVOaEQdQbOSZ3xWIbkNKDxGXJbY/i6yX0unb; 4:E9/BYfYGjaqrWJ9CGjO2O0npHwa0lZdadixTOAgyg+RMVy1b3SGVBbw3r/l3WhnKLcJV4OFvFonPZJV5aHZbOysmasuKNf3xNecOAdrWea5h0tdCN6aD6vrGKzNnnxpBPv/Z0DpH2sJ3FYdg5kB6dxXrZMyokrgmbNb2x+dfFtnQ0R0EbW4aX4x8XgbMMCvKNWiqlqkpMwGby07oXFDG98QFrFq8wxglmluBOESWCSEPFMayJkUobSB2BCBl/a6Trd44s1wS8UV9ELOFHXvnDxf3O1d2u3bJdRjYkB8ShAM9bI2jspuP26b+x6jxytmlecNGQ3w1HO8gQMCMKqdw6dXW2dy+KeZ6xfSCXDj5xwtCGY3tjxg4vzCEFxkfFBWU 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)(10201501046)(93006095)(93001095)(3231254)(2232076)(944501410)(52105095)(3002001)(6055026)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:VI1PR0401MB2429; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0401MB2429; X-Forefront-PRVS: 066153096A X-Forefront-Antispam-Report: SFV:SPM; SFS:(10009020)(376002)(366004)(396003)(39380400002)(346002)(39860400002)(199004)(189003)(6666003)(50466002)(6636002)(4326008)(68736007)(6512007)(5009440100003)(25786009)(97736004)(6486002)(36756003)(106356001)(105586002)(2906002)(81166006)(6506007)(316002)(386003)(52116002)(59450400001)(66066001)(47776003)(86362001)(478600001)(446003)(305945005)(7736002)(48376002)(16586007)(76176011)(51416003)(55236004)(6116002)(486006)(186003)(476003)(16526019)(2616005)(11346002)(956004)(81156014)(3846002)(26005)(5660300001)(44832011)(50226002)(53936002)(8676002)(8936002)(575784001)(59010400001); DIR:OUT; SFP:1501; SCL:5; SRVR:VI1PR0401MB2429; 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; VI1PR0401MB2429; 23:H0Mb2PNdqK6WAw6yJBIvX/Km8XdCRasJyxGPHps?= =?us-ascii?Q?A+x6hQESSLN1ip9qLLNvWjkgl1J1P4o2MOOia04PsdKjbwb/+aNN6BTi09Z0?= =?us-ascii?Q?bYNJagNTdBayeLEORCyFYYyxDhBcXBCscjitAF8Tw7nsBeZzj48jVhX54gTt?= =?us-ascii?Q?IGss3USL2l0p5rgU6PdEPp/VCpvRrvzo4BkmvyPpz+cQEOiOM+WN73pI0dHO?= =?us-ascii?Q?9+0y1NuEnCXmRx3VdNjvKOHSagJecPlRReS72+OjFSaz07AgSZRyVwq/cjdE?= =?us-ascii?Q?fhJmzdupPznnjK9GpzIMxCjkjwueYuaHXmstyEPgqessbQ8bMm92isNQY0NK?= =?us-ascii?Q?8y093fisH8+mTLCytSAmI++/FCaYCrJPsB9WRvdWQbOc/quGiWeCC7hWSF/7?= =?us-ascii?Q?X95bG1FKeoumoN4M22SJqWGvYcdIlFIR47+PiTr4t/jndzMYPSaZJq2B/Y9v?= =?us-ascii?Q?COXYvotbX34ex5TOMe95hDAQrKdVHUhBFA/yv76xez+bhi2e3SZkOGqE+2t8?= =?us-ascii?Q?mzK1an6SWDwipThUfM5iXOKBgqEYfJi+ad5nW+M6aHwkV4CAXYu+i/jnLL6y?= =?us-ascii?Q?XT+yuSayqoVaOXEaTX6qNuRh9o47YdqjCO3ypNMhvJBseNRAkRkz7sKNbQ8H?= =?us-ascii?Q?JvGX9UdvhDggKAzWa3iSE5vu+R783mBYU4d5o7wXk9fgXZwmN092OCU5QyBE?= =?us-ascii?Q?MzLI7lLRRKZXNo6FsF+T01nhKy3qJ9Tv5/ezL7IJhy/H8S+m7nP9DZCKpXnD?= =?us-ascii?Q?SoYEcHuM44VjCAwbzTF95jcqeCLYD3FPTgqLQLTcvwyeD6H51XVpeOU73yDG?= =?us-ascii?Q?L7rUI+zBCK8t0FfNqyzBJxiH+io/rIwGOm5raAE5N+eLyjFZ/f3YfMp5hpFI?= =?us-ascii?Q?bVZdSonhnzOqKqBYaboSW7NqXbXLk+WpU63RyGGiNRf2QMILu8hfhk4GvUQ1?= =?us-ascii?Q?Si6e5at31erT9mdQECp+yRqqGdQpZq04GFN+yBY8v9JHVeHxBZY6O8mn3IUX?= =?us-ascii?Q?P+/YnsC7hzL4FnmYaA49XUS5ZVbEfZCS+epCGxxInLR2fXDksNtzwGO3pJqa?= =?us-ascii?Q?TVblqy1vbMHnjiQnWBJowCjN2rCg626doyZxae/ERSP0/0ti2fDN05IqaCkU?= =?us-ascii?Q?4hWODm7F8x3PA0LdPyC6LkvXPgR3Ad8gc50NSQyqJU6w71iokKMa9EU6IfBF?= =?us-ascii?Q?WT0aDn/JeeOLAYkqSdT4Jbqazc/z765DfVhpqpQOhZLe86dBir0MvUzgrpfz?= =?us-ascii?Q?wRftcAJFGZnEcszThJbYz+EGr0yiVmn5eS9De70QY+mv+5xq/0E7juJGfiVf?= =?us-ascii?Q?oHRLkZVkbE3NKMsynk5PSZN2hI6bfzsocA5noY1/je1A7rzhVIYK97qxEQxH?= =?us-ascii?Q?5H+EXqQxNvHu91f/aVsgGKYYUgto=3D?= X-Microsoft-Antispam-Message-Info: VzVPkK35eQG7NGspEjrqrENdlqlNZZzybNmWfRipAg5UIyurcubqjeqRSMCnAobC081fVjX9lRckD3Gn3czdhsMlF+G/FdBM/5mO4Nkaz9yYlVd02U4hQ73QPJ54OoVpiCCCpap8L0pl0CuOpq8/f2Uw+8+3AjKECM9BHqqzjpWPlp53bivdGvLbzIWFQwYjYTPDO3d2kCxWToQdt2xUSHLVnLVwCzsz0P4OZR8xYkqdyl5HftoTXLpIGNbVjRI0lnCpEyLEWdNJyJm2sWJ5j74FTlJAmRxUlMACKqds5bljGrmGPyDaN9JqXQr4/rFGlp+kKGYZKH+2Ar2q32ZawxcR+fWAau/KhP7CxOy9/zHyG56WeuANcON/HBQW8WNksWe0hiFjfXDFBaZLsNq8g34MBDyDoBE/Zne71OP4K/0jgiEQPK9zanbEw9kC6Xz143espsx1dHzb3l1ZTQHicuxuU/bj23X9lQ9mSfC55lpgCdiAPHgNee6BZmWWFiPl2GHYDD5OTUNfdd9j8zfELR4zahJ7sZ5xTE76DWyIlUQ= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2429; 6:7mDx8Q2wpWckbjHMlTBPE0sdCSp0OvKK+6HN8WThRMfhlqNBB1xUgmuGg3N6JI7oeSgtEDdyKmNDu34QDLhM9IFMsK8eAT5BZL0dRBWLkHs4b+hCeaC1I5Sb49yv7X4QWFCPci9JKlm0x67KuCp9F5CkxRDdW7/fiFDnVt3sO7tmoiELzyZmZlpTVgWSi9VMaevgUwVMu3cuzR9n3hEaSUimvWejmhyGOpx8dfTtblkjOmbrUMrENb3EH0s9by8vXdunKtD8hoAjsTCAs7meTJgC13DrulAmivkKMHCpxJpW1AoXwRtsQXCGNPy1auRTNafca1OHJxM+ZcXKXZZgJGQc7U7/R4AHsjQjWTRbozcIXkmsymQERVdnZXmTL/6yPn01I/gsCScH9XjbQeO/1+Y4TIU9agT8eU70DVGbg2pAcLzZvIfe5GgtgDbca17FUDGeQXTnjL3XQjZoWubcx6ywvxs/ZwYoR4cFjOjH5hv9dzBzvvDEb4+q5FS/MNZZ; 5:hpn41gYp57lc5a/Uc6sIEV8/RALeqXCZkcAYu0IpLEsvx7Wna6aZ0YqIc5uAgRftzIeE8papcdl8flOfH3a+Wdr33kKbRyFoYdgdHeAAnPlSB5B5B9amNg9+UXa4xpagNI+BSjB2yE3evfkIdaFHEoo19xsTHcBiqoIH3A5QOGo=; 24:WChtFVlCIrVJ/nb5F/ax2QjsJwcBoirMknr2el/yYRxEsNXxPhMRGU9ztTqOihRD0i0YevszTujZJ+XrlfPJxQ== SpamDiagnosticOutput: 1:22 X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2429; 7:RdrKQ00RcjXajXVtIbpnOE70KUOzJTejlxoqZeK2JaLUCsXR1dietQzFg/BxKj/XnQdwqtTcFGIl5EgWJc/BbgPKPYVzvEYlGccMfZgVi3hb2nWkiVUMHKa53nnMWKvWbr8VXrYtVr5L9fJ5Z7xrF+HV4YRMvQn3w1IBcYIv6qSkJ1xjSK6hlSuW2kNxLVgL84IsgrX14hLujgN/+MQjcB65t68LEhJlEqB4dIk5duoA8KDTCutp7KqH1l/YHkAH X-MS-Office365-Filtering-Correlation-Id: dff2e19e-3be4-4173-ac2f-08d5b10de663 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2018 15:52:38.7027 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dff2e19e-3be4-4173-ac2f-08d5b10de663 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2429 Subject: [dpdk-dev] [PATCH 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 15:52:41 -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 | 7 +- config/common_linuxapp | 13 +- 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, 480 insertions(+), 8 deletions(-) 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..b6a649f 100644 --- a/config/common_base +++ b/config/common_base @@ -38,7 +38,7 @@ CONFIG_RTE_ARCH_STRICT_ALIGN=n # # Compile to share library # -CONFIG_RTE_BUILD_SHARED_LIB=n +CONFIG_RTE_BUILD_SHARED_LIB=y # # Use newest code breaking previous ABI @@ -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..8ee495b 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -6,14 +6,14 @@ CONFIG_RTE_EXEC_ENV="linuxapp" CONFIG_RTE_EXEC_ENV_LINUXAPP=y -CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=y -CONFIG_RTE_EAL_IGB_UIO=y +CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n +CONFIG_RTE_EAL_IGB_UIO=n CONFIG_RTE_EAL_VFIO=y -CONFIG_RTE_KNI_KMOD=y -CONFIG_RTE_LIBRTE_KNI=y -CONFIG_RTE_LIBRTE_PMD_KNI=y +CONFIG_RTE_KNI_KMOD=n +CONFIG_RTE_LIBRTE_KNI=n +CONFIG_RTE_LIBRTE_PMD_KNI=n CONFIG_RTE_LIBRTE_VHOST=y -CONFIG_RTE_LIBRTE_VHOST_NUMA=y +CONFIG_RTE_LIBRTE_VHOST_NUMA=n CONFIG_RTE_LIBRTE_PMD_VHOST=y CONFIG_RTE_LIBRTE_IFCVF_VDPA_PMD=y CONFIG_RTE_LIBRTE_PMD_AF_PACKET=y @@ -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