From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01hn0242.outbound.protection.outlook.com [104.47.0.242]) by dpdk.org (Postfix) with ESMTP id 5B427BD34 for ; Mon, 16 Apr 2018 15:30:06 +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=mOxJ+gaIip0prTR2N7DUJ3AvEu/znJ4QR52GLDNEyb8=; b=AcgI3AskEuipjJ6K6QjXFjz5ddryv1c6QZDDxnUaTIufANqLD7bQD9ONXxBr2NhCKtwvYmF+wZ8lx2SOJNyA0FP8zNcYQkCuOcTxVxhfuz/T1DwEk2PVGnbkcEgrWdmndh8k68S2XogrRRdGgREi13Z+pJT+eqmn6g80dAMKs48= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; Received: from [10.232.14.39] (14.142.187.166) by AM5PR0402MB2769.eurprd04.prod.outlook.com (2603:10a6:203:98::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.675.10; Mon, 16 Apr 2018 13:30:04 +0000 To: Nipun Gupta Cc: dev@dpdk.org References: <1523114224-9852-1-git-send-email-nipun.gupta@nxp.com> <1523114224-9852-5-git-send-email-nipun.gupta@nxp.com> From: Shreyansh Jain Message-ID: <1c360969-f732-4130-dd56-fd4672ed0da7@nxp.com> Date: Mon, 16 Apr 2018 19:16:18 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <1523114224-9852-5-git-send-email-nipun.gupta@nxp.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: MA1PR0101CA0068.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:20::30) To AM5PR0402MB2769.eurprd04.prod.outlook.com (2603:10a6:203:98::11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603328)(7153060)(7193020); SRVR:AM5PR0402MB2769; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0402MB2769; 3:V3W3OZ0QL1kV4l4/lt6Md7OwDhPZMeKCAV32MqYOArr6dlubdUHL2gWlTTMZ7nEDl0LO+4JIm1LSwafab3U2GJTn/AfKXJCnT+3Wh64M1UtcrTPLWCnfLmUYnokCjZ8VULEi8De3fhNjKRQqyDmGGs+voIdoAHzU1iWTCXs2tQr08N4R3OrdcQqBeaFPYUSqBVI5aLs/nIeTMSkM9ohYm6VP5vEYq9no9RiLRZIb0frsk3N18aMUxIrPZGZZxecC; 25:J38ijB3yxIPuNlqeEau6EFhUxFM7Cw5TFgeNWWjdBsFUX0UIWszoxPWAN+Lqb2CzDuvJ74Iajva6p6k2BqZFhFeHfANG06RjsxBbZdotkjVHb3QYe00fd1wD6h/jAPwDxEoV+XeLGP71V0uAjl80KgR2FcmLd3vMqmUt8RJiCCA3KXUnwJ4xeEchvUqPM+d5GPUGdgGid3ts6U+IMIsqeqbG+5UlClJjhZczgFO7RJF9G5VAnkwURxU4Gd38Sngy9AeO23lZ+stHUr74g3JUaSzT53wVEUY3tv/h2Jw2oOEWbSTxUPHYtcKU1bPWlX24UQOsAl6SITdaJJk9T/HZew==; 31:w8cOeJPBJ+5Bx6Y/EDYnGF4+ZZk5ET+xfaVou4f97AjveAucB33be8Bj/GHx3vULByaDPMzvJdtz6BAmhhiNsh/eRYHA8SIs2lB+/SNiPp3OLVTc0M0XvmDn6uIyFVb+6KkwRq9rTZPQ7dXhQTE1Ed/2pUKyMubY//NSIdoj5Gy8K9svrNiqR9j+3H+TCiS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386973197)(66839620246622)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231232)(2232076)(944501327)(52105095)(3002001)(10201501046)(6055026)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:AM5PR0402MB2769; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0402MB2769; X-Forefront-PRVS: 0644578634 X-Forefront-Antispam-Report: SFV:SPM; SFS:(10009020)(6049001)(376002)(39860400002)(366004)(346002)(396003)(39380400002)(199004)(189003)(4326008)(25786009)(305945005)(6486002)(81156014)(81166006)(64126003)(229853002)(478600001)(59450400001)(55236004)(47776003)(26005)(386003)(8936002)(50466002)(66066001)(86362001)(65956001)(230700001)(16576012)(7736002)(5009440100003)(44832011)(2906002)(65806001)(11346002)(97736004)(6636002)(446003)(52116002)(2486003)(52146003)(65826007)(76176011)(31696002)(476003)(956004)(2616005)(23676004)(6666003)(36756003)(68736007)(6246003)(8676002)(31686004)(6862004)(53936002)(316002)(16526019)(186003)(37006003)(6116002)(3846002)(5660300001)(106356001)(105586002)(77096007)(67846002)(58126008)(486006)(59010400001); DIR:OUT; SFP:1501; SCL:5; SRVR:AM5PR0402MB2769; H:[10.232.14.39]; 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: =?utf-8?B?MTtBTTVQUjA0MDJNQjI3Njk7MjM6bUF6SjZLd2dWUVhsM3cvcXFhQ2FCdURW?= =?utf-8?B?dXJmOER2MU9mekRWUStVbXVQMkFEZk14YTVYdkQ1djR0L05IQ3MzV29DV0Zl?= =?utf-8?B?WDY5dFNjUGc1NlBCdS9zanZPUnBpL1NNLzVLcDZGYk1vdnZ5R0hwSDZhYmtB?= =?utf-8?B?d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ZqS7pDJp0YlSnTtpLR/4LHjyXdyT7GUibL8aGVftr36Yc6ilwP3KMQbl8a33u0qt9VoQCLzrU8N0MeVTdd+Y8dD/IDKFKmQ9gE+1GmpPbK9XVDEZwy3ZoRw5+/kfy/LrF/3f2ERcPkA57CeZCan+KjalaImVkgWChhQEHIH7QDugDR9xN2dFVehnpU6Y/fteM4c4flvsHe247A8uPkrd4OGG7IOLJRnmBaCr649Grfgr79+zdpFyfjqAEJz7QiAMPvXBAqm1XOoDpkiUhrdTx/Rqsrhh9HPFfo6Zishz9ozP5xakicFY+cbia8LRCLD/j0XU6pR; 5:apJjzeyuKFyZTP+Kq+6RERHhRflLxxxXIl9uy/pBZH6CCaYK2Mil2YrPpnfhWv+tlL1qc2geEG+RHG6mUy/uFJdT0h/mm6le0H0YdF/t9h6wLVXVdyq4Q1ttHRgmIO75s1ZaJyYo6pWZ9e0vo7UMjn9NIANBzdDscgxRS+PNqns=; 24:apRUsyAvcztCd6YlWQrPTmeKjco52rVvDzCcuU60o+XISFwISras866SUVG0+b+W8rF/+ydoF2cnl80MKP/h6A== SpamDiagnosticOutput: 1:22 X-Microsoft-Exchange-Diagnostics: 1; AM5PR0402MB2769; 7:RDJ1DJn5jjN/DshQUXFBKCwg20tQbQ1V3HTI59Wlt1n1oNyOOy3ARxGDbOdYH9m26dkFrpvCZ+mIfKAvHyvnIV9zBdz536eTQcQj8l3YVO6/TDrguKhJUWPE3qPNnzzchSECISHr6auD68ZOrlDknhpqEMv4qHkZ160H3z0bFzLAumAjeV0n9XFV/EmDYOUa2oPA0fduKbGvk8bAZ1dt9JDljVje+aMzlfNjQqY54TPzLSgyal6sJV7batpr+ZVb X-MS-Office365-Filtering-Correlation-Id: a4e3bc84-36d0-4d07-c281-08d5a39e2a3b X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Apr 2018 13:30:04.4481 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a4e3bc84-36d0-4d07-c281-08d5a39e2a3b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0402MB2769 Subject: Re: [dpdk-dev] [PATCH 4/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: Mon, 16 Apr 2018 13:30:06 -0000 On Saturday 07 April 2018 08:47 PM, Nipun Gupta wrote: > 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 > --- > MAINTAINERS | 5 + > config/common_base | 1 + > config/common_linuxapp | 1 + > drivers/raw/Makefile | 1 + > drivers/raw/dpaa2_qdma/Makefile | 34 +++ > drivers/raw/dpaa2_qdma/dpaa2_qdma.c | 290 +++++++++++++++++++++ > drivers/raw/dpaa2_qdma/dpaa2_qdma.h | 66 +++++ > drivers/raw/dpaa2_qdma/dpaa2_qdma_logs.h | 33 +++ > .../raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map | 4 + > mk/rte.app.mk | 1 + > 10 files changed, 436 insertions(+) > 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/rte_pmd_dpaa2_qdma_version.map > [...] > diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c > new file mode 100644 > index 0000000..4b7fa13 > --- /dev/null > +++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c > @@ -0,0 +1,290 @@ > +/* 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\n"); I think the definition of DPAA2_QDMA_ERR also contains an inbuilt '\n' - so, it would be double new lines. And this is valid at various other places in this patch. > + 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 int > +remove_hw_queues_from_list(struct dpaa2_dpdmai_dev *dpdmai_dev) > +{ > + struct qdma_hw_queue *queue; > + > + DPAA2_QDMA_FUNC_TRACE(); > + > + while ((queue = TAILQ_FIRST(&qdma_queue_list))) { I think you might want to revisit this. TAILQ_FIRST will keep returning you the head of the list. TAILQ_FOREACH_SAFE is what you should be looking at. > + if (queue->dpdmai_dev == dpdmai_dev) { > + TAILQ_REMOVE(&qdma_queue_list, queue, next); > + rte_free(queue); > + } > + } > + > + 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(); > + > + /* 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\n", ret); > + return ret; > + } > + DPAA2_QDMA_DEBUG("Opened dpdmai object successfully\n"); > + > + /* 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\n", > + ret); Should dpdmai_close be called here? In case there is some state managed in the device which might impact its opening next time. This would be valid for various errors generated in this function. > + return ret; > + } > + 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); > + return ret; > + } > + > + /* 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\n"); > + return -ENOMEM; > + } > + > + 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\n"); > + return -ENOMEM; > + } > + } > + > + /* 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); > + return ret; > + } > + 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); > + return ret; > + } > + 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); > + return ret; > + } > + > + /* 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\n"); > + return ret; > + } > + > + return 0; > +} > + > +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]); > + > + 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 > +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\n"); > + return -EINVAL; > + } > + > + dpaa2_dev->rawdev = rawdev; > + rawdev->dev_ops = &dpaa2_qdma_ops; > + rawdev->device = &dpaa2_dev->device; > + rawdev->driver_name = dpaa2_drv->driver.name; > + > + /* For secondary processes, the primary has done all the work */ > + if (rte_eal_process_type() != RTE_PROC_PRIMARY) > + return 0; > + > + /* 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_DEBUG("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); > + It is better to not add a new line here - that we we can relate the function below with the INIT macro above. > +static void > +dpaa2_qdma_init_log(void) > +{ > + dpaa2_qdma_logtype = rte_log_register("dpaa2.qdma"); The string for registeration should be of format 'pmd.raw..'. See SHA: 7db274b9ada2221acb7110204a3b2c6a37d2614a for documentation. > + if (dpaa2_qdma_logtype >= 0) > + rte_log_set_level(dpaa2_qdma_logtype, RTE_LOG_INFO); > +} [...] > +#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..20902a8 > --- /dev/null > +++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma_logs.h > @@ -0,0 +1,33 @@ > +/* 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, "%s(): " fmt "\n", \ > + __func__, ##args) Some logs don't need to have a function name associated with them in output - especially the error messages. All the macros here have '__func__' as part of the output. Can you rethink if this is OK with you? > + > +#define DPAA2_QDMA_FUNC_TRACE() DPAA2_QDMA_LOG(DEBUG, ">>") > + > +#define DPAA2_QDMA_DEBUG(fmt, args...) \ > + DPAA2_QDMA_LOG(DEBUG, fmt, ## args) > +#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) > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* __DPAA2_QDMA_LOGS_H__ */ > 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..9b9ab1a > --- /dev/null > +++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map > @@ -0,0 +1,4 @@ > +DPDK_18.05 { > + > + local: *; > +}; > diff --git a/mk/rte.app.mk b/mk/rte.app.mk > index a6828c8..f2c778f 100644 > --- a/mk/rte.app.mk > +++ b/mk/rte.app.mk > @@ -118,6 +118,7 @@ endif > _LDLIBS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += -lrte_bus_pci > _LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += -lrte_bus_vdev > _LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += -lrte_bus_dpaa > +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA) += -lrte_pmd_dpaa2_qdma This shouldn't be placed between the bus linking instructions. Maybe somewhere near the other rawdev PMD would be better. > ifeq ($(CONFIG_RTE_EAL_VFIO),y) > _LDLIBS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += -lrte_bus_fslmc > endif >