From patchwork Thu Jan 19 13:23:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 19789 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 99F27F97F; Thu, 19 Jan 2017 14:25:28 +0100 (CET) Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0087.outbound.protection.outlook.com [104.47.41.87]) by dpdk.org (Postfix) with ESMTP id A39A7F949 for ; Thu, 19 Jan 2017 14:24:45 +0100 (CET) Received: from BN6PR03CA0059.namprd03.prod.outlook.com (10.173.137.21) by CY1PR0301MB1578.namprd03.prod.outlook.com (10.162.166.16) 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:24:43 +0000 Received: from BY2FFO11FD037.protection.gbl (2a01:111:f400:7c0c::178) by BN6PR03CA0059.outlook.office365.com (2603:10b6:404:4c::21) 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:24:43 +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 BY2FFO11FD037.mail.protection.outlook.com (10.1.14.222) 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:24:42 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v0JDO4ek015351; Thu, 19 Jan 2017 06:24:40 -0700 From: Hemant Agrawal To: CC: , , , , , , Alex Marginean , Hemant Agrawal Date: Thu, 19 Jan 2017 18:53:35 +0530 Message-ID: <1484832240-2048-11-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: 131293058831683562; (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)(7916002)(336005)(39380400002)(39410400002)(39400400002)(39450400003)(39850400002)(39840400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(5003940100001)(2950100002)(50986999)(76176999)(106466001)(189998001)(8656002)(105606002)(86362001)(2351001)(47776003)(54906002)(97736004)(6916009)(6666003)(104016004)(110136003)(33646002)(8936002)(48376002)(81166006)(81156014)(53936002)(50466002)(8676002)(626004)(77096006)(50226002)(38730400001)(85426001)(68736007)(92566002)(5660300001)(356003)(2906002)(305945005)(36756003)(4326007)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB1578; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD037; 1:sjCgulii3GMHZOJCXDJ7OEN0vt1s/It52RArnxAnLb/midlFo/hOFdcyeTyS+0t4GLBY2MnRqvX4bfMs1ZJVjLprrZfZs4Yom4teTOmWNmlB2/CxBfRnnqFJXkPTDpIE3CGXaXvZMvp8368bZZWbZyAe3mNPcoCo0g15aevBJvLe5g/3a8jDFFJB+phOCIMF3pyL+DwJIcAuWq/FZOa/l9wi1euiALyXj7Y+axXb79LerS7dWsE6QtgL9eYtS7291hGxHCMkSXaru/wSWRkQIo0rHWjRqlfI9pqGj9WNiH3SkvH5papLGx9jSq//zP1DVOtIXV1Zj03Ac83E8GAc9rYWKwdsgWVtscPbIHLnH9JrdqkkuSxZ37yTRx87e2IL7tfdCYA8+yHw4DmaVSICwIlaSk3X70C9QxRr7cuINiHN7MdySuVcwTt4p/DA/TyeN5/+we6oB9JDvAug/gdxavHxW/leV7F+u0vO+HOAdAwfRufTpSSlx8aBXCi2cheTCXTMb6DSaY7/ZAMj8ouNMkJMTQxGjfojLVYElAjk1YBDx55SBf5gTCuyHZX8rafqPbCJfpKPbIY8JQhzoF563mgbR6AOUqHXtGAW/h8xNrM/6zNeoGCwMZ5v83baePXR1L6j3ruR3yZl5a9Sp237upKANdj+7u3jz7pFMRPXkIMm2AWREZa+obkAKFzpfN5CBKCUvX3zmp+YDZ6ayeMUiLxO2di90Ia3ly3AJNYDnJXf775Q5C+q9DV0gNTGpiYI MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 9e04da19-7db3-48fe-0fea-08d4406e879a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY1PR0301MB1578; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1578; 3:qTj+1cPGAQqhLK4n1C84bkEAw/plUcaRkN0qS4J2J2VlxBmEyfyXHqvKqaUjDjqMbR1fKkVPpJsPUk5JQpbZNm8L3gZ/kXy70hL6cs21Tlv3L/a57NMB+8s+fD/cYUhw+oRwW8/WwRB+0OQg+V9NSDabrvx+/kZ84FAMQyUyMdD5IPIHnbZ0V9WI5avPUMIR1VKg0I50fAA2sT41DFsRDq9TVCvNP9SSltnI5RcT+1bNYNooGsJ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9tdBFqzIJ9in6DOVoYregEvO5+XG8WEPcMJcayiKQEpr/VQKe3m8OaLJLT3RSLfR1cBP7FGSNomUqJ+1aDirY4GlDRHAjHZWEuGqMXR7xGi9oBNbxQDHINrEt4wZIdKdZa4/tHx24OVRAuWtmnV+prhQr/mQS/f9EiwRqi2xx7LdmatBEo5EJPM2JVIhB4/rPQh50+bxZkEV1gTtQ5jFQaphGluWdcqnjl9Y= 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:CY1PR0301MB1578; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB1578; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1578; 4:dLdvRKRKhk09P0vn93ql6BhLL8geTBnsCl1icj1z44vpISSTf57pz8YE0gNXv4Sd7SZDdG9vcibPHFkQli57Io+mt60pC5QAZ097C/c4hinPpsS70oAfbGia9IasXraNpdydlYUZDqBKAU7RxDUDxJOtsU64MzuuOqYVcgtbkaVjPel4W+6SjIPCD2WIntf39wCBm5QAOm6vWAY2I6oziqd4IJeByXmlEIX8ogiIFzjNOIxpE6mbbnfZSlSgoNmSxHxtK9uEElBsdwhB9DnPv5l4hS4Q6Do95+CVLl4sdos21jX7DEj5HYm9kZzOjwNxNM0cPXHbyJdfiKeAg/z8MEBzEnUr1/KN5kT00d73X6VFHcXaUqIqo82j8wnVEMdt7QXyPBfvdx3PxdSW9x5xsWZGCZ1rZxKw8/5E6uxpOK0h//j+uTFY6bMYxtXC6fbp9vFeVEr4zISvsF+rswOg1n/f3B6h3MuEhdA/q0mdn/8EupM10GlfJUTbq0gBngpjDzI0RKIrLMXD4IH/9rI08WjNumLdnyqrwpF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Sva; 5:ZT4owvMU8PqjKdjNdXON8AS53x5+Bus6eTOo97dQjerqWgty/AmI3Dx+WqvXybJLqptmuTPX4qdIS4RqsrfbeKwXC51NQekkiD7xjnPqaEBCHsuwN9oRoG+qVxEMI7edXVpkAiPd9IsYEV/4NXs/QXfGdWQFeFTTrWj3bsv65gBAd/Z3nWyUnDvTpzDGiwfi; 24:e+o4erWerUg5KJ5t8df75L8UK6ryiHVxLWuR3qJfy0nqyQjUUvtpAJzZ7UEooXCQSFO3onKQ65uOUvIrp50FhvYQZk19XsMGb6kdpG8LMio= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1578; 7:79QKNL0mDw9rTXEjDhdeLl3S934Rb6dmt5Kn3vIaoc8SEeXKTTvy96kT5c0IfTOXW1K7UAb67LjmKpI7v0yhUxRwLzKnvNrrMGUSRGdaetnrpr+xokemyPNZSyh9qJUZwExKidPoybXQsBHFy2niNwGoASFkSmZ08xULqbKkQLWeK441ogVrvo6Mn3E3TnNxPesrX1RBqD4jj08Dc8AklwApa0qM26r4Yqbs7T4J/MnK+ypaY1eM2GpFCXVrGr9YhMn3dVUGl5v39MLAt3DUrgjPsVn12WaZTJ0aDttKp7U4OMEmunoL7gVXQ8296TzwpMA8hlwOfMCGrvWyF4dkB5iVto2JWMZX10VD7iDeqTLOEgHYxvHX24XutFdY4JpOwjRV7hb7A/zjPpOXtykakVk1cUc8N7beNo0yYp9cU85fom7WLhvdDYkkkrEfmufu0rcZf9/1cHO4NS4W0MVdhA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2017 13:24:42.9655 (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: CY1PR0301MB1578 Subject: [dpdk-dev] [PATCHv5 08/33] 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 | 230 +++++++++++++++++++++++++ drivers/bus/fslmc/mc/fsl_dpbp.h | 220 +++++++++++++++++++++++ drivers/bus/fslmc/mc/fsl_dpbp_cmd.h | 76 ++++++++ drivers/bus/fslmc/rte_pmd_fslmcbus_version.map | 5 + 5 files changed, 532 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 fa1ce13..412715d 100644 --- a/drivers/bus/fslmc/Makefile +++ b/drivers/bus/fslmc/Makefile @@ -50,6 +50,7 @@ LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += \ mc/dpni.c \ + 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..2260d86 --- /dev/null +++ b/drivers/bus/fslmc/mc/dpbp.c @@ -0,0 +1,230 @@ +/* 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. + * + * + * 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; +} diff --git a/drivers/bus/fslmc/mc/fsl_dpbp.h b/drivers/bus/fslmc/mc/fsl_dpbp.h new file mode 100644 index 0000000..966989d --- /dev/null +++ b/drivers/bus/fslmc/mc/fsl_dpbp.h @@ -0,0 +1,220 @@ +/* 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. + * + * + * 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); + +#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..4e95054 --- /dev/null +++ b/drivers/bus/fslmc/mc/fsl_dpbp_cmd.h @@ -0,0 +1,76 @@ +/* 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. + * + * + * 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 ((0x800 << 4) | (0x1)) +#define DPBP_CMDID_OPEN ((0x804 << 4) | (0x1)) +#define DPBP_CMDID_CREATE ((0x904 << 4) | (0x1)) +#define DPBP_CMDID_DESTROY ((0x984 << 4) | (0x1)) +#define DPBP_CMDID_GET_API_VERSION ((0xa04 << 4) | (0x1)) + +#define DPBP_CMDID_ENABLE ((0x002 << 4) | (0x1)) +#define DPBP_CMDID_DISABLE ((0x003 << 4) | (0x1)) +#define DPBP_CMDID_GET_ATTR ((0x004 << 4) | (0x1)) +#define DPBP_CMDID_RESET ((0x005 << 4) | (0x1)) +#define DPBP_CMDID_IS_ENABLED ((0x006 << 4) | (0x1)) + + +/* 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) + +#endif /* _FSL_DPBP_CMD_H */ diff --git a/drivers/bus/fslmc/rte_pmd_fslmcbus_version.map b/drivers/bus/fslmc/rte_pmd_fslmcbus_version.map index daf6b8f..5167262 100644 --- a/drivers/bus/fslmc/rte_pmd_fslmcbus_version.map +++ b/drivers/bus/fslmc/rte_pmd_fslmcbus_version.map @@ -1,6 +1,11 @@ DPDK_17.02 { global: + dpbp_disable; + dpbp_enable; + dpbp_get_attributes; + dpbp_open; + dpbp_reset; dpio_close; dpio_disable; dpio_enable;