From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03hn0212.outbound.protection.outlook.com [104.47.10.212]) by dpdk.org (Postfix) with ESMTP id A13B044BE for ; Wed, 2 May 2018 19:16:03 +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=EkS7Ziqvf+J9tozxZvuvyt7KLwGOc0KXL9aTi6gSH34=; b=AZE5adA/cE/NgGoFHdcmNVIw6uLRnLy65fHq4dtnbRYZ7efm2FRBs+xUzcqklp8MwaIOA5BtCqB29H0J+b5MDZ7rnvfoTOtxmaRFy2gTyHzfnVZTCsbulmi/mB4Cuv6nWbEr/hAA020AH2wZCfq/L6/iwrCAMXQmWtzoXhs6q1w= 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 AM4PR0401MB2419.eurprd04.prod.outlook.com (2603:10a6:200:51::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.715.18; Wed, 2 May 2018 17:16:01 +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:45:26 +0530 Message-Id: <1525281329-27984-5-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1525281329-27984-1-git-send-email-nipun.gupta@nxp.com> References: <1524737696-3145-1-git-send-email-nipun.gupta@nxp.com> <1525281329-27984-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: MA1PR0101CA0001.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::11) To AM4PR0401MB2419.eurprd04.prod.outlook.com (2603:10a6:200:51::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:AM4PR0401MB2419; X-Microsoft-Exchange-Diagnostics: 1; AM4PR0401MB2419; 3:Ti8tJIoTP0yLIG4n2FsvzHLTTZZvp1aFlU5VhKYHrdgaf2g30Q3/sF167z+4+O4nl0R/Cq4oOfWknX0e3lkhzVqQCP6WWwSb3GAZVXI0dqVEtRT31ObpddyFhQp+GFHPDi9w8mLcdREZgyQhgKqwkmblxLvb8/K6rnScGfuSC/sXZhWHpcWTFj9KFwaYA7mKFaaiVShuQvcCszoPC4YP9cu7GYsCOFuMXRWx4tovus7IIPf2Q8D5o7/EqyTdkOBv; 25:E1sWVIje92pGg595Jrx0EBN8Uvz23e2+rI9zYHZOumLt/iongqt+upsaABYBq17KscjCyddUwEJduBdcSeS0deVzqUQqXYuLwHzoAtNZT3msdmc08tWtnpxmIHwo9cYSV4vG3ATzKPqL72T+nboM5/02pGHsuCorsvoKxlSSlV5pMVEz4OTdgL3d/v6wedIE2iWQaiG1rARmPezRlBvlnWDRd0feZZ432IKa5zePJCjEk1EghwOq9hz0xpzJKzjT3EJlOLhLRo1AeOauOfdrACiPv7cr26l9ebNKmKvKy8t04/njtq3xBU8Gmq6VmvtQiBr9XC8vjqJm5m+/YuGCWA==; 31:lwbU5laxWQA2dS7vVLJgVgfMuFISEMRHGqE94x/RxHH2g/i6e3bvMgDvg8kQAPLCTGI7o4/GwfKNTpbnMihArxQLkpONieWGKk6IvnLR8iImB+hQeWtcUXcXbDo1wQAoREleCD/7zxsNnCX2TQSsKo/r3McR/koCadEQgjRDhTh6Ulj7kA7n6c/LNTAQc9lmUKYSJ3FCauILTBfIOdleWgC7DIPMrPIpct1/s4f1f1I= X-MS-TrafficTypeDiagnostic: AM4PR0401MB2419: X-Microsoft-Exchange-Diagnostics: 1; AM4PR0401MB2419; 20:mZ8tvJtbm0NMtqF1wYJQzgs5r50gQ1mkqW6vLLt4/AaImV7NPPB64dl5mWO5NoY9x0Wg/l6bs7HZNlUfFlCueabHwHR2s+E8YytjYOr0QU+F+/oP58p9/iW0E2tK6vHD2OTfSTo5fiLnSM6VUvbl/SpYs8c0C3+4AklYg0Z4xtFc0k7buHRW1VNIO9VQIz6OtVb5FOkBBDFh3Koaf8xdFKyyP3yMJYubLlMmkC2qVQcMx0ezVubS/eTP8EG1GLnC5nW3UmZ8vRxMrr9TD36MmUqwSgShnkIJs6DZ6Eeq2CrGoX7tFgT4fMHLw5BB2wFPh06FKAgVmOpLOsLx0KznqrI8xBH45jAzIRZThB6XuJanNw1h36kMdVCjtpts9g+9WFWnN2onrfyl3OvnDbAHR7l4LPaTRj+Rzh2XRhsVCmO4aFvJYuuHgwq4/Rnxm6lS0N9LnVzqV7eNP80QyqXpHVIr+WLMYm9stzVxEdZcdo2mRCOGlXnYKteGIBnpaX71; 4:hSXQEDuqfoEACKK1puX5rDTaUefvx8ru8iOIC1/UC3w/a+yIC5fiq1+l0gn6KYYXxQOjJK19/2yNtfA4fw1VYdlhAHiPVTf8r84pyCLtj/TA9h6PNyQj65zwys2BNgdZ8MH920FSC456kpTY67nPoMvB89VA8JuGBPpReDXJ5Db/UlrPyNQMMS3qBHja+hsHq+XgBDhWvsmzxT9Wvp+XTPA0rkO8kpAr3sY9mXXluJZvIJ7TI7ZqemS/bvp4fFfL4VT93HywKp4rMLNqpq2L2tl/uDGjecRd2f7b1tTqSwhEer3qoIILWhaqeqGxFImjR8/GBmHuQVK0Ltd4wqPt+l8B4+W42Cg1UMsnPfsGhB46eORtBBTaqtsIa3KYq+I1 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)(3002001)(3231254)(2232076)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:AM4PR0401MB2419; BCL:0; PCL:0; RULEID:; SRVR:AM4PR0401MB2419; X-Forefront-PRVS: 06607E485E X-Forefront-Antispam-Report: SFV:SPM; SFS:(10009020)(396003)(376002)(39860400002)(39380400002)(346002)(366004)(199004)(189003)(575784001)(956004)(316002)(16586007)(11346002)(3846002)(5009440100003)(6506007)(305945005)(4326008)(6636002)(476003)(97736004)(5660300001)(7736002)(2616005)(48376002)(53936002)(50226002)(86362001)(59450400001)(6512007)(50466002)(6666003)(486006)(446003)(386003)(6116002)(36756003)(55236004)(47776003)(51416003)(6486002)(106356001)(8676002)(2906002)(186003)(68736007)(26005)(8936002)(25786009)(81156014)(105586002)(16526019)(44832011)(478600001)(81166006)(52116002)(66066001)(76176011)(59010400001); DIR:OUT; SFP:1501; SCL:5; SRVR:AM4PR0401MB2419; 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; AM4PR0401MB2419; 23:Z/9Ew7Di6WRvqWd2gAQk0C4vwqHRx5mYZ9Gkrbu?= =?us-ascii?Q?i5szuMlOVJfrBLcla/Wmk4QrrjX95m6qYnSwZ/E3hfYGeY7x2bPYeOhi/UZb?= =?us-ascii?Q?FYUR8wJ3lSChG0PUq/V5jBjnaPf9/ICPYc6fSIHG4rqPtl7EDy+BlnrRMSwa?= =?us-ascii?Q?b6Bcppwxu3UJHTLFIYhG7FdE0ZvoV1TZfc9Dz3dcrJnSy09CMZDE1ZuE5Xy4?= =?us-ascii?Q?t8+XZ9tzR7Pzin8FFtnIY3Mkrg2fVp1edJ3MkagPhps9r66j6W5wLsSPlv9s?= =?us-ascii?Q?3SziBZUMttwUB5V86cLXT1saLQcezGaPtTmgvJkgyUubNCJLsMXxt4dmuEYO?= =?us-ascii?Q?dwZkTz0rJmYuGTCzasp1xVu+1J76ct6t1yJ1BHqc2GcVMBgpg908vFV0LpZt?= =?us-ascii?Q?sSKd/bwx6iLR+U8mqkl9tXSqCR0H75YUKTaUgB5OOoo244whMlUavVc/VG9A?= =?us-ascii?Q?SH6DM5fT/ZugXa6cWEv+buszFfgr3no9LSKlb59M9MJSWQL9cEbudWQcxQ5j?= =?us-ascii?Q?lVjH+usVt9Xb77vthzejJLLomUVzrFFCNsua96EeS6nYZSJcfh2EVJstZ2vL?= =?us-ascii?Q?DRXOySXNzIoKVvoGf1pLXiIHmLU6THavZ6HAncdoVH45PtvU/nFfD3NthEvJ?= =?us-ascii?Q?A/7N5z+WYo9FOTu+6/QHyZyemFaOZR9wXkXR6t/Q5zCaW7UsXApZo9SnJOip?= =?us-ascii?Q?JFX0bC7Swa2bcmCgRdpzckxJK4N4pIutusQvKo+Gy4UYiwrzkpOlI2Z90FUN?= =?us-ascii?Q?atEiLyMzSSahPp+2yyGKxCm3+LEDNZX+Iof8Qza9D6TyxJ0GnC9bldjkRyLM?= =?us-ascii?Q?FhG76Lq3g/xiv6ZVpZ2BXmquU6czixbLTahIgAlhSrfFoAQT4HgNXP+lTHCZ?= =?us-ascii?Q?lfuIh3KfS7muf5XbW7DZ0o2l54ccxnoUK80zYmfstNy8+yDcyx80hZgPa4dt?= =?us-ascii?Q?zRvBha/yTh+wffif+1XJWKbqk3+dsGnjrglYb6Lj8KZA1j/EV4iiZ8IaulPZ?= =?us-ascii?Q?hYoZjwgDo1yuMGv2SkLtoRLDaPdKJtE2M7t+EvwfnBF4llW0WHTTd++KKA9Z?= =?us-ascii?Q?8Zw0Ofgsj29akfJHiSHcJhtcsck5H8hvNCBwlWDwg3RbDOt04w+lo/9WjLEf?= =?us-ascii?Q?W3BqkPXCu3QvZwwDH4Ck7ZekoffCCkUarp+wCV7M+RKPAzSTRmnfKnKG5eEc?= =?us-ascii?Q?zQZV/5IA4qwpQcvMDlr94GdaKgDLtDJ95mN9uBDBlr0NhJ/zGuOQqS27Q5qe?= =?us-ascii?Q?cRo7mDGx350GNl5VhG4u17O01FS10qjLJPRo+NeX66GLoF9oNhTrter9j247?= =?us-ascii?Q?BcyiMY5LvzZy6/CsJirDkscVnvkQMkT335q2xl9ZXrv/wDKWPna93KShOiDj?= =?us-ascii?Q?rCa5neG8We/yc7zq5c9jDlLt56PY=3D?= X-Microsoft-Antispam-Message-Info: 6UzgytTjku5MyaIbSIdkYFhCdGIq+3ZMZdSDxm6s9U253jPlDIBpkF8g2E6nPfptfU9GODmsREnNvF8M+q5lsCmbs3fAX8pe7ARkCNUbB4z4nXuGN3QN6RScpJEkUOo8IH1vaJxLbmgQdDElth+hbnMX2f44Ofc/dmo1eKuhTBeQH1ZAGYu7Y5JKpv1/bdbte7g98L/c3Kqijz/TxBN83JKWjMc1nFXiqQ9XZGmQF73AH46X/zAU2hBLivUDCobt3ujh3HbOzT4EswUo1mlCawtT752T7Nc6V+NbzucoMkrnZ+WNXMGl40UT74RkVksty0mwDhQ1aplXHqjYHFuULNqD4m3Lt2979cIC1l0fZkewN8JRfuxZk5/b07V16b389hgy90bILF4IBsE+pH4WMocfUoPzo+mEdQAYuhJpbT618CPVtgLQovjODWEoXSQKuyu+p7kL3g0j+M96lNc51AgHZ+Q+301VNCYBjO8xJvSNpBp/opcqZYFmP+RxLhVAkjQROTtp4juRjqmsqw+HWnfrztTrd1xQZfiopgKDDvg= X-Microsoft-Exchange-Diagnostics: 1; AM4PR0401MB2419; 6:xmqSq4B4DujqpQiULL7tRKAmg4FepbjppgOpOXo0dZS05B3Gw3vkL8D7IFnD2waXVkAWB8PudLIQvUhG2iLR7qVQWTuFSCszwKzwKyWUssJVBm8XpWOQvhqYdq58wyooMb7ZPE5cW9UlJ+l1WztJczjkVXbr1pCuxDFIAivgWRiUYdvwT0cnsUrvPT/neN87J5KZ3KGObtZuH7W95McY/mfAXjbzFk0JNVjbunx3+bz1R4GHmdh0EGoa6j1cRLiWAopBzad4d7t4/50AqgCzVMjXpBmIXDQAPdtKLWKsRkpv7Kd2K5zgfYsXzYhGDJZ2YNMjkUSWfAk5mpEiZXa1VtHOPXhgwhItnMXPYx5B/o5qsWbbzOlSbXOQ8RUf42yFDR9/Z2XzCCi3T2Mktx3tHjggaGKg0XtKdqaU9JnFwEEa+U/gnfhqQIGsH878wULfoQj2B1CyQCrREOAxz7gZEJSa+DKg0cZsald8Z/zxb1iCe6ul7eoUdBqYwNfAndkq; 5:BJ0LCY7hcORK0YUh7a3dHDLRRixWWI86o4vAjeCHjIvxW+zcJTw/hI0VTjlxy8f/O2C41g+TVhWhw0kv0fjmJzSf02I1bBR9b9wzjzV4H+SNeQqTyL4VUZQzhcxoiseTQzBiDkRIRFUt9ZueCnapJX524ijw7BDX+1oQwURsJlA=; 24:BLBaOgDQzg5PEcVcDBML+02P3iWcuwFpfVaeVQHSwVrHrJjtiJ1NzOQ2Kn+ZpXSwJhhcidkUMEs9MLFl3U25rA== SpamDiagnosticOutput: 1:22 X-Microsoft-Exchange-Diagnostics: 1; AM4PR0401MB2419; 7:paklH5exxAbx1OCg8N+g09pLt6yNyPnTqUauXmsPyImQcDYXfXq/w2yVj9//XQkU5Xy/EDFqvYp8H0w6y6TOVtMUP0AfQdzT8jUaLqCHauehQUjm+ukz92VwAXa6Zb3QuU5u7rwGtOPaxm/dEG04AFh/aJHMorkoYw9rhxtE2ehL7Q6+wYgb6UjvW+hzNhvtFdcP8O/8/WUY1bR87vWnKzAY27l+CO3ZkyPjZIxi9nQNsnPp1SU56R9XGPoLcHwR X-MS-Office365-Filtering-Correlation-Id: 4458d04c-514a-40c2-ab9a-08d5b05061b8 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 May 2018 17:16:01.2886 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4458d04c-514a-40c2-ab9a-08d5b05061b8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0401MB2419 Subject: [dpdk-dev] [PATCH v4 4/7] raw/dpaa2_cmdif: introduce DPAA2 command interface 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:16:03 -0000 Signed-off-by: Nipun Gupta --- MAINTAINERS | 4 + config/common_base | 5 + config/common_linuxapp | 1 + drivers/raw/Makefile | 1 + drivers/raw/dpaa2_cmdif/Makefile | 33 +++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 139 +++++++++++++++++++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 35 ++++++ drivers/raw/dpaa2_cmdif/meson.build | 7 ++ .../dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map | 4 + drivers/raw/meson.build | 2 +- mk/rte.app.mk | 1 + 11 files changed, 231 insertions(+), 1 deletion(-) create mode 100644 drivers/raw/dpaa2_cmdif/Makefile create mode 100644 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c create mode 100644 drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h create mode 100644 drivers/raw/dpaa2_cmdif/meson.build create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map diff --git a/MAINTAINERS b/MAINTAINERS index 3fc4a2c..5255143 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -813,6 +813,10 @@ M: Nipun Gupta F: drivers/raw/dpaa2_qdma/ F: doc/guides/rawdevs/dpaa2_qdma.rst +DPAA2 CMDIF +M: Nipun Gupta +F: drivers/raw/dpaa2_cmdif/ + Eventdev Drivers ---------------- diff --git a/config/common_base b/config/common_base index 9b48bcb..0d181ac 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 CMDIF raw device +# +CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV=n + +# # Compile PMD for NXP DPAA2 QDMA raw device # CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=n diff --git a/config/common_linuxapp b/config/common_linuxapp index 21b3fe3..5c68cc0 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -38,4 +38,5 @@ 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_CMDIF_RAWDEV=y CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=y diff --git a/drivers/raw/Makefile b/drivers/raw/Makefile index 0f2b076..2eb2787 100644 --- a/drivers/raw/Makefile +++ b/drivers/raw/Makefile @@ -6,6 +6,7 @@ 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_CMDIF_RAWDEV) += dpaa2_cmdif DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += dpaa2_qdma endif diff --git a/drivers/raw/dpaa2_cmdif/Makefile b/drivers/raw/dpaa2_cmdif/Makefile new file mode 100644 index 0000000..66f9c0e --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/Makefile @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018 NXP + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_dpaa2_cmdif.a + +CFLAGS += -DALLOW_EXPERIMENTAL_API +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) + +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_rawdev +LDLIBS += -lrte_bus_vdev +LDLIBS += -lrte_kvargs + +EXPORT_MAP := rte_pmd_dpaa2_cmdif_version.map + +LIBABIVER := 1 + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += dpaa2_cmdif.c + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c new file mode 100644 index 0000000..e3e2b64 --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -0,0 +1,139 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include "rte_pmd_dpaa2_cmdif.h" +#include "dpaa2_cmdif_logs.h" + +/* Dynamic log type identifier */ +int dpaa2_cmdif_logtype; + +/* CMDIF driver name */ +#define DPAA2_CMDIF_PMD_NAME dpaa2_dpci + +/* CMDIF driver object */ +static struct rte_vdev_driver dpaa2_cmdif_drv; + +static const struct rte_rawdev_ops dpaa2_cmdif_ops = { +}; + +static int +dpaa2_cmdif_create(const char *name, + struct rte_vdev_device *vdev, + int socket_id) +{ + struct rte_rawdev *rawdev; + struct dpaa2_dpci_dev *cidev; + + /* Allocate device structure */ + rawdev = rte_rawdev_pmd_allocate(name, sizeof(struct dpaa2_dpci_dev), + socket_id); + if (!rawdev) { + DPAA2_CMDIF_ERR("Unable to allocate rawdevice"); + return -EINVAL; + } + + rawdev->dev_ops = &dpaa2_cmdif_ops; + rawdev->device = &vdev->device; + rawdev->driver_name = vdev->device.driver->name; + + /* For secondary processes, the primary has done all the work */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + + cidev = rte_dpaa2_alloc_dpci_dev(); + if (!cidev) { + DPAA2_CMDIF_ERR("Unable to allocate CI device"); + rte_rawdev_pmd_release(rawdev); + return -ENODEV; + } + + rawdev->dev_private = cidev; + + return 0; +} + +static int +dpaa2_cmdif_destroy(const char *name) +{ + int ret; + struct rte_rawdev *rdev; + + rdev = rte_rawdev_pmd_get_named_dev(name); + if (!rdev) { + DPAA2_CMDIF_ERR("Invalid device name (%s)", name); + return -EINVAL; + } + + /* The primary process will only free the DPCI device */ + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + rte_dpaa2_free_dpci_dev(rdev->dev_private); + + ret = rte_rawdev_pmd_release(rdev); + if (ret) + DPAA2_CMDIF_DEBUG("Device cleanup failed"); + + return 0; +} + +static int +dpaa2_cmdif_probe(struct rte_vdev_device *vdev) +{ + const char *name; + int ret = 0; + + name = rte_vdev_device_name(vdev); + + DPAA2_CMDIF_INFO("Init %s on NUMA node %d", name, rte_socket_id()); + + ret = dpaa2_cmdif_create(name, vdev, rte_socket_id()); + + return ret; +} + +static int +dpaa2_cmdif_remove(struct rte_vdev_device *vdev) +{ + const char *name; + int ret; + + name = rte_vdev_device_name(vdev); + + DPAA2_CMDIF_INFO("Closing %s on NUMA node %d", name, rte_socket_id()); + + ret = dpaa2_cmdif_destroy(name); + + return ret; +} + +static struct rte_vdev_driver dpaa2_cmdif_drv = { + .probe = dpaa2_cmdif_probe, + .remove = dpaa2_cmdif_remove +}; + +RTE_PMD_REGISTER_VDEV(DPAA2_CMDIF_PMD_NAME, dpaa2_cmdif_drv); + +RTE_INIT(dpaa2_cmdif_init_log); + +static void +dpaa2_cmdif_init_log(void) +{ + dpaa2_cmdif_logtype = rte_log_register("pmd.raw.dpaa2.qdma"); + if (dpaa2_cmdif_logtype >= 0) + rte_log_set_level(dpaa2_cmdif_logtype, RTE_LOG_INFO); +} diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h new file mode 100644 index 0000000..5eb0885 --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#ifndef __DPAA2_CMDIF_LOGS_H__ +#define __DPAA2_CMDIF_LOGS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +extern int dpaa2_cmdif_logtype; + +#define DPAA2_CMDIF_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, dpaa2_cmdif_logtype, "%s(): " fmt "\n", \ + __func__, ##args) + +#define DPAA2_CMDIF_FUNC_TRACE() DPAA2_CMDIF_LOG(DEBUG, ">>") + +#define DPAA2_CMDIF_DEBUG(fmt, args...) \ + DPAA2_CMDIF_LOG(DEBUG, fmt, ## args) +#define DPAA2_CMDIF_INFO(fmt, args...) \ + DPAA2_CMDIF_LOG(INFO, fmt, ## args) +#define DPAA2_CMDIF_ERR(fmt, args...) \ + DPAA2_CMDIF_LOG(ERR, fmt, ## args) +#define DPAA2_CMDIF_WARN(fmt, args...) \ + DPAA2_CMDIF_LOG(WARNING, fmt, ## args) + +#ifdef __cplusplus +} +#endif + +#endif /* __DPAA2_CMDIF_LOGS_H__ */ diff --git a/drivers/raw/dpaa2_cmdif/meson.build b/drivers/raw/dpaa2_cmdif/meson.build new file mode 100644 index 0000000..dd40b7e --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/meson.build @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018 NXP + +deps += ['rawdev', 'mempool_dpaa2', 'bus_vdev'] +sources = files('dpaa2_cmdif.c') + +allow_experimental_apis = true diff --git a/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map b/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map new file mode 100644 index 0000000..9b9ab1a --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map @@ -0,0 +1,4 @@ +DPDK_18.05 { + + local: *; +}; diff --git a/drivers/raw/meson.build b/drivers/raw/meson.build index 1b298f8..34dfac4 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', 'dpaa2_qdma'] +drivers = ['skeleton_rawdev', 'dpaa2_cmdif', '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 26a6b0c..26f3563 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -252,6 +252,7 @@ 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_CMDIF_RAWDEV) += -lrte_pmd_dpaa2_cmdif _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