From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-am5eur03hn0220.outbound.protection.outlook.com [104.47.8.220]) by dpdk.org (Postfix) with ESMTP id 65A773256 for ; Thu, 3 May 2018 18:34:26 +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=JKjkggrv+Aved/1ztkM66PEcumacu2AsArNCi6t9u4U=; b=GBcVyOgkP1A4YgDhXEdYJtC8jrnsxluC//mvSPK9/0xvCOSpx35QotGSGJbTLnPaVzkQEWMbWblf7SmAFs0M+N5LHojUYgKlGbQIZDM1GBaSPnRznQy6K9zj8W2RW/v5F7qyq7zvxdc5NQNpcmZISXA2jxxO1vPaqysONl/BNU8= 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 HE1PR0401MB2425.eurprd04.prod.outlook.com (2603:10a6:3:25::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.715.18; Thu, 3 May 2018 16:34:23 +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 22:03:50 +0530 Message-Id: <1525365233-5956-5-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1525365233-5956-1-git-send-email-nipun.gupta@nxp.com> References: <1525281329-27984-1-git-send-email-nipun.gupta@nxp.com> <1525365233-5956-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: PN1PR0101CA0071.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:d::33) To HE1PR0401MB2425.eurprd04.prod.outlook.com (2603:10a6:3:25::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:HE1PR0401MB2425; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0401MB2425; 3:YRJCbXo4XqDVmrFhFftndnfzxizU1FX0sb3YO7Kt8dr7aMLA7cCKc6yKAF7PRpdz14k2hK49UJ8UpWVdTz1uicIb05c0jr5ur2u0BIno8YxKze06pBiLqhLn+MSwzgZkjfd1epzZ3J6i+tSoZgyq078yqBrEShNBk34Pcetw+n8moLUVB+3W8w4T3h9IShI/a6uwea/qBvnvqXeig09WfhfmEREUhEcAyXB2mvqPCZckG47R2ufnVwoesjm+XDKW; 25:Pft82yqoLN5e15fPX8o5COWkSTPHkZfJMzEfGfkIbEiyD3mWGmgGPoEwDzxR5ieT5V/HzcvX9rTBpOEgNCWE7V5S02RGDRntv9GXyvCVoXNWIPIB1GFv+DI84Xk70XldX6nNih3j6YhldXE9suQKUM51Cqzqos3pIEaeATCDRcTZvNS+c+uEm5J4Q6li9IrSy+7H+XsGDQxaiLr8jY6EcSU1RedutJ7PiVqX6t3HBfa43fW16IFUCheMq4L3J2jsy3tqj+tetXzrckvFk2z9jgfxdpxM3v5wo6VHZOjRKJJ8qSoTP80YcCElvSMrCQZs5NlUlkShy6ILBvT/s54/bw==; 31:8+PtCa0jMZzZbv5358AV5Ygm0sdS8soucHQTSC99vvK7iN4ueP4xMSUSYBy4X5++uMucggeurctEGjI9C6T2Z/aBC1wfA94CNOndV2MPL5+oxlzcvBarJG+Feg3lxPsxO0L3Djv/pxbOAMNKGtp2jZ6anqabmszvWXUOLkL3j/Jzcu4j+Qf29pMlOSR/tk/pz8llONNLdjnMHGHUkr0q7eJ8P/gc8uBpvc4QfiTRgXY= X-MS-TrafficTypeDiagnostic: HE1PR0401MB2425: X-Microsoft-Exchange-Diagnostics: 1; HE1PR0401MB2425; 20:+nXi4Ognu5Zy4nz65PeMnthdEhtTixUW1yhzc7uYvRBQuzaj5wMNOd6CnACwxoO6OgcBW07FHLZLxRkR2Jr7jDaua1gRWhhxhn7dKE2MCKM72I9hCbL0gj0sjRlEDkX4CMMsJUfCyhcvcMx6KEV+4RZXItWI8kfa08UaYSdkShrqnVhrqSV9umhKtfO/03+OFNNY/A5GPsbgoJwuxOdCW9ZQfYrSIPCvsotcZv534yIttiPl8ds6y+bH2UgYWpzSZis4MWdqNTXHGFnlihb/4MBWdaF27AXNJTWsu2SoeL1q1tRcFqXpfRq4BHvo7EpUmfKdFWTEBoqUC7MDGM/gqCLomZ22N5tncTvpaU7ZnKJ9w4DV+8CbSuRO8wCLcZTKyU0FP/3k4JKMKQtD96F/i+KLWoxc7XM05mb9XnDrNU6Nts8mlwDKTfNEHcmzxTnTX/QqFc5Db3XX6vmNE9BLCSHDSCnl+lINFgBYpOdzmsRyzActI7UmkEGTsOia5xKm; 4:+6KXbUiAawb/whfgo7I2j235hUS0x8VEm5mWjDWAlJTeFnJJWd/Chkm9Dx3OYcS9k0QBHmJWONhOU8YRwNhSwndxHxzpcI1izbOesIOPmhhzBcveV8AfL0RB2Ip+IaBUICcxgnxuA3nFpwq2DDR933ykbEozF9B29d+OcqEJHjzMEowAU7hVIJIu8Uplog+PCmlw2at1CnyitTUYg1FvLBfdTkBjLyIvYLVJphou098Ytm1oExweBAFeaIF3AsWZkAHg8xk1/yEtpG2QzJ0mtHVi5/Ty/yWvjB7/PB51OGW/JDxA7+403tBNk90SuK4sNJoK7lkQg6yoz7NZnXVonJszxVK7XvTpgPHiKwojyPXIxCMtPnm4qv8tI93jpnrz 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)(93006095)(93001095)(3231254)(2232076)(944501410)(52105095)(10201501046)(3002001)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:HE1PR0401MB2425; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0401MB2425; X-Forefront-PRVS: 066153096A X-Forefront-Antispam-Report: SFV:SPM; SFS:(10009020)(366004)(39380400002)(396003)(39860400002)(346002)(376002)(189003)(199004)(575784001)(86362001)(97736004)(6486002)(68736007)(478600001)(5009440100003)(316002)(16586007)(6512007)(5660300001)(4326008)(48376002)(106356001)(105586002)(53936002)(25786009)(8936002)(36756003)(81156014)(81166006)(47776003)(305945005)(8676002)(26005)(2906002)(66066001)(956004)(50226002)(7736002)(50466002)(6666003)(6636002)(11346002)(59450400001)(2616005)(386003)(6116002)(6506007)(186003)(55236004)(3846002)(76176011)(52116002)(486006)(16526019)(446003)(51416003)(44832011)(476003)(59010400001); DIR:OUT; SFP:1501; SCL:5; SRVR:HE1PR0401MB2425; 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; HE1PR0401MB2425; 23:MnSAoncJlDaz4v4pbhgeBCl6qapkO9/c7GpNYy2?= =?us-ascii?Q?384oHopELYBu5SBGdROsOawp1C7IBowOLgXy7qIdphvl0j8Kj5YJgXky2ycH?= =?us-ascii?Q?s2rg5Ig51uI6vWYmnpe2TWbJVZp6CmABkRYHMkj+Zfyoux+GDg4Xi4jMwdwW?= =?us-ascii?Q?otLNKZobY1VWHpp3toK6LlFBA5/SQ8200CABImvGeK9CWcEmtVemBDrOfrFz?= =?us-ascii?Q?BV6V3VnwG6lEsBP8pdw8eAY2sIDoIcF1D0Kpr1mm0sExQEE3kr+VyzdXOKDO?= =?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t4vIueGxFQs8qR8MJtqNy05iELwco+shAkYv8ZMysk9ih+3J0SCjLZ8zuKV1G3NMSNq1ApuYmT0RUsKWHrMVpNUnzdMofY+mbiYiCe5h3mBwUXQV3PVZkncn05rd4pulgCSRWbV1HnsSJF6qh2ua8MgqY+0m0aNlKkBeJ0KsXxvveBX0VXVcB5AJ4O3qKGRoLTohsA6GS5i7ib+SgK1SyvNrJ73Edt3l1uIaGVI0ETIKjFDmnWLBh5lcB/Rs5law29bUZhAapKr5hpsRMl4UqkMjLhFvb9J7CvUI1jpYDIom/M1SXOr6shIDulQMV1Zd8jGIqQQLncU8Q; 5:81jBaQRv+LYPKVkerVOWbhIhoK9AnvviLMImK+96Tuk05FkgJ25ghkLrhoQIjtf8WLVWO5MbUbaZiN+9CcBf1fB5T55kgYVcCnp629SHEGw4wiJMSJirvsboU0TDS9sCUDlFw3c1MaXjwN/S367D9ikZHcT4KH73tIDEX5aMOwU=; 24:csCYHJ1pU4ZTyn9kHM+8lAFhUalYjMow0HbGwcXCJnE0X4DKiIW6iuM1kRQu0yCAAt5dCobREdKgAU4XGrQS0w== SpamDiagnosticOutput: 1:22 X-Microsoft-Exchange-Diagnostics: 1; HE1PR0401MB2425; 7:fmZzZ4mCipNvOd+cHlBJ6K0aeMLTY5M+NCm5oZQ0Hw2D4tJmMSmQj+6wnradmYBwhwq4uO/Z9r6TzW+0fb/9708yXKQRH4hJ9qfiI59FIopc7IqLtv50TsjIOgZ37ihhlXryWzv/pOw7SkEa3hNAXnVHbLJ7OPs6AGkowuXmRRHThpk80ZkWPILxg+3bSld9RS+W0Hy9fOvZUfpZ8mlNURrecbeYe5z39c/769gnvWSwP+F8hH7p5h1c8SkYhaAk X-MS-Office365-Filtering-Correlation-Id: 4848dd3b-3f81-4a08-caa1-08d5b113bb4f X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2018 16:34:23.5981 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4848dd3b-3f81-4a08-caa1-08d5b113bb4f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0401MB2425 Subject: [dpdk-dev] [PATCH v5 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: Thu, 03 May 2018 16:34:26 -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 | 34 +++++ 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, 232 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 b72b048..95d639e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -810,6 +810,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..5f9b8bf --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/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_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_bus_vdev +LDLIBS += -lrte_eal +LDLIBS += -lrte_kvargs +LDLIBS += -lrte_mempool_dpaa2 +LDLIBS += -lrte_rawdev + +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..91a77ce --- /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