From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0049.outbound.protection.outlook.com [104.47.34.49]) by dpdk.org (Postfix) with ESMTP id E40DE5598 for ; Sun, 9 Apr 2017 09:48:34 +0200 (CEST) Received: from BN3PR03CA0104.namprd03.prod.outlook.com (10.174.66.22) by BY2PR03MB286.namprd03.prod.outlook.com (10.242.37.21) 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:33 +0000 Received: from BY2FFO11FD012.protection.gbl (2a01:111:f400:7c0c::112) by BN3PR03CA0104.outlook.office365.com (2603:10b6:400:4::22) 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:32 +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 BY2FFO11FD012.mail.protection.outlook.com (10.1.14.130) 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:32 +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 v397mBLP024015; Sun, 9 Apr 2017 00:48:29 -0700 From: Hemant Agrawal To: , CC: , , Date: Sun, 9 Apr 2017 13:20:09 +0530 Message-ID: <1491724224-6319-7-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: 131361977123340724; (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)(39850400002)(39450400003)(39840400002)(39400400002)(39410400002)(39380400002)(39860400002)(2980300002)(1109001)(1110001)(3190300001)(339900001)(199003)(189002)(9170700003)(8656002)(8936002)(81166006)(54906002)(38730400002)(85426001)(2906002)(50226002)(106466001)(8676002)(104016004)(105606002)(5660300001)(4326008)(2950100002)(6666003)(50466002)(36756003)(48376002)(5003940100001)(189998001)(76176999)(50986999)(77096006)(575784001)(86362001)(356003)(53936002)(305945005)(33646002)(47776003)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR03MB286; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD012; 1:uNbT3yLQs0otaVKM4r/7E+xxNw1kVo1WoByq4IAgQVX9jR9y0StOfKgsdtdqoHBtgnVWAlhqzxocPae/Gg+PhpTOAraiYaKioYvR/ChoxQto33E6uS8/CMkbF2ucJ6svYgU0m2snD972lY+Q3oKgzZtBgr6bRtPyCg3fs4KYwUJJT4mnITwU9GX3EaTdq2/4oJSSG1/4d6/NPdILvoSKXVh0LowgVEiLtBkjPlZssIeccqsuOwqS6dc/mQF/OGivlItgFrZHT+wZVWJjyoyKAnwOrZhR6EdzEHyD6RXSj/o15/KGf5KEENlvUnkEoCXqpdtq4wlILt/4o6yQcC3G9r6GPjmma6DO/jYRcqyB2KITsqQH9Dn/ydCPXb9OwulbSq+eY6xL/mRL7UlBilGheAdVQsqnAqKVmyoZ18o+iX8LCV7xbcedh7LCzyHHF9eCHwIuyLiI3ETtN18sEYC/4XFPrnoAYGKSmfiB7EtS7tR4YKgzQ+3UPv1zBEAvD5MUsO0ROumK1utBJEI1lffqa71N2HpNtYquM9r5RRsUkE7CF2m0JtwQIIPE4dxQrcLZDxRaQ4Mvs1RKiM/3ldb0oefn9f2g0auPD2BlySmUNRrN5A6byCve2rimdjSyRhUpO+Hr2luSAhcUc3V7GgXcvsg26eDm/27z7gy3W6cxs/vxpfDl3wftgKEWkb3eZjw5 MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 77bd16ab-592b-4a10-954b-08d47f1cd1cf X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:BY2PR03MB286; X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB286; 3:McR4TVBswr+xxSvMR4/2G97MtaISDFuIles+SUoUWIsCI6rohIzOOW8nZCw0DSZ1VJR6okOWQwJkJ0lg4MwALprHw1wPweSNh+Cu24YsOAZt0KjY0tSBRh3ms6KbCIF8OzQi69T4eeRIn0ftbfS1sqlgHX8MvsOr6HvrjrwUmNnjS7gLfOxTkpppcki40ohVQYAnafrq1NR8UL9IhI4tFvrgQ5YMXMNzWT92ToTvnh5XdQB8bhnzNRyg9im01yukRG7jyPAqpXDP8DwErjeXRPqWREKcdJFbXzoYEYjMEyvI6i86o4ET8FRBeqPAcoT/ve7jpLgPsyMIt0DRtxOb8Fmq5TQD5FtQdvUHWwHx69m89pbSXbIWVLTtWkRcIxk+pSb49Nzy7cxBg8H8LmUgTOyzkzxEXafjhzOrCl/DdHg3IWjf8KsE9jmUIO118Tu1; 25:ooBdOpysO1fbZcOnxVkxXTbFw9Ho9Ci2F4nAaA+wqvQGSs4hU3U3BNfg9T7+/0J3lWGnB1K3GzELg7R6UfKdSqLcj+3imLMZuQoeSiSM/u8CowIBaqfD8n4Zp71U3SlltX3jrodkbecnDa23Yf1FnVK97EzRUrKyQ1r6mW43ls63v79TusQTduq+a7wi9nCoTqLovQhXrTJEnR0CguQtJ08szQvJ22UOMehwl3Cw3rcYU7PEyFn9c3bl/k8sCTATHONAoe2satSfZMWXXuwMo9kFo5+CYOG6htFJ/aTCmZF7JXHWZuuUaQcMZ75kSn5eeLyIUSVInqoP1V3pZQylnYLN+2lm2o79l8Pt0tyoQwiXq/fVjXlqw/tr9OzCtGcxOIhlzJsttkyhMfW+ZAC68uBgGWSDwZGkdShLDyV8z6GUeIy2q184Atmnyjc8b64XN4cigiqqulqs3n5ekCcdYA== X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB286; 31:rJeNfAqqj2enX30hi9Wt+8Ks+WqFXQPxPHDFG8zij9nNNarpk/JaFlT5Cf7sPqmrH/H60/rwaiMg/c8GYlowlduIA9ClHIMWs6M1p//PsltuPC5I24OvoBH/s1MHS4mUU9phL3EqlsyEiKuhThTvBCtYD7A8MjfogwNIY1B2/0YFW9zSYeRo0WpM+rK9TnYa+3RRdp2kBVGoXePa/O4mZqqpYEOZJNRQChX4athZJyaJeZ+1nQwR4PiiA/P6ptFumYMam8QMo1+L/aQilpzqyPLYZKp92o508U62nR7nLfU= 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)(13024025)(13023025)(13018025)(13015025)(13017025)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(6055026)(6096035)(201703131430075)(201703131448075)(201703131433075)(201703161259075)(20161123565025)(20161123556025)(20161123563025)(20161123561025); SRVR:BY2PR03MB286; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR03MB286; X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB286; 4:fggZvjVPt7B4GLOeqUxvHFEeXj2jb0y/9CplTOKS7CVYBwaJNLXxBbFky9J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Acj0ayqAy9SPPoL4jDd5h1D44n3ffkcPbraiVZblG36J6je46uH/wsc+JAPTqrigXqSGmDTum+Nc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB286; 7:vPNNA130XpZmczTR11SDXNRKfTY0Xhh/pGx0F3KX888jH+h4Fi+/ZhoXN2BgdiaCxjQlZLxAxuM0/w6Jou5wqg2HDQ0oPTz8f82sRE/GJW4oIQQfqwkgb5CsmqUuLFH17T601Yug8ncp76V7j1yXpoA8lQQJcp4t5iE3manpDbORVK8EdjwfOEWAe+Wcd+EppcWBvUXAnYNOT60iAgeu35L8Fo180yiOKkGMcAf49qD/nut4h0fep8QBxXoI2KOO98+9yPrmoWPf+TPMM8BSG+oKvQwJyRgNbsLmxt6CiwjLMomf8UbTJDXvLGR95LEIB75ZYrYPmTyxzIT1mzoGVA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2017 07:48:32.0064 (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: BY2PR03MB286 Subject: [dpdk-dev] [PATCH v3 06/21] bus/fslmc: add mc dpbp object support 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:36 -0000 DPBP object represent a hw based buffer pool instance in the DPAA2 hardware. Signed-off-by: Alex Marginean Signed-off-by: Hemant Agrawal --- drivers/bus/fslmc/Makefile | 1 + drivers/bus/fslmc/mc/dpbp.c | 261 ++++++++++++++++++++++++++++ drivers/bus/fslmc/mc/fsl_dpbp.h | 241 +++++++++++++++++++++++++ drivers/bus/fslmc/mc/fsl_dpbp_cmd.h | 88 ++++++++++ drivers/bus/fslmc/rte_bus_fslmc_version.map | 6 + 5 files changed, 597 insertions(+) create mode 100644 drivers/bus/fslmc/mc/dpbp.c create mode 100644 drivers/bus/fslmc/mc/fsl_dpbp.h create mode 100644 drivers/bus/fslmc/mc/fsl_dpbp_cmd.h diff --git a/drivers/bus/fslmc/Makefile b/drivers/bus/fslmc/Makefile index 0c474da..9810e53 100644 --- a/drivers/bus/fslmc/Makefile +++ b/drivers/bus/fslmc/Makefile @@ -63,6 +63,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += \ qbman/qbman_portal.c SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += \ + mc/dpbp.c \ mc/dpio.c \ mc/mc_sys.c diff --git a/drivers/bus/fslmc/mc/dpbp.c b/drivers/bus/fslmc/mc/dpbp.c new file mode 100644 index 0000000..12f9180 --- /dev/null +++ b/drivers/bus/fslmc/mc/dpbp.c @@ -0,0 +1,261 @@ +/*- + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * BSD LICENSE + * + * Copyright 2013-2016 Freescale Semiconductor Inc. + * Copyright (c) 2016 NXP. + * + * 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 the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * GPL LICENSE SUMMARY + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * 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 HOLDERS 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 + +int dpbp_open(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + int dpbp_id, + uint16_t *token) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_OPEN, + cmd_flags, + 0); + DPBP_CMD_OPEN(cmd, dpbp_id); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *token = MC_CMD_HDR_READ_TOKEN(cmd.header); + + return err; +} + +int dpbp_close(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_CLOSE, cmd_flags, + token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpbp_create(struct fsl_mc_io *mc_io, + uint16_t dprc_token, + uint32_t cmd_flags, + const struct dpbp_cfg *cfg, + uint32_t *obj_id) +{ + struct mc_command cmd = { 0 }; + int err; + + (void)(cfg); /* unused */ + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_CREATE, + cmd_flags, + dprc_token); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + CMD_CREATE_RSP_GET_OBJ_ID_PARAM0(cmd, *obj_id); + + return 0; +} + +int dpbp_destroy(struct fsl_mc_io *mc_io, + uint16_t dprc_token, + uint32_t cmd_flags, + uint32_t object_id) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_DESTROY, + cmd_flags, + dprc_token); + /* set object id to destroy */ + CMD_DESTROY_SET_OBJ_ID_PARAM0(cmd, object_id); + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpbp_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_ENABLE, cmd_flags, + token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpbp_disable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_DISABLE, + cmd_flags, + token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpbp_is_enabled(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + int *en) +{ + struct mc_command cmd = { 0 }; + int err; + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_IS_ENABLED, cmd_flags, + token); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + DPBP_RSP_IS_ENABLED(cmd, *en); + + return 0; +} + +int dpbp_reset(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_RESET, + cmd_flags, + token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} +int dpbp_get_attributes(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpbp_attr *attr) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_ATTR, + cmd_flags, + token); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + DPBP_RSP_GET_ATTRIBUTES(cmd, attr); + + return 0; +} + + +int dpbp_get_api_version(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t *major_ver, + uint16_t *minor_ver) +{ + struct mc_command cmd = { 0 }; + int err; + + cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_API_VERSION, + cmd_flags, + 0); + + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + DPBP_RSP_GET_API_VERSION(cmd, *major_ver, *minor_ver); + + return 0; +} + +int dpbp_get_num_free_bufs(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint32_t *num_free_bufs) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_FREE_BUFFERS_NUM, + cmd_flags, + token); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + DPBP_RSP_GET_NUM_FREE_BUFS(cmd, *num_free_bufs); + + return 0; +} diff --git a/drivers/bus/fslmc/mc/fsl_dpbp.h b/drivers/bus/fslmc/mc/fsl_dpbp.h new file mode 100644 index 0000000..d14e25d --- /dev/null +++ b/drivers/bus/fslmc/mc/fsl_dpbp.h @@ -0,0 +1,241 @@ +/*- + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * BSD LICENSE + * + * Copyright 2013-2016 Freescale Semiconductor Inc. + * Copyright (c) 2016 NXP. + * + * 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 the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * GPL LICENSE SUMMARY + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * 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 HOLDERS 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 __FSL_DPBP_H +#define __FSL_DPBP_H + +/* Data Path Buffer Pool API + * Contains initialization APIs and runtime control APIs for DPBP + */ + +struct fsl_mc_io; + +/** + * dpbp_open() - Open a control session for the specified object. + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @dpbp_id: DPBP unique ID + * @token: Returned token; use in subsequent API calls + * + * This function can be used to open a control session for an + * already created object; an object may have been declared in + * the DPL or by calling the dpbp_create function. + * This function returns a unique authentication token, + * associated with the specific object ID and the specific MC + * portal; this token must be used in all subsequent commands for + * this specific object + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_open(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + int dpbp_id, + uint16_t *token); + +/** + * dpbp_close() - Close the control session of the object + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPBP object + * + * After this function is called, no further operations are + * allowed on the object without opening a new control session. + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_close(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +/** + * struct dpbp_cfg - Structure representing DPBP configuration + * @options: place holder + */ +struct dpbp_cfg { + uint32_t options; +}; + +/** + * dpbp_create() - Create the DPBP object. + * @mc_io: Pointer to MC portal's I/O object + * @dprc_token: Parent container token; '0' for default container + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @cfg: Configuration structure + * @obj_id: returned object id + * + * Create the DPBP object, allocate required resources and + * perform required initialization. + * + * The object can be created either by declaring it in the + * DPL file, or by calling this function. + * + * The function accepts an authentication token of a parent + * container that this object should be assigned to. The token + * can be '0' so the object will be assigned to the default container. + * The newly created object can be opened with the returned + * object id and using the container's associated tokens and MC portals. + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_create(struct fsl_mc_io *mc_io, + uint16_t dprc_token, + uint32_t cmd_flags, + const struct dpbp_cfg *cfg, + uint32_t *obj_id); + +/** + * dpbp_destroy() - Destroy the DPBP object and release all its resources. + * @dprc_token: Parent container token; '0' for default container + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @object_id: The object id; it must be a valid id within the container that + * created this object; + * + * Return: '0' on Success; error code otherwise. + */ +int dpbp_destroy(struct fsl_mc_io *mc_io, + uint16_t dprc_token, + uint32_t cmd_flags, + uint32_t object_id); + +/** + * dpbp_enable() - Enable the DPBP. + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPBP object + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +/** + * dpbp_disable() - Disable the DPBP. + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPBP object + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_disable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +/** + * dpbp_is_enabled() - Check if the DPBP is enabled. + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPBP object + * @en: Returns '1' if object is enabled; '0' otherwise + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_is_enabled(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + int *en); + +/** + * dpbp_reset() - Reset the DPBP, returns the object to initial state. + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPBP object + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_reset(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +/** + * struct dpbp_attr - Structure representing DPBP attributes + * @id: DPBP object ID + * @bpid: Hardware buffer pool ID; should be used as an argument in + * acquire/release operations on buffers + */ +struct dpbp_attr { + int id; + uint16_t bpid; +}; + +/** + * dpbp_get_attributes - Retrieve DPBP attributes. + * + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPBP object + * @attr: Returned object's attributes + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_get_attributes(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpbp_attr *attr); + +/** + * dpbp_get_api_version() - Get buffer pool API version + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @major_ver: Major version of data path buffer pool API + * @minor_ver: Minor version of data path buffer pool API + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_get_api_version(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t *major_ver, + uint16_t *minor_ver); + +/** + * dpbp_get_num_free_bufs() - Get number of free buffers in the buffer pool + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPBP object + * @num_free_bufs: Number of free buffers + * + * Return: '0' on Success; Error code otherwise. + */ +int dpbp_get_num_free_bufs(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint32_t *num_free_bufs); + +#endif /* __FSL_DPBP_H */ diff --git a/drivers/bus/fslmc/mc/fsl_dpbp_cmd.h b/drivers/bus/fslmc/mc/fsl_dpbp_cmd.h new file mode 100644 index 0000000..1428dc6 --- /dev/null +++ b/drivers/bus/fslmc/mc/fsl_dpbp_cmd.h @@ -0,0 +1,88 @@ +/*- + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * BSD LICENSE + * + * Copyright 2013-2016 Freescale Semiconductor Inc. + * Copyright (c) 2016 NXP. + * + * 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 the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * GPL LICENSE SUMMARY + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * 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 HOLDERS 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 _FSL_DPBP_CMD_H +#define _FSL_DPBP_CMD_H + +/* DPBP Version */ +#define DPBP_VER_MAJOR 3 +#define DPBP_VER_MINOR 2 + +/* Command IDs */ +#define DPBP_CMDID_CLOSE 0x8001 +#define DPBP_CMDID_OPEN 0x8041 +#define DPBP_CMDID_CREATE 0x9041 +#define DPBP_CMDID_DESTROY 0x9841 +#define DPBP_CMDID_GET_API_VERSION 0xa041 + +#define DPBP_CMDID_ENABLE 0x0021 +#define DPBP_CMDID_DISABLE 0x0031 +#define DPBP_CMDID_GET_ATTR 0x0041 +#define DPBP_CMDID_RESET 0x0051 +#define DPBP_CMDID_IS_ENABLED 0x0061 + +#define DPBP_CMDID_GET_FREE_BUFFERS_NUM 0x1b21 + +/* cmd, param, offset, width, type, arg_name */ +#define DPBP_CMD_OPEN(cmd, dpbp_id) \ + MC_CMD_OP(cmd, 0, 0, 32, int, dpbp_id) + +/* cmd, param, offset, width, type, arg_name */ +#define DPBP_RSP_IS_ENABLED(cmd, en) \ + MC_RSP_OP(cmd, 0, 0, 1, int, en) + +/* cmd, param, offset, width, type, arg_name */ +#define DPBP_RSP_GET_ATTRIBUTES(cmd, attr) \ +do { \ + MC_RSP_OP(cmd, 0, 16, 16, uint16_t, (attr)->bpid); \ + MC_RSP_OP(cmd, 0, 32, 32, int, (attr)->id);\ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPBP_RSP_GET_API_VERSION(cmd, major, minor) \ +do { \ + MC_RSP_OP(cmd, 0, 0, 16, uint16_t, major);\ + MC_RSP_OP(cmd, 0, 16, 16, uint16_t, minor);\ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPBP_RSP_GET_NUM_FREE_BUFS(cmd, num_free_bufs) \ + MC_RSP_OP(cmd, 0, 0, 32, uint32_t, num_free_bufs) + +#endif /* _FSL_DPBP_CMD_H */ diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map index bcd29a8..67b0dc8 100644 --- a/drivers/bus/fslmc/rte_bus_fslmc_version.map +++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map @@ -1,6 +1,12 @@ DPDK_17.05 { global: + dpbp_disable; + dpbp_enable; + dpbp_get_attributes; + dpbp_get_num_free_bufs; + dpbp_open; + dpbp_reset; dpio_close; dpio_disable; dpio_enable; -- 2.1.4