From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01hn0206.outbound.protection.outlook.com [104.47.2.206]) by dpdk.org (Postfix) with ESMTP id 2C67D2F4F for ; Fri, 4 May 2018 12:12:02 +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=zbYRRbUNsEnL8jxZ/jqyDwDO8wtzg8KNb3ifAWyrUWc=; b=tH8UHHtqGrUw3B8JwGb9dplvcN9KL/LGrftyE2A4TnyvAYvbQT0bgcjr8yibGUZ40O8VoNXn46DEcb7nMy8TiRZpCI/CE9MuwaLwdUFdHcdwQszmw8ErfVMc7GlvCe5cCHtiFs+hdKjFp/RxwghP2JHf8dMM2E1I68k9zt3KUaA= 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 DB6PR0401MB2422.eurprd04.prod.outlook.com (2603:10a6:4:4a::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.715.24; Fri, 4 May 2018 10:11:59 +0000 From: Nipun Gupta To: thomas@monjalon.net, hemant.agrawal@nxp.com, shreyansh.jain@nxp.com Cc: dev@dpdk.org, Nipun Gupta Date: Fri, 4 May 2018 15:41:26 +0530 Message-Id: <1525428689-8076-5-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1525428689-8076-1-git-send-email-nipun.gupta@nxp.com> References: <1525365233-5956-1-git-send-email-nipun.gupta@nxp.com> <1525428689-8076-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: PN1PR01CA0071.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:1::11) To DB6PR0401MB2422.eurprd04.prod.outlook.com (2603:10a6:4:4a::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0401MB2422; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0401MB2422; 3:3s5TQervKhQ2QuQmyJ65kbWBtI3B/JxCRmK5wTzoLPaukIV39E6mQWl/gmb49XBjCvj6qJKLqLelhU7mn9tvkh8cJ6RgZIP8Eo21s31o/FvXdxAnR7iMgSnQ1E2pqHyT0NTntH2jxvGnIwF97k6ikznybrcryIYz/RCY7eNqhFqEMDS15twf3SFcLidNDECMvhk3JJm8tTs8p/2hllOaInXzi5Lar6i3TOAe2TY7UDOemqTyD0OHCftr/sbak/hN; 25:62gP1V6DLBTBr67luJ9omEvLINoCjpdRurMspqqB8PmFO8bQz0m/Vr+Ej4NLSAlhQjDEgmCwTkLkXqTJteMSbK/n1D94qck5ZNRqQVpXdHwBO7H8BwZFJBLRPXQix+jlQ5k+N/9A5M5QwkjsEhhCdD5VB9/Um9nUT3X1hiqGYYlOfPRkAT6CQw7ViHVUcTZ8/ge+clI0SNttU6qwmgmPSYIAOGk0dLhSjmbgy8CCfB+yc2kjy7lSfJiUTwZMPxKbweeLhCHzqGF1qx5Nda/A3m+rVkBLtl/1t7Nn1W+0MCEAdNN4udMCqMra2FOlvbgVS27jr2/eZ9eVn3jDdyy78g==; 31:v59yUlGJWp3umvD3kjOonC7z5md/hjHOWiLQTYLbujCwxIeWRmqTvfiV6NGB6Gxi6YfvHw1yh4BjifQpdH1ltmVpTEWCobS6MxfHO168mTtwCuGjSn25/5lYPB57UIfJkHuzzTrAIemHIiaDqTO9O81FvYfkCOpN9hhPnmlAlEdKq0KOyTt/zA/kD9RmgMNnt06/x1mHT1khfPfwwCstO9gBfi88aDPGmh9wkC6AbYg= X-MS-TrafficTypeDiagnostic: DB6PR0401MB2422: X-Microsoft-Exchange-Diagnostics: 1; DB6PR0401MB2422; 20:nFM41YzGt+ii4+YDluWeUvAokzY29+NKZ69yaCne2hjKyeOSJeQLK2aVKOKAjFfP4M9PUnzFFJPwaDrm+yXkpu9TJMfoka/I9z6Bb5+UQtVrTo/SUCx3doIYYQeBCGhm53/Bpf6dAOh7+nP5NVXB7nM/4aIE/Kg5PpjZhjh16n8R5lUwbizXbWaVt67oIsCln6JR3gKg0wlPlI8SCESV0TChPi7ANU+P3qxS5mHM1h/XTqKY46BfkL8jh/o4zbOYtTVipoajqwrwZkKANtM5lyCFj7n7qIvSbHHrk5PdAmUIltvAFyG3xfI+hw+uFAd65mdInCZnpgpc0MLPqLurPLHKmixUdri6e8NXeN0E1pWaiTLhNxcOd3V1CPBJ9M3JkdzMztqQEG9RwuLaV3rFcN4cPOO1/8EBXPJmxJ/jhloSri03gTYs5B6oODkKzRL2/vov1S29pFcer2ucO6mbBKs0nV7MrzU48lXOd33vC8zCujlBJCsg1X1T+mY3w8uW; 4:2Klxxge1FieqI8TDTGp35KsB52UwWIenZL/VAJd1gDAY4l8De7e/oqHXx4k2N6OfS6U0+w/mItKq2u3X0OO34tbo0iuNFxbTjZEzdIrOUoHDkIJy9GHvLj07aRizUnZYk1XpoA5WnQ2Q7zFo08HiTA2+v2fx/IFonfDB7QCqtV3AFFx27w7fMEjKYav4VFbimIEdT0DJQl6gVhKP5a8Xpm5aMpy3NbfA8hnxxcyD4gQqE9yFQZ/y9UJ1h2hN/JTomrBtWtL6dG6yQ6uc0rsbHEPHA2BEeQKujtbSuzDt3jdxYROVB6DPdtsxX6X6ypOhj3WFpqlyhQFrUO7Wn5WZTrg1XFP3tCSCFIV7QC4+y5p4fJYuHr1fQw9Dve8bVDlC 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)(3231254)(2232076)(944501410)(52105095)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:DB6PR0401MB2422; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0401MB2422; X-Forefront-PRVS: 06628F7CA4 X-Forefront-Antispam-Report: SFV:SPM; SFS:(10009020)(396003)(39380400002)(376002)(39860400002)(346002)(366004)(199004)(189003)(51416003)(53936002)(59450400001)(52116002)(4326008)(8936002)(105586002)(386003)(305945005)(6506007)(26005)(50226002)(55236004)(446003)(186003)(81156014)(5660300001)(76176011)(8676002)(5009440100003)(11346002)(25786009)(68736007)(7736002)(44832011)(106356001)(316002)(575784001)(16526019)(48376002)(478600001)(6666003)(476003)(3846002)(2616005)(6116002)(16586007)(36756003)(6636002)(81166006)(486006)(956004)(47776003)(6486002)(2906002)(50466002)(86362001)(6512007)(66066001)(97736004)(59010400001); DIR:OUT; SFP:1501; SCL:5; SRVR:DB6PR0401MB2422; 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; DB6PR0401MB2422; 23:kYJWe2HBLbiWbonx4U9UV7BYdnf4vAKq27V/1jU?= =?us-ascii?Q?BdmD4am0qUA7BbM2wdONo6uqPsAA116wHCJvUWs9LKqub+dyMhpm4LiUW7nG?= =?us-ascii?Q?sZFYsy4Uuv+PqdjFgHk0Xglz7n6F2DWyqHs+LU0Jr2jyEvsLan3/yAi3/D7F?= =?us-ascii?Q?VTYeHODpLZgwwU97TT4KYJoIM9u68eLwmHao8h9XfNsceuiBcaEJEbt6DecP?= =?us-ascii?Q?pykkejy/ojXMvGee+L68gQLvrY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8kMQE6wqIoO3i9dQdveEdnfujRUveeibqqLuocrKH0jluXWaBL0rQ02ExgwKLNV2wsqm1DS8DqCAv3k1cYmg/a6TJ6Vp5hq9is1T2FV8sFPBHY56znUgGaqsge0IBNazGWggnXhTO4EsUeGtwfweLew9QBMhZ19ooMWyrc7lD7LHfY6bzonU7zg6m339bsZkbB233wNNRiRQ93LkAFvPWGrFhvN+TddIStkuUs36W33LEuzxKUDtVsRRf5KuXM0tfW+BB5UFvIYhTND8pKb2Hd0aeMd5tRKySHjyivquhpxsNc35FH+OirilbeajVI5vjfEtlMR1eyQXsJaUEAz4Adv/91A6aXHEkuiEPt3VWRonDJm0EM8Mrx56JWsyxAUcUcFFfFs/i5JIkfKAxefie4d+MNj; 5:vBXzwi0vHD+3Cy5gXQ1Ko7g/08k6bf3KAVAaDsnBIfHDzdykgmhJsGzKIoOM8EEddDZTVuqnEYQvefNKAvUqfQLk1DjLy4j8H9NsGkXYXA9xNZ0o+1umyyCg2i7Fb68UWIXtYFGiZsoryRIBt5w3fFy9B4kRMwBvWhEgyNi/+SY=; 24:wKMplw5WLxBuoG0hno4Sl5w7T/CUI5+AJsZ+vSSjbToJ2w8fIe+o3nA2fHf6mA1dHdulm42PN2olkD8t658Jdw== SpamDiagnosticOutput: 1:22 X-Microsoft-Exchange-Diagnostics: 1; DB6PR0401MB2422; 7:Pm2yumGswQ3NAkR7wQWBKfyg6BfTYgJm8Ezxm8F8lcDf0gAJ9wGsluJ9k3WQXLiaFUa7y7kn35+Ro14GSw6XLqioSAwTSmgisSa7KOMvuGhY750/giei5d4CJNZUT5I7+zgpe/E+nn6cPSNA9Z0GWK9OeTHQj3c6NZ1jdYFxSDGR9Q184mvUnbt7Sxn6LOK+OJNE5Sck0pNjvSAbLl9NWIdtuSAcrGYdjSewNVP1G9/vWKTMdV9miSQbdVDcdl91 X-MS-Office365-Filtering-Correlation-Id: d9ea3b17-5f3f-482c-d6eb-08d5b1a77a2d X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2018 10:11:59.9177 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d9ea3b17-5f3f-482c-d6eb-08d5b1a77a2d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2422 Subject: [dpdk-dev] [PATCH v6 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: Fri, 04 May 2018 10:12:02 -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 | 137 +++++++++++++++++++++ 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, 230 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 8ee495b..ea804b7 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..789fe36 --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -0,0 +1,137 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#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.cmdif"); + 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