From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0085.outbound.protection.outlook.com [104.47.32.85]) by dpdk.org (Postfix) with ESMTP id 31A9FF963 for ; Thu, 19 Jan 2017 14:25:10 +0100 (CET) Received: from BN6PR03CA0037.namprd03.prod.outlook.com (10.175.124.23) by CY4PR03MB2471.namprd03.prod.outlook.com (10.168.165.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Thu, 19 Jan 2017 13:25:08 +0000 Received: from BN1BFFO11FD017.protection.gbl (2a01:111:f400:7c10::1:122) by BN6PR03CA0037.outlook.office365.com (2603:10b6:404:10c::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13 via Frontend Transport; Thu, 19 Jan 2017 13:25:08 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com;nxp.com; dkim=none (message not signed) header.d=none; 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 BN1BFFO11FD017.mail.protection.outlook.com (10.58.144.80) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.803.8 via Frontend Transport; Thu, 19 Jan 2017 13:25:08 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v0JDO4es015351; Thu, 19 Jan 2017 06:25:05 -0700 From: Hemant Agrawal To: CC: , , , , , , Hemant Agrawal Date: Thu, 19 Jan 2017 18:53:43 +0530 Message-ID: <1484832240-2048-19-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1484832240-2048-1-git-send-email-hemant.agrawal@nxp.com> References: <1484679174-4174-1-git-send-email-hemant.agrawal@nxp.com> <1484832240-2048-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131293059086569384; (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)(7916002)(39450400003)(39380400002)(39840400002)(39410400002)(39400400002)(39860400002)(39850400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(54906002)(8656002)(626004)(86362001)(104016004)(36756003)(85426001)(77096006)(38730400001)(81156014)(81166006)(6666003)(8936002)(2950100002)(5660300001)(110136003)(6916009)(50466002)(48376002)(53946003)(50226002)(305945005)(356003)(5003940100001)(8676002)(92566002)(53936002)(189998001)(33646002)(68736007)(47776003)(97736004)(76176999)(50986999)(105606002)(2906002)(2351001)(4326007)(106466001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2471; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD017; 1:f2ftlFupx19RzS0zCYhprWpLGmCYLgXVtwF0RU7i8KNT47lc+hG0O8OTL7TweQHrPGWtYlio59BAfkyqjc3EhhXc75SyxhJ+N/mBDSkRqy1EilhN0UhL+xY3miZ2v+214jBUgLfGmz9cBc63wq0jZzXAYLi1z1d3GS51iqLG5tcz6kDAsVdWXOkExPduPpeQcoa3EMz3PEoac2CcmeJseCqlWeIB1Bzs3GdTwRdj7sveZO8dxrXb5vytm0WMJKFBn4K+FwkrCNIR5s261mytfaPSgtwID4w7vXF2gjAmuwalnXTksbjTyHv/xLQYlaTP7+0Ni4qesBN6PNp5d42g3jdm81CpMSs6LBgIWAXSbK9rSlVtYFI+4bmB7XXuuUqt58nMceamI9Xo4eedLylR8qjrEyVWeWIjLiIqzP/zYGh3Dhc/mUzuvI/7p6DYM3zqRFeOQcpSczsDGQZw4dJUKKc03CUDbm20SM7X28rkg3SxocduEi57LveSCtCS0pqBVA50Q2xlCWQSqb7TRYE4lqW/VipoYDjLJKKbk3XCJJhjDJgsCiJ+Onjc2XeJQ7CbQb6iDlgmVXAW0sidDCicGt/BBMDuV0qYtLMqwDi1HtBCd+cU0pFiDAJPMjwOIGf0r4LclRw/lh/R8opw3nu78zXXB1gl8GrTcvydoOPmbl4AKQUmm0RsgmSKhVLmlkIO0/tVXQBmvyqDOMp1g93HEy9MjPnB1aKgTPLDHPtQq0ImF8JAtutgRejhElYIlSO0 MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 5b4407a7-32fe-4a3d-ee49-08d4406e96c8 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY4PR03MB2471; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2471; 3:SPy+41lIvlKRiqjmk233OT5EHirc9trsZSHPTLlJnp2XQpO7rxF3Ttps3jUCMakYaNyyjOREubYRL4VqsIkjx85wuf5dtvEC417/0udV1Ih7t+CkrLXzC1rb27sCftgyr96Iy5dwjjk+nlOS52tdERe3N3jQx+f9vd6xK+OArSpRI5kwzraZP3bP3vSXPlM4xP4grc0I7jk49H7cKqe2fjHCJbDnYGviLMRFrMMT43FqfbfqUvV2pVdxqQF59rTgJo/U20+qiFYQBEU5z/MnPTR4hWVX7gAZtLdpHalcJGvhRw+u93FwAy82IuEknMXuR5wd40VNRSdzynjwZtNIzWA0xoqOZ5bQsNpe0Z9Vq1lTFulBmS6Kz2qcvs1lOy8/; 25:wfJiGqYZdkHPz0Sc0MrLrxYJqQQU6ZxTL+M28ZEfGSgSFGnRgr58jhxP2ecHz1v3iFWqz6PrJC47/L7JKE+e9C9NDDre+B0ZzJO/KhGE8GnMdW7CshAyHhZHz9cM0qUTVFRi4u+rJrYYo5UOFHQiYuid5ByUNQu51DK6JmtssmKEQjajR8Dw3p24XyynCmEG03l9MNHeC/qKwR9SUuv60Rwg4O+uE52G8l3Jczyi5bWXVxl2L573+X21DJLELx0VHpiSmwicTTKCxsvLx7OCLoto6P1dmIKjxiEbONgVdTk6nQOrYRDzZb4Qo+pnynAOFBwynCYI5x2l2shQYam78hkFuGus9cAepm5e54NeWbJ15WWk4WnayApEz4iAkhwr6Kn89BdVluR+AabS6wujAmdVtj4FBYDwoq8Re/XIfwaROCKFpgQ3yPtlE0uA+IVfZLE8K8rr2zh04d6oCccNXA== X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2471; 31:NJbCcudf3piOf+9r8fZTSJivc8Whr6KjtZsLug3WudK6k4NZMnfJn5Lo8xlI611G6HX3MmWq8zV0l0e38n539+X84vGd5lF4QRfjyhVCXPsTxRc2jtHejmGWbKvE+Y8mQK/5zuro6YuBAqTiP0VRZ0NxH3o4Wj4n3MXjc3IkdFqOPLtPA1aSilDrnkWwlKDiL2x6wQYjm2LmIWHXoMbMf2BYAFj2ZMCwGw+3nZ+owcqoIIWYK1OBkuJ9K2OgMJP0zn+cfizgw0AW6SMOnOYkbg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13023025)(13017025)(13015025)(13024025)(13018025)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6096035)(20161123561025)(20161123559025)(20161123556025)(20161123563025)(20161123565025); SRVR:CY4PR03MB2471; BCL:0; PCL:0; RULEID:(400006); SRVR:CY4PR03MB2471; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2471; 4:iXFNOtTTG+Ete4wtV443z5R5khPjaBffLOypnYIqK02NnS2R4TVpBt/sYur6GLTQLbOV38YFFmF64h3hrLsYu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iagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2471; 7:fLEhnDa/YD0ocBx5IMVuDZKTnQzvDw6gTpCmn+H0oOWOsOQDv8UNjHoYPFqLSfO8cOZRwsR7D5KPUxZ7AE3PV2oJlBtUWV+OV6VvLxyYfbqK4A+0XpQic1zQujp02Sw/n3sfjmHmcHh92CproTzp0b/9kvClgFRF0v+oZzxcBPUGq/idDwscHmCvq9gusaIc78YHY4B6ZqCW3FPaXJ3pud63UesTVBV/Rhw/K0Uv5urC2LFQ/2ubGmmUpTW+yD52L4C/OzptpzaI/Wq8knvPi79Pu1Mr7MN7yyFn4lV5JDlx6NP+w7nyCfOoeclPD4HFD7/pdFd6c7ETHDv67rWLRwYrA3PhdiOMNCwpjdI7xMIw430+ucwwbBDy3iPEPeNdJgiwIpI+ojG5ZbxHIYwA5n10eg2uRLK70yXbOptwR3PUpJnjRYJJVjGyICnIRt5cjfSE593PkOicrBxhkLyeJw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2017 13:25:08.4697 (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: CY4PR03MB2471 Subject: [dpdk-dev] [PATCHv5 16/33] drivers/pool/dpaa2: adding hw offloaded mempool 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, 19 Jan 2017 13:25:12 -0000 Adding NXP DPAA2 architecture specific mempool support Each mempool instance is represented by a DPBP object from the FSL-MC bus. This patch also registers a dpaa2 type MEMPOOL OPS Signed-off-by: Hemant Agrawal --- config/common_base | 1 + config/defconfig_arm64-dpaa2-linuxapp-gcc | 4 + drivers/Makefile | 1 + drivers/bus/fslmc/Makefile | 2 + 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 | 19 ++ drivers/bus/fslmc/rte_pmd_fslmcbus_version.map | 2 + drivers/common/Makefile | 3 + drivers/pool/Makefile | 38 +++ drivers/pool/dpaa2/Makefile | 67 +++++ drivers/pool/dpaa2/dpaa2_hw_mempool.c | 339 ++++++++++++++++++++++ drivers/pool/dpaa2/dpaa2_hw_mempool.h | 95 ++++++ drivers/pool/dpaa2/rte_pmd_dpaa2_pool_version.map | 8 + mk/rte.app.mk | 1 + 16 files changed, 727 insertions(+), 1 deletion(-) create mode 100644 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c create mode 100644 drivers/pool/Makefile create mode 100644 drivers/pool/dpaa2/Makefile create mode 100644 drivers/pool/dpaa2/dpaa2_hw_mempool.c create mode 100644 drivers/pool/dpaa2/dpaa2_hw_mempool.h create mode 100644 drivers/pool/dpaa2/rte_pmd_dpaa2_pool_version.map diff --git a/config/common_base b/config/common_base index 9d35487..5a10e45 100644 --- a/config/common_base +++ b/config/common_base @@ -291,6 +291,7 @@ CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_MBOX=n # Compile Support Libraries for NXP DPAA2 # CONFIG_RTE_LIBRTE_DPAA2_COMMON=n +CONFIG_RTE_LIBRTE_DPAA2_POOL=n # # Compile NXP DPAA2 FSL-MC Bus diff --git a/config/defconfig_arm64-dpaa2-linuxapp-gcc b/config/defconfig_arm64-dpaa2-linuxapp-gcc index d3bc9d8..7665912 100644 --- a/config/defconfig_arm64-dpaa2-linuxapp-gcc +++ b/config/defconfig_arm64-dpaa2-linuxapp-gcc @@ -42,10 +42,14 @@ CONFIG_RTE_ARCH_ARM_TUNE="cortex-a57+fp+simd" CONFIG_RTE_MAX_LCORE=8 CONFIG_RTE_MAX_NUMA_NODES=1 +CONFIG_RTE_PKTMBUF_HEADROOM=256 + # # Compile Support Libraries for DPAA2 # CONFIG_RTE_LIBRTE_DPAA2_COMMON=y +CONFIG_RTE_LIBRTE_DPAA2_POOL=n +CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="dpaa2" # # Compile NXP DPAA2 FSL-MC Bus diff --git a/drivers/Makefile b/drivers/Makefile index bdae63b..9fd268e 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -33,6 +33,7 @@ include $(RTE_SDK)/mk/rte.vars.mk DIRS-y += common DIRS-y += bus +DIRS-y += pool DIRS-y += net DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto diff --git a/drivers/bus/fslmc/Makefile b/drivers/bus/fslmc/Makefile index 1b815dd..35f30ad 100644 --- a/drivers/bus/fslmc/Makefile +++ b/drivers/bus/fslmc/Makefile @@ -47,6 +47,7 @@ CFLAGS += "-Wno-strict-aliasing" CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/mc CFLAGS += -I$(RTE_SDK)/drivers/common/dpaa2/qbman/include +CFLAGS += -I$(RTE_SDK)/drivers/pool/dpaa2 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal # versioning export map @@ -63,6 +64,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 8d24620..2bfd7fd 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; @@ -420,6 +420,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); @@ -427,6 +432,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..16d5b24 --- /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 = 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 ef3eb71..3b846a0 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -41,6 +41,13 @@ #define MC_PORTAL_INDEX 0 #define NUM_DPIO_REGIONS 2 +#define MEMPOOL_F_HW_PKT_POOL 0x8000 /**< mpool flag to check offloaded pool */ + +/* 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 +70,18 @@ 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 *(*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_pmd_fslmcbus_version.map b/drivers/bus/fslmc/rte_pmd_fslmcbus_version.map index 4236377..76029b9 100644 --- a/drivers/bus/fslmc/rte_pmd_fslmcbus_version.map +++ b/drivers/bus/fslmc/rte_pmd_fslmcbus_version.map @@ -2,6 +2,8 @@ DPDK_17.02 { global: dpaa2_affine_qbman_swp; + dpaa2_alloc_dpbp_dev; + dpaa2_free_dpbp_dev; dpbp_disable; dpbp_enable; dpbp_get_attributes; diff --git a/drivers/common/Makefile b/drivers/common/Makefile index 434280f..0a6d8db 100644 --- a/drivers/common/Makefile +++ b/drivers/common/Makefile @@ -34,6 +34,9 @@ include $(RTE_SDK)/mk/rte.vars.mk CONFIG_RTE_LIBRTE_DPAA2_COMMON = $(CONFIG_RTE_LIBRTE_DPAA2_PMD) ifneq ($(CONFIG_RTE_LIBRTE_DPAA2_COMMON),y) +CONFIG_RTE_LIBRTE_DPAA2_COMMON = $(CONFIG_RTE_LIBRTE_DPAA2_POOL) +endif +ifneq ($(CONFIG_RTE_LIBRTE_DPAA2_COMMON),y) CONFIG_RTE_LIBRTE_DPAA2_COMMON = $(CONFIG_RTE_LIBRTE_FSLMC_BUS) endif diff --git a/drivers/pool/Makefile b/drivers/pool/Makefile new file mode 100644 index 0000000..4325edd --- /dev/null +++ b/drivers/pool/Makefile @@ -0,0 +1,38 @@ +# BSD LICENSE +# +# Copyright(c) 2016 NXP. All rights reserved. +# 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 NXP 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 $(RTE_SDK)/mk/rte.vars.mk + +CONFIG_RTE_LIBRTE_DPAA2_POOL = $(CONFIG_RTE_LIBRTE_DPAA2_PMD) + +DIRS-$(CONFIG_RTE_LIBRTE_DPAA2_COMMON) += dpaa2 + +include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/pool/dpaa2/Makefile b/drivers/pool/dpaa2/Makefile new file mode 100644 index 0000000..9494756 --- /dev/null +++ b/drivers/pool/dpaa2/Makefile @@ -0,0 +1,67 @@ +# BSD LICENSE +# +# Copyright(c) 2016 NXP. All rights reserved. +# 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 NXP 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 $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_dpaa2_pool.a + +ifeq ($(CONFIG_RTE_LIBRTE_DPAA2_DEBUG_INIT),y) +CFLAGS += -O0 -g +CFLAGS += "-Wno-error" +else +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) +endif + +CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc +CFLAGS += -I$(RTE_SDK)/drivers/common/dpaa2/qbman/include +CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal + +# versioning export map +EXPORT_MAP := rte_pmd_dpaa2_pool_version.map + +# Lbrary version +LIBABIVER := 1 + +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_COMMON) += dpaa2_hw_mempool.c + +# library dependencies +DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_COMMON) += lib/librte_eal +DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_COMMON) += lib/librte_mempool +DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_COMMON) += lib/librte_pmd_dpaa2_qbman +DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_COMMON) += lib/librte_pmd_fslmcbus + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/pool/dpaa2/dpaa2_hw_mempool.c b/drivers/pool/dpaa2/dpaa2_hw_mempool.c new file mode 100644 index 0000000..f36e909 --- /dev/null +++ b/drivers/pool/dpaa2/dpaa2_hw_mempool.c @@ -0,0 +1,339 @@ +/*- + * 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 +#include +#include +#include "dpaa2_hw_mempool.h" + +struct dpaa2_bp_info bpid_info[MAX_BPID]; +static struct dpaa2_bp_list *h_bp_list; + +static int +hw_mbuf_create_pool(struct rte_mempool *mp) +{ + struct dpaa2_bp_list *bp_list; + struct dpaa2_dpbp_dev *avail_dpbp; + struct dpbp_attr dpbp_attr; + uint32_t bpid; + int ret; + + avail_dpbp = dpaa2_alloc_dpbp_dev(); + + if (!avail_dpbp) { + PMD_DRV_LOG(ERR, "DPAA2 resources not available"); + return -1; + } + + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + RTE_LOG(ERR, PMD, "Failure in affining portal\n"); + return 0; + } + } + + ret = dpbp_enable(&avail_dpbp->dpbp, CMD_PRI_LOW, avail_dpbp->token); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Resource enable failure with" + " err code: %d\n", ret); + return -1; + } + + ret = dpbp_get_attributes(&avail_dpbp->dpbp, CMD_PRI_LOW, + avail_dpbp->token, &dpbp_attr); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Resource read failure with" + " err code: %d\n", ret); + ret = dpbp_disable(&avail_dpbp->dpbp, CMD_PRI_LOW, + avail_dpbp->token); + return -1; + } + + /* Allocate the bp_list which will be added into global_bp_list */ + bp_list = (struct dpaa2_bp_list *)malloc(sizeof(struct dpaa2_bp_list)); + if (!bp_list) { + PMD_INIT_LOG(ERR, "No heap memory available"); + return -1; + } + + /* Set parameters of buffer pool list */ + bp_list->buf_pool.num_bufs = mp->size; + bp_list->buf_pool.size = mp->elt_size + - sizeof(struct rte_mbuf) - rte_pktmbuf_priv_size(mp); + bp_list->buf_pool.bpid = dpbp_attr.bpid; + bp_list->buf_pool.h_bpool_mem = NULL; + bp_list->buf_pool.mp = mp; + bp_list->buf_pool.dpbp_node = avail_dpbp; + bp_list->next = h_bp_list; + + bpid = dpbp_attr.bpid; + + + bpid_info[bpid].meta_data_size = sizeof(struct rte_mbuf) + + rte_pktmbuf_priv_size(mp); + bpid_info[bpid].bp_list = bp_list; + bpid_info[bpid].bpid = bpid; + + mp->pool_data = (void *)&bpid_info[bpid]; + + PMD_INIT_LOG(DEBUG, "BP List created for bpid =%d", dpbp_attr.bpid); + + h_bp_list = bp_list; + /* Identification for our offloaded pool_data structure + */ + mp->flags |= MEMPOOL_F_HW_PKT_POOL; + return 0; +} + +static void +hw_mbuf_free_pool(struct rte_mempool *mp) +{ + struct dpaa2_bp_info *bpinfo; + struct dpaa2_bp_list *bp; + struct dpaa2_dpbp_dev *dpbp_node; + + if (!mp->pool_data) { + PMD_DRV_LOG(ERR, "Not a valid dpaa22 pool"); + return; + } + + bpinfo = (struct dpaa2_bp_info *)mp->pool_data; + bp = bpinfo->bp_list; + dpbp_node = bp->buf_pool.dpbp_node; + + dpbp_disable(&(dpbp_node->dpbp), CMD_PRI_LOW, dpbp_node->token); + + if (h_bp_list == bp) { + h_bp_list = h_bp_list->next; + } else { /* if it is not the first node */ + struct dpaa2_bp_list *prev = h_bp_list, *temp; + temp = h_bp_list->next; + while (temp) { + if (temp == bp) { + prev->next = temp->next; + free(bp); + break; + } + prev = temp; + temp = temp->next; + } + } + + dpaa2_free_dpbp_dev(dpbp_node); +} + +static +void dpaa2_mbuf_release(struct rte_mempool *pool __rte_unused, + void * const *obj_table, + uint32_t bpid, + uint32_t meta_data_size, + int count) +{ + struct qbman_release_desc releasedesc; + struct qbman_swp *swp; + int ret; + int i, n; + uint64_t bufs[DPAA2_MBUF_MAX_ACQ_REL]; + + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret != 0) { + RTE_LOG(ERR, PMD, "Failed to allocate IO portal"); + return; + } + } + swp = DPAA2_PER_LCORE_PORTAL; + + /* Create a release descriptor required for releasing + * buffers into QBMAN + */ + qbman_release_desc_clear(&releasedesc); + qbman_release_desc_set_bpid(&releasedesc, bpid); + + n = count % DPAA2_MBUF_MAX_ACQ_REL; + + /* convert mbuf to buffers for the remainder*/ + for (i = 0; i < n ; i++) + bufs[i] = (uint64_t)obj_table[i] + meta_data_size; + + /* feed them to bman*/ + do { + ret = qbman_swp_release(swp, &releasedesc, bufs, n); + } while (ret == -EBUSY); + + /* if there are more buffers to free */ + while (n < count) { + /* convert mbuf to buffers */ + for (i = 0; i < DPAA2_MBUF_MAX_ACQ_REL; i++) + bufs[i] = (uint64_t)obj_table[n + i] + meta_data_size; + + do { + ret = qbman_swp_release(swp, &releasedesc, bufs, + DPAA2_MBUF_MAX_ACQ_REL); + } while (ret == -EBUSY); + n += DPAA2_MBUF_MAX_ACQ_REL; + } +} + +int hw_mbuf_alloc_bulk(struct rte_mempool *pool, + void **obj_table, unsigned int count) +{ +#ifdef RTE_LIBRTE_DPAA2_DEBUG_DRIVER + static int alloc; +#endif + struct qbman_swp *swp; + uint32_t mbuf_size; + uint16_t bpid; + uint64_t bufs[DPAA2_MBUF_MAX_ACQ_REL]; + int i, ret; + unsigned int n = 0; + struct dpaa2_bp_info *bp_info; + + bp_info = mempool_to_bpinfo(pool); + + if (!(bp_info->bp_list)) { + RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n"); + return -2; + } + + bpid = bp_info->bpid; + + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret != 0) { + RTE_LOG(ERR, PMD, "Failed to allocate IO portal"); + return -1; + } + } + swp = DPAA2_PER_LCORE_PORTAL; + + mbuf_size = sizeof(struct rte_mbuf) + rte_pktmbuf_priv_size(pool); + + while (n < count) { + /* Acquire is all-or-nothing, so we drain in 7s, + * then the remainder. + */ + if ((count - n) > DPAA2_MBUF_MAX_ACQ_REL) { + ret = qbman_swp_acquire(swp, bpid, bufs, + DPAA2_MBUF_MAX_ACQ_REL); + } else { + ret = qbman_swp_acquire(swp, bpid, bufs, + count - n); + } + /* In case of less than requested number of buffers available + * in pool, qbman_swp_acquire returns 0 + */ + if (ret <= 0) { + PMD_TX_LOG(ERR, "Buffer acquire failed with" + " err code: %d", ret); + /* The API expect the exact number of requested bufs */ + /* Releasing all buffers allocated */ + dpaa2_mbuf_release(pool, obj_table, bpid, + bp_info->meta_data_size, n); + return -1; + } + /* assigning mbuf from the acquired objects */ + for (i = 0; (i < ret) && bufs[i]; i++) { + /* TODO-errata - observed that bufs may be null + * i.e. first buffer is valid, + * remaining 6 buffers may be null + */ + obj_table[n] = (struct rte_mbuf *)(bufs[i] - mbuf_size); + rte_mbuf_refcnt_set((struct rte_mbuf *)obj_table[n], 0); + PMD_TX_LOG(DEBUG, "Acquired %p address %p from BMAN", + (void *)bufs[i], (void *)obj_table[n]); + n++; + } + } + +#ifdef RTE_LIBRTE_DPAA2_DEBUG_DRIVER + alloc += n; + PMD_TX_LOG(DEBUG, "Total = %d , req = %d done = %d", + alloc, count, n); +#endif + return 0; +} + +static int +hw_mbuf_free_bulk(struct rte_mempool *pool, + void * const *obj_table, unsigned int n) +{ + struct dpaa2_bp_info *bp_info; + + bp_info = mempool_to_bpinfo(pool); + if (!(bp_info->bp_list)) { + RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured"); + return -1; + } + dpaa2_mbuf_release(pool, obj_table, bp_info->bpid, + bp_info->meta_data_size, n); + + return 0; +} + +static unsigned +hw_mbuf_get_count(const struct rte_mempool *mp __rte_unused) +{ + return 0; +} + +struct rte_mempool_ops dpaa2_mpool_ops = { + .name = "dpaa2", + .alloc = hw_mbuf_create_pool, + .free = hw_mbuf_free_pool, + .enqueue = hw_mbuf_free_bulk, + .dequeue = hw_mbuf_alloc_bulk, + .get_count = hw_mbuf_get_count, +}; + +MEMPOOL_REGISTER_OPS(dpaa2_mpool_ops); diff --git a/drivers/pool/dpaa2/dpaa2_hw_mempool.h b/drivers/pool/dpaa2/dpaa2_hw_mempool.h new file mode 100644 index 0000000..2cd2564 --- /dev/null +++ b/drivers/pool/dpaa2/dpaa2_hw_mempool.h @@ -0,0 +1,95 @@ +/*- + * 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. + */ + +#ifndef _DPAA2_HW_DPBP_H_ +#define _DPAA2_HW_DPBP_H_ + +#define DPAA2_MAX_BUF_POOLS 8 + +struct buf_pool_cfg { + void *addr; /*!< The address from where DPAA2 will carve out the + * buffers. 'addr' should be 'NULL' if user wants + * to create buffers from the memory which user + * asked DPAA2 to reserve during 'nadk init' + */ + phys_addr_t phys_addr; /*!< corresponding physical address + * of the memory provided in addr + */ + uint32_t num; /*!< number of buffers */ + uint32_t size; /*!< size of each buffer. 'size' should include + * any headroom to be reserved and alignment + */ + uint16_t align; /*!< Buffer alignment (in bytes) */ + uint16_t bpid; /*!< The buffer pool id. This will be filled + *in by DPAA2 for each buffer pool + */ +}; + +struct buf_pool { + uint32_t size; + uint32_t num_bufs; + uint16_t bpid; + uint8_t *h_bpool_mem; + struct rte_mempool *mp; + struct dpaa2_dpbp_dev *dpbp_node; +}; + +/*! + * Buffer pool list configuration structure. User need to give DPAA2 the + * valid number of 'num_buf_pools'. + */ +struct dpaa2_bp_list_cfg { + struct buf_pool_cfg buf_pool; /* Configuration of each buffer pool*/ +}; + +struct dpaa2_bp_list { + struct dpaa2_bp_list *next; + struct rte_mempool *mp; + struct buf_pool buf_pool; +}; + +struct dpaa2_bp_info { + uint32_t meta_data_size; + uint32_t bpid; + struct dpaa2_bp_list *bp_list; +}; + +#define mempool_to_bpinfo(mp) ((struct dpaa2_bp_info *)(mp)->pool_data) +#define mempool_to_bpid(mp) ((mempool_to_bpinfo(mp))->bpid) + +extern struct dpaa2_bp_info bpid_info[MAX_BPID]; + +int hw_mbuf_alloc_bulk(struct rte_mempool *pool, + void **obj_table, unsigned int count); + +#endif /* _DPAA2_HW_DPBP_H_ */ diff --git a/drivers/pool/dpaa2/rte_pmd_dpaa2_pool_version.map b/drivers/pool/dpaa2/rte_pmd_dpaa2_pool_version.map new file mode 100644 index 0000000..289ab10 --- /dev/null +++ b/drivers/pool/dpaa2/rte_pmd_dpaa2_pool_version.map @@ -0,0 +1,8 @@ +DPDK_17.02 { + global: + + bpid_info; + hw_mbuf_alloc_bulk; + + local: *; +}; diff --git a/mk/rte.app.mk b/mk/rte.app.mk index c793dd2..f415c18 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -113,6 +113,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += -lrte_pmd_cxgbe ifeq ($(CONFIG_RTE_LIBRTE_DPAA2_COMMON),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += -lrte_pmd_dpaa2 _LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += -lrte_pmd_dpaa2_qbman +_LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += -lrte_pmd_dpaa2_pool _LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += -lrte_pmd_fslmcbus endif _LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000 -- 1.9.1