From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01hn0237.outbound.protection.outlook.com [104.47.0.237]) by dpdk.org (Postfix) with ESMTP id B5B8D7CC3 for ; Thu, 26 Apr 2018 12:15:34 +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=O77E6GAXWFgUPdD/aq+0FYglPoWx6Ujzt/EYP2lXPwA=; b=Kw0RmgvRjl/mgrSw7ZQYu5x6uSL9MXL+s0YQXGmeuECCv5SL/rJb/OSdLR3BCAgzvdnu27E47HG/11sUbZNDKo3CN5oIgKFhQi/lX5ohkeDo5FpHnFBeobuWKog/wJ+kfduZ5odfzbc/48F8V8AyhdkDggjWIcYPU4vspA2z6/U= 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 VI1PR0401MB2432.eurprd04.prod.outlook.com (2603:10a6:800:2a::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.13; Thu, 26 Apr 2018 10:15:31 +0000 From: Nipun Gupta To: shreyansh.jain@nxp.com, thomas@monjalon.net, hemant.agrawal@nxp.com Cc: dev@dpdk.org, Nipun Gupta Date: Thu, 26 Apr 2018 15:44:53 +0530 Message-Id: <1524737696-3145-5-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1524737696-3145-1-git-send-email-nipun.gupta@nxp.com> References: <1523111645-8076-1-git-send-email-nipun.gupta@nxp.com> <1524737696-3145-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: PN1PR01CA0089.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:1::29) To VI1PR0401MB2432.eurprd04.prod.outlook.com (2603:10a6:800:2a::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(2017052603328)(7153060)(7193020); SRVR:VI1PR0401MB2432; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2432; 3:hx4Nmi8VUaTAzqxh3nkxj4pA1jyrkL6oFj30REzfqt9iciI9BcGSRDmz5bFTfzn6XIAa1mRKtVjR6Bag8WwRTe9No4BTol7RCUw90DjhtoraBcpy+6OOSMQefUDHuEaG/PPGMVDnvzg9taB8VBtksu0rQfi54klfzdFKziltMpq02DNPBK585GdohH+0UU2sHABDNBKr+Qaz+yu3BKh4CoESwOLGFRmk9aEnwDRXTGm7ekwtA2nfvXAGPYNzFJ4/; 25:qdEYw8D0vRM8HFm7pPn9gQZQliRFNSILG1etDGkqAUbKE6/9WT36P0tFf119amImtUwvbcyiuaEOMT1yggNKX36khJ+yak0RfqQapaB5Y5uJyehQxiLHKMjYqqvMoo5FgixRwQOugL4b5uw6cFAnFMkmQ+B6rVrRBvGbsBy2fU34dHdYx3XswlMNEqtuKpyaxUq1iXYoQt+l9YlTwRgrTLg/qxEvyjvKNy36N2RUzVLSovV2pYrNA8nHpxGuZUSIcIY+r7n4Ow79j9nNw/QuJOFAYBzVl+N0bGUL0wgspXL92f6wEs1aI8qfgtQ5SytBq+98oqdMuWa40HmiYfyGhA==; 31:cJNpD8N/UDmvde+k0Ia20CmAWhUTTjBSiTSiRkfaVpZ405RJck7Ah6RXG9UcXfXWAqF9uZGUUaHEh5Tq1aEVP09d6s3QQpAXctbo5c1nf0WYBjCnUU/LynyOn3Hbl1v66v/TZGrYF+t5Yf9+Pe5yRXOIRIuffjuQdf6UBFu3hpIuWLSK4DPejvuvsg2r25gtt9BH/Mp1fIImwNP9N1SvXopXjUNXCYLEnQ0maK9TnvY= X-MS-TrafficTypeDiagnostic: VI1PR0401MB2432: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2432; 20:bakh3EpPAF+4PfMyn9tj/rR47HsdTD4/Iy4ampimBr8rjCAURFF/jmrgk9bmcJku4NFsltrCI70QBXX+CCGXmDuAa6U+jyJwUYK0/NtGTjvZW2ihEfw2OzLxOTLT5rKGYVbjTeW0/C3rKkzrv3WHOyL4LajBrkznQhrj8gbLj6+NU/9IalYa3yaIqwJ8BxkOhtgCuVJwgMmf5PrBPFJYa4kkYJ+XJ9iXH+leJIXL4ERnkAlrTCM/RfKlNBWvO5FCewO1v7mwieBDlwzU+eb3lge78/wIxcXsxCy/zA/aLdWDr0bs1NyojYFmCAxTCRyuaVlWO5t2FUVOUydPyHcmy7y50al4/256aC8Ge4ESDJG0hMWl5vo8vHbs5DByVEM7OWAGPRmpQhGpv+3GuwsXMVxNo+hlCi6iYv23xPg2zRhWvKTvkQCN8kOmc4yZhalU13mDgiVtE59MBT5cIcZ/K3PBMg+mJKuCmBOZBRR/q3sQ57x5GGnIll6674fjV+ZK; 4:KPydKyljSFTIAm04nlYGkcGQvbVy/BckUUkuqAftSM365hTf977OPFPYFRwVcXOmWUMkqBGxleZ0PYUT3eFrT0OexfzdN0Yg7wih1Ld3vMqoLjEerI3HbgR1JZnb8TmRtEdO6JvxSez0wMzZneQQMH8ePAlBtWR0YCpF7ZUt552Igi+f86BmTw0ZqmeTMggPGuVkwDky3C2NogIqvm5DUtBGCf7e4pcfmFvgRl0j4uapMp3EzzQckxS6L/7MZTT/IpxuTBf6GI3xVyuVdZMOf+qVhCAG9AI0VF9mcOzxSyz3Gvyl6fLwDCs0+idKIrmLxfaDtTR9OYP8KB6ZIX/2ldJBJtPfJsnV39NKIRwUi0JneNIcxCeXCXlbprfkrJH1 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)(93006095)(93001095)(3231232)(2232076)(944501410)(52105095)(3002001)(6055026)(6041310)(20161123558120)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:VI1PR0401MB2432; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0401MB2432; X-Forefront-PRVS: 0654257CF5 X-Forefront-Antispam-Report: SFV:SPM; SFS:(10009020)(39380400002)(376002)(366004)(39860400002)(346002)(396003)(199004)(189003)(106356001)(2906002)(3846002)(5009440100003)(6512007)(86362001)(575784001)(478600001)(44832011)(36756003)(7736002)(5660300001)(6116002)(486006)(97736004)(4326008)(11346002)(956004)(476003)(6486002)(2616005)(446003)(386003)(6506007)(16586007)(53936002)(25786009)(81156014)(59450400001)(47776003)(52116002)(16526019)(66066001)(51416003)(6636002)(105586002)(316002)(50226002)(6666003)(8936002)(50466002)(8676002)(26005)(68736007)(305945005)(48376002)(81166006)(76176011)(59010400001); DIR:OUT; SFP:1501; SCL:5; SRVR:VI1PR0401MB2432; 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; VI1PR0401MB2432; 23:YYWPK4i118F3ws5Rgs/Pm9rWK1bOFGMRuCsyWZz?= =?us-ascii?Q?BK9Kn+wDPCUT1R/BTbzGkZDEkagAXJfRO5Lsn3jjhLhDojUx2N/smetIlWYv?= =?us-ascii?Q?xBDH1qQK7vttrt/lFoQ1geFLy32TZwsvehVRA3QhcAPvihNKr33W3GcjlUjh?= =?us-ascii?Q?97VVpJu4mk3bQB//mE2XNpPMaYvYsvuBybRQ3YfFbspx8DmgWp7bPd5H1QON?= =?us-ascii?Q?YKPS9Rs63RJdk4e91+fLutm63sjFt8V7RXLo5ELFOXmqSlFaefBV20IQzxS/?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NpPc7eVAkFOpJklhuD1Q/DC7lkQkdIUWL1RQU/TmtOfrM8MPh1BlkvpCKRZXK7792gqZ/H5+qoGSCIMfoyY/GA3CHY1yqEHNPEBHBQUQyX3oXJCJdceKpnR5iPcHnsL+AEukmwh47YdHEM4HpCW1M9c3DlJCzE2+MOw79C1rY2NQkKFYHTDqaP2sislKcnzoDFhdBihFlhroEKt2bEkqb3AciQejpn4iE6UAUcZdZoam6v/51YOYcb0HIDFecjTEDGvs7PYJrDvWWKIBwa6wGZZ+5R4CY6xj2bxF; 5:Hkqk8RKXKhmzNIzBxsZCK5yKcL656k5sq9wMmezQCB1LDWPtRhKhoRiglkGSzuTm0nlBOzWVWqqNqepFwOviRXhJUU9OrJO8l2OViLny8d36yS6g6/sNVKbpyVFqSLMn2qgnobnM9bPDOwikWffNUXPA0zkpSbFuemgpj/irlC4=; 24:Fsqx81RorAv4qGzn9xc4M3VDzh3WKO9bP8tqcq656aWeQ/lxHLfGxrmRm2K1+EAZX8zLmw5/bpwntV5U2rZTXg== SpamDiagnosticOutput: 1:22 X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2432; 7:8B9zzTfbOkwKx/9j2gC9h3btAIpVHGrDx8ZHUttDKnWdkJCMwO6nt8I8b0R5Dkt9eG0hXZGuLEx6bpcdMMCs0tF1r0HTTgnWDqnaigXq8mVvZxwiH7C4JVca4FIyr+3GJ/yFIQ7moqcXZH87Ob2uu665Dops9VGQCu99yDOZ2t1pCKzFavw5rjArdXfJ/rXTJAFyP4pQHdOLECEWmcNDtzPQKHh7Cy+jU0LjoRdhFTGeDuTEf4w242Gi2mTrTTTU X-MS-Office365-Filtering-Correlation-Id: 5c955609-987a-4019-be33-08d5ab5ea538 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2018 10:15:31.9402 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5c955609-987a-4019-be33-08d5ab5ea538 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2432 Subject: [dpdk-dev] [PATCH 4/7 v3] 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, 26 Apr 2018 10:15:35 -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 ++++++ .../dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map | 4 + mk/rte.app.mk | 1 + 9 files changed, 223 insertions(+) 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/rte_pmd_dpaa2_cmdif_version.map diff --git a/MAINTAINERS b/MAINTAINERS index 6ad6d81..0871af9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -791,6 +791,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 f69e867..8034403 100644 --- a/config/common_base +++ b/config/common_base @@ -617,6 +617,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 f752a0f..0e83163 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -37,4 +37,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..0d98d36 --- /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("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/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/mk/rte.app.mk b/mk/rte.app.mk index ff90dec..ce1fd3c 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -248,6 +248,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