From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0085.outbound.protection.outlook.com [104.47.37.85]) by dpdk.org (Postfix) with ESMTP id 8F8D3559A for ; Sun, 9 Apr 2017 09:48:51 +0200 (CEST) Received: from BN3PR03CA0111.namprd03.prod.outlook.com (10.174.66.29) by BY2PR03MB396.namprd03.prod.outlook.com (10.141.141.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1005.10; Sun, 9 Apr 2017 07:48:49 +0000 Received: from BL2FFO11FD021.protection.gbl (2a01:111:f400:7c09::108) by BN3PR03CA0111.outlook.office365.com (2603:10b6:400:4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1019.17 via Frontend Transport; Sun, 9 Apr 2017 07:48:48 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD021.mail.protection.outlook.com (10.173.161.100) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1019.14 via Frontend Transport; Sun, 9 Apr 2017 07:48:47 +0000 Received: from DTS-02.ap.freescale.net (DTS-02.ap.freescale.net [10.232.132.223]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v397mBLV024015; Sun, 9 Apr 2017 00:48:45 -0700 From: Hemant Agrawal To: , CC: , , Date: Sun, 9 Apr 2017 13:20:15 +0530 Message-ID: <1491724224-6319-13-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1491724224-6319-1-git-send-email-hemant.agrawal@nxp.com> References: <1489754838-1455-1-git-send-email-hemant.agrawal@nxp.com> <1491724224-6319-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131361977280100987; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39860400002)(39840400002)(39450400003)(39380400002)(39850400002)(39410400002)(39400400002)(2980300002)(1109001)(1110001)(339900001)(3190300001)(199003)(189002)(9170700003)(4326008)(85426001)(8936002)(6666003)(50466002)(48376002)(86362001)(53936002)(54906002)(36756003)(38730400002)(2906002)(2950100002)(189998001)(356003)(104016004)(33646002)(305945005)(47776003)(5660300001)(106466001)(8656002)(105606002)(50226002)(81166006)(8676002)(76176999)(50986999)(5003940100001)(77096006); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR03MB396; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD021; 1:mnNJdouC76Ae+sM2a1X+MuueZnRbcaBpY06XFpt64tGQbxK2HGhy5/qGiGQog0372V4UAsS5/9PdVFHYwndF/G70d6+7jhH7rXaBe3x9HGC4pm+vRKt7tySEKyXqzFSAEDm+rCJqYha+eUUu382neJcjYS6DEJpM5iJUxJmZGwXX+zuxIp/cFku6NFmBDYfyitgm2Wgwtblsh1Cv15yTsGTYdnL5argNOXzF3uul1D781Iy5U+QS96JuWUpBL0giNIwaq4LiZ7fnrT1U6RxQHMEe/6EWt/ynBK8rhX5Cz5uCCBWi3VJSGoB1KA4DdRQtqFQRdWOHQArhkDWmA58of+EKPkzb4baJySdmzqXssvNJkhIiy2xUs2lQqYovkJLlryGumwWSI1ugepmOZTzUmsazSypQvYLyrXtmnETMMVedw5HgD7F997NVsoOx/3QyUNXj7rWSHG7mwXG9cE4JOv4jbKmoGVDBrRW8/kdfmHwLj9q6CoZics2Dp6mMw3gg1vqMWU7ZLudyGtvXJ6edCTcPS6NKwsqHQyuYY+oyvthI0R3p7YSjPk8/AV0bnG+pd8IYIW4J4crGjXaeL8djTGX8fQTDxDxZwXD2jjxyJxHthtxTLDbl8cKSwvawxmv+JetGheZfeq2vaCxEZwayhuAFmIMTtdX3DHlJuSedf7L3ALrHGuLEAf2XKGskqspx MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: ca49f8d4-ed60-441c-8e12-08d47f1cdb27 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:BY2PR03MB396; X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB396; 3:Yc4Exp0LWAGXdh7oRO9Map9Qrw66VYNrOs+zhZix6D1jcrsnMH5nWzVQHWMQPqHoRjxmfMWSoP3DMsfz+lPZ/M3vn44vkmreX+Q0MMKNrnHdPvJiajHuSUg8e4bs957glAATKwufqsoJ+47OQsJA+g+4HaupgOQWa8imf58RKkhb/aOGoivlWvXruQuVpegiQCfI4z28dmeCud77WrDdIse6UGFyMTNwxXmWY0NhcLxYTVLx6OdTjV70tMhiiXJn42+KMn9pGuMMJ7T1XaZPnriQOxPTrMx/03KNXh4FxQOp2lgyI6fo2B7/8EQ90uEMldSfoGdXW7TLPlfmvP1+0tKmCC662EPdtQWBHzIAjFh/NrMEhsg3x+O7Rxi6yHsy6D8PoW1x7VTLxU/lcifjIdykTU1LR6rpNDinXwLWo2jMQu1at+ytN9aIEHyrdksm; 25:2G4LMddXfHdU/cVn5ovYsCk65wXVwvylsbu5lXS9Y228bnJuN2GBmyKGDTUeQjfe3RIeeq5Wy7pUewpCyftgCUpUVzMOsFzdTut+UHh2/MkhTs1w9+z6k3bHxHY919riwLbU4swRl3VPJKboNAkjUPLgawcm91m4CPomM6Q5zGdKpQIoF15rdhkz7F9PQfsXGWQhn4WJQnN9/FLcttHJITCmAFAmStxfxUy4YIPpNolTnDGmSWTBQNXT4QXbz66kWpr/XuXDc9OU3eutxRdr3JD2XM7ePBn8LqQo98SqlHjg0EsEYt6TvLduyJr9MAE2nZFX+GMf29I7CUxrjmml1OY4uXpPBobyCD+wTtIQoWGuvxjc6Mgk3b+P3GvIuC2rAvivxC6wbtE2GA04IBQYfNvrg2RnrJ4+AsykWD+TRWJ2IYUj4KcnugeP0Qt9Gi1AjKTRtXWAkMukPoQUVM133w== X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB396; 31:uU1BOV/J4KWYLNF+5Fdnrcoq0V3462DX8LZMZrbY8itkjeto1G4DiJw8852XLs4DNSxU/10CfUYJgr1I84462mHENxqP4xDLh6WJnAuYNgGC4PRKNSEOzWVtoJF/nwQTBuB67YRvRKxiYrUzG67XK+GjFSRDREDxlhmhVfy99U7xdWzXMCtbCyvQx9Uzh64pFOgevNUDa7lmzUonEgfK6ypQzEFp8G1bWZwamehP0OSJWznSjKqXMA3PZ9MlDFixqR4bjjMx66k73tSdx2uFeg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(8121501046)(5005006)(13015025)(13017025)(13018025)(13023025)(13024025)(10201501046)(93006095)(93001095)(3002001)(6055026)(6096035)(20161123556025)(20161123563025)(201703131430075)(201703131448075)(201703131433075)(201703161259075)(20161123561025)(20161123565025); SRVR:BY2PR03MB396; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR03MB396; X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB396; 4:2Xs4PpyZC0zf9PYZLwf4udRxQsgMc73zMYwUOzs+YsFc5BUynYlqSi416tDYr3ryeU1c9Stdb/eQ9l/vd+/lo3rXGU82YhotFqYOuyFyQI8b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bln1Z92nSwW75Jt0C1Ldov2x14hVxfk170JBao1zagFT9SeWmz?= =?us-ascii?Q?omGIDciZS4aEA8LF34CvrD3E0T5sAhKDsVZ8U1sGVa5Zozt3tQsdWqITJl8S?= =?us-ascii?Q?zvVvmVI4UPlh61RMWiqRF0YKPT9+USo42IUTu/2i+g8Gt2lyfRCLfDLuYQLY?= =?us-ascii?Q?xLmURPqExiJ2A=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB396; 6:mE7N3G40DQgKttuPreMoEoEvYV4t76y/AjwxHHahbrWelQztg1ZuS7nWtMX1OFdIm0ZSvYB2d8RNqP8il6SwIHtcwwHAykfu+oa5YHcdFEhhvzzDU7YqpBB+MhPlb61sX0dxEEwXePol+RrmCGAqMjKJOKtpH+J+xn6bMjvHP+A14EV0G9r/j1s7BHIwc1UPWaq9fLN5TxfOlZ89YuUkKSTtD/L+SExPuyt08Xw5TRBGo035KeP+ZMgF/AE6CsfHETpokkDuu0V6kkyrkZUaIzOZal0OwV3nTRNA90ZJlcxsRfJOOplgx+Ma/ZRdd85a8VNUu4UtR5wzHIABCz385WkZAeZ+HtrpovGf/aXeWgD5jInG14k89dR3vHVm2L08TcEKQea/83h6z48fDjfuH858pRt/Ar2to7hkYUaZlqJq3pX6CoiSrZmQzNjhqVvk3hjxg+UlzCHLD44/502Yjw==; 5:9zsSkCACzlox4YKFLmU16rZs/jTDmRsrqD+32Fijd8Q5r18fK/GTzZ0tmrzZVuWLgeqxYyx9P0zZEr8ng+Q58b3/wBlEsvyNkfhFpqQWYxBFe8Ydc82w3Dt9y84vG+UWJ0FBmRY5nDua8X15vdBR2TyFYtrM86vzVBPsagtbkcPpB70IWoccW2oHU9bqt1v0; 24:acvt0oOb8uRjbEZhjdRWTp6F8fPtZf776+aR/w5eeCAamoim/CTRVGh/5NXeNUioT3zKcSpXYOpKvLpVBpzEziv83E/MyMTP7+ygitdOa5g= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB396; 7:vCOJKBBM9UlailV2HPRmjZzgpcEhEfEfN74I7LmsnlwqHUxaOe3FKG4xagWJNWj/g8XlZutQboM9kgI17rDM/s+N9I2rn3Cq/M6wZkPLO7oUwolhu9iLWe97u7yLvvsrWLKSH5ZCundRWGZ01eH8+bjGeqehKktfxHFKEMQr4qEfCUW82kFezs2A5k4LlDY2ftz2ezzjCmIaQh0G6fAfZ3plMUYw+lQDoLY37KvOaIJGB6yoCNCQytnveNnu9XuW8vkI7k5EJjmyKfBmlL77UCtbZdn9kNhMvyC2YS55AhWX4ldt529P0VYesOOwIypippbWAYvQHXbjFNZr232W0w== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2017 07:48:47.6980 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR03MB396 Subject: [dpdk-dev] [PATCH v3 12/21] bus/fslmc: introduce support for hardware mempool object 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: Sun, 09 Apr 2017 07:48:52 -0000 Each mempool instance is represented by a DPBP object from the FSL-MC bus. Signed-off-by: Hemant Agrawal --- drivers/bus/fslmc/Makefile | 1 + drivers/bus/fslmc/fslmc_vfio.c | 9 +- drivers/bus/fslmc/fslmc_vfio.h | 2 + drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c | 137 ++++++++++++++++++++++++++++ drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 18 ++++ drivers/bus/fslmc/rte_bus_fslmc_version.map | 2 + 6 files changed, 168 insertions(+), 1 deletion(-) create mode 100644 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c diff --git a/drivers/bus/fslmc/Makefile b/drivers/bus/fslmc/Makefile index aef53fd..a9828ed 100644 --- a/drivers/bus/fslmc/Makefile +++ b/drivers/bus/fslmc/Makefile @@ -68,6 +68,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += \ mc/mc_sys.c SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += portal/dpaa2_hw_dpio.c +SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += portal/dpaa2_hw_dpbp.c SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc_vfio.c SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc_bus.c diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c index 7398637..d28fb7b 100644 --- a/drivers/bus/fslmc/fslmc_vfio.c +++ b/drivers/bus/fslmc/fslmc_vfio.c @@ -270,7 +270,7 @@ int fslmc_vfio_process_group(void) char path[PATH_MAX]; int64_t v_addr; int ndev_count; - int dpio_count = 0; + int dpio_count = 0, dpbp_count = 0; struct fslmc_vfio_group *group = &vfio_groups[0]; static int process_once; @@ -421,6 +421,11 @@ int fslmc_vfio_process_group(void) if (!ret) dpio_count++; } + if (!strcmp(object_type, "dpbp")) { + ret = dpaa2_create_dpbp_device(object_id); + if (!ret) + dpbp_count++; + } } closedir(d); @@ -428,6 +433,8 @@ int fslmc_vfio_process_group(void) if (ret) FSLMC_VFIO_LOG(DEBUG, "Error in affining qbman swp %d", ret); + FSLMC_VFIO_LOG(DEBUG, "DPAA2: Added dpbp_count = %d dpio_count=%d\n", + dpbp_count, dpio_count); return 0; FAILURE: diff --git a/drivers/bus/fslmc/fslmc_vfio.h b/drivers/bus/fslmc/fslmc_vfio.h index 39994dd..80c6869 100644 --- a/drivers/bus/fslmc/fslmc_vfio.h +++ b/drivers/bus/fslmc/fslmc_vfio.h @@ -76,4 +76,6 @@ int dpaa2_create_dpio_device(struct fslmc_vfio_device *vdev, struct vfio_device_info *obj_info, int object_id); +int dpaa2_create_dpbp_device(int dpbp_id); + #endif /* _FSLMC_VFIO_H_ */ diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c new file mode 100644 index 0000000..894f632 --- /dev/null +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c @@ -0,0 +1,137 @@ +/*- + * BSD LICENSE + * + * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. + * Copyright (c) 2016 NXP. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Freescale Semiconductor, Inc nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include "portal/dpaa2_hw_pvt.h" +#include "portal/dpaa2_hw_dpio.h" + +TAILQ_HEAD(dpbp_device_list, dpaa2_dpbp_dev); +static struct dpbp_device_list *dpbp_dev_list; /*!< DPBP device list */ + +int +dpaa2_create_dpbp_device( + int dpbp_id) +{ + struct dpaa2_dpbp_dev *dpbp_node; + int ret; + + if (!dpbp_dev_list) { + dpbp_dev_list = malloc(sizeof(struct dpbp_device_list)); + if (!dpbp_dev_list) { + PMD_INIT_LOG(ERR, "Memory alloc failed in DPBP list\n"); + return -1; + } + /* Initialize the DPBP List */ + TAILQ_INIT(dpbp_dev_list); + } + + /* Allocate DPAA2 dpbp handle */ + dpbp_node = (struct dpaa2_dpbp_dev *) + malloc(sizeof(struct dpaa2_dpbp_dev)); + if (!dpbp_node) { + PMD_INIT_LOG(ERR, "Memory allocation failed for DPBP Device"); + return -1; + } + + /* Open the dpbp object */ + dpbp_node->dpbp.regs = rte_mcp_ptr_list[MC_PORTAL_INDEX]; + ret = dpbp_open(&dpbp_node->dpbp, + CMD_PRI_LOW, dpbp_id, &dpbp_node->token); + if (ret) { + PMD_INIT_LOG(ERR, "Resource alloc failure with err code: %d", + ret); + free(dpbp_node); + return -1; + } + + /* Clean the device first */ + ret = dpbp_reset(&dpbp_node->dpbp, CMD_PRI_LOW, dpbp_node->token); + if (ret) { + PMD_INIT_LOG(ERR, "Failure cleaning dpbp device with" + " error code %d\n", ret); + return -1; + } + + dpbp_node->dpbp_id = dpbp_id; + rte_atomic16_init(&dpbp_node->in_use); + + TAILQ_INSERT_HEAD(dpbp_dev_list, dpbp_node, next); + + PMD_INIT_LOG(DEBUG, "Buffer pool resource initialized %d", dpbp_id); + + return 0; +} + +struct dpaa2_dpbp_dev *dpaa2_alloc_dpbp_dev(void) +{ + struct dpaa2_dpbp_dev *dpbp_dev = NULL; + + /* Get DPBP dev handle from list using index */ + TAILQ_FOREACH(dpbp_dev, dpbp_dev_list, next) { + if (dpbp_dev && rte_atomic16_test_and_set(&dpbp_dev->in_use)) + break; + } + + return dpbp_dev; +} + +void dpaa2_free_dpbp_dev(struct dpaa2_dpbp_dev *dpbp) +{ + struct dpaa2_dpbp_dev *dpbp_dev = NULL; + + /* Match DPBP handle and mark it free */ + TAILQ_FOREACH(dpbp_dev, dpbp_dev_list, next) { + if (dpbp_dev == dpbp) { + rte_atomic16_dec(&dpbp_dev->in_use); + return; + } + } +} diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h index 6b44314..453fc10 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -41,6 +41,11 @@ #define MC_PORTAL_INDEX 0 #define NUM_DPIO_REGIONS 2 +/* Maximum release/acquire from QBMAN */ +#define DPAA2_MBUF_MAX_ACQ_REL 7 + +#define MAX_BPID 256 + struct dpaa2_dpio_dev { TAILQ_ENTRY(dpaa2_dpio_dev) next; /**< Pointer to Next device instance */ @@ -63,6 +68,19 @@ struct dpaa2_dpio_dev { int32_t hw_id; /**< An unique ID of this DPIO device instance */ }; +struct dpaa2_dpbp_dev { + TAILQ_ENTRY(dpaa2_dpbp_dev) next; + /**< Pointer to Next device instance */ + struct fsl_mc_io dpbp; /** handle to DPBP portal object */ + uint16_t token; + rte_atomic16_t in_use; + uint32_t dpbp_id; /*HW ID for DPBP object */ +}; + /*! Global MCP list */ extern void *(*rte_mcp_ptr_list); + +struct dpaa2_dpbp_dev *dpaa2_alloc_dpbp_dev(void); +void dpaa2_free_dpbp_dev(struct dpaa2_dpbp_dev *dpbp); + #endif diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map index 026b1be..3d5c1ad 100644 --- a/drivers/bus/fslmc/rte_bus_fslmc_version.map +++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map @@ -2,6 +2,8 @@ DPDK_17.05 { global: dpaa2_affine_qbman_swp; + dpaa2_alloc_dpbp_dev; + dpaa2_free_dpbp_dev; dpbp_disable; dpbp_enable; dpbp_get_attributes; -- 2.1.4