From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0083.outbound.protection.outlook.com [104.47.36.83]) by dpdk.org (Postfix) with ESMTP id 58F0F37A8 for ; Wed, 15 Feb 2017 20:06:12 +0100 (CET) Received: from DM2PR03CA0025.namprd03.prod.outlook.com (10.141.96.24) by CY4PR03MB2949.namprd03.prod.outlook.com (10.175.116.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Wed, 15 Feb 2017 19:06:10 +0000 Received: from BL2FFO11FD042.protection.gbl (2a01:111:f400:7c09::143) by DM2PR03CA0025.outlook.office365.com (2a01:111:e400:2428::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.13 via Frontend Transport; Wed, 15 Feb 2017 19:06:10 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; caviumnetworks.com; dkim=none (message not signed) header.d=none;caviumnetworks.com; dmarc=fail action=none header.from=nxp.com;caviumnetworks.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 BL2FFO11FD042.mail.protection.outlook.com (10.173.161.138) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.904.16 via Frontend Transport; Wed, 15 Feb 2017 19:06:09 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v1FJ5fLc020023; Wed, 15 Feb 2017 12:06:07 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Thu, 16 Feb 2017 06:09:07 +0530 Message-ID: <1487205586-6785-9-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1487205586-6785-1-git-send-email-hemant.agrawal@nxp.com> References: <1485172803-17288-1-git-send-email-hemant.agrawal@nxp.com> <1487205586-6785-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131316591701126806; (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)(39850400002)(39400400002)(39840400002)(39410400002)(39860400002)(39450400003)(39380400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(50466002)(8676002)(92566002)(626004)(81156014)(2906002)(106466001)(81166006)(77096006)(54906002)(50226002)(105606002)(305945005)(68736007)(33646002)(86362001)(53936002)(4326007)(5003940100001)(2351001)(575784001)(47776003)(5660300001)(38730400002)(356003)(97736004)(85426001)(8936002)(48376002)(110136004)(8656002)(2950100002)(104016004)(6916009)(76176999)(50986999)(36756003)(189998001)(389900002)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2949; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD042; 1:L3KZclaUW4b8ieE1KNAaadspFS4adKrLdJYd/EjgjgEz0hInvd7zuoZKlLwK2X3NYHv9qZXI5jxN5abh0OBMTC8TPApEgmNvZwYVlCGJJULM4AepnbiQFjGezPvDTU0tCGgZqE6Ax1LYiGvK5nO/D8gJ5ovI1TTm2MdS16KpciGW9/WfWGuqQkvUF2WQ5i1kS3UFP/A/t0TK1cG8DHrw2+0MEbWJgnG97BIl0Cdlx0vlnLwvHpG4D24Y5qNg0lNSRr33KnPPy2zRRiY7mk2675gwan3nkyjUn6Jo8OXktkuzJZw71QzOzyMjo37YWf+uSKMf6SHTWZ/mArkJ7UwcMg91aWP1xXzD7i8J0UxDBAukuvBew8Swhg9sulpSdpAK2CCJhnwbeRDuXlAQkviZYxG5XgVPTNIdTRMx8m4HH7mk/Dg/9NjoBO/QQcrB1HlNo0QXsPSlNBWMGZTez+LD1Hhzznj0LrTW9laCNBTVqG4Xvp/UieyppKC6EYb0txQ6v2MHpaLHu5sEB3XBuVsesvh4Gs2zuzHFn28FSJTGCOjukFHDuUkeMRbj2GFTM2zP45zEgZWZIeeJTBfppQ1BBRk4SkCyBXS47X6B5M0fsUTW5b8fqnUkv5WaEE0NLRc3PEK5Rafmbrzza/2cCSmDAQ== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 7aee2cd0-c4a7-42b3-8d35-08d455d5b3ea X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY4PR03MB2949; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2949; 3:N3E864GqV1iydvP4TunI/HvpOcHRcd9H4FKZpMxWRFiP4UJ2YYCQvUi8AFiQeuX5IqDQHcTjb8nJDMKFectZzLeCmueNnTuLnnWo3sQI42e+xKLQGL4/8UMvhBbjJYO6BWQ5hNzDm1Q7V7SZNNs5thQG/EUyF11ptN8HnnJeXlNaCNvuL6HcrtIWTckjaw1lHS2iajCUXkUg6ASST7hhOvIifFPLkFJdYAEP3B0eS8F7CeIsHyZsTEFF464n1+4GmetQpNH8nCRmL9mlT8/GQ11Tname9JCRxZBtwlIR9RWgDc090u5EJ4j2qs+MboeBbxpyyGxbvBs0N/reC/wrtozf7wQB8z77la2GaVlEWPftzeqSuar2D2KWhFNk8l1N; 25:+Wn2hF50gnixAwM7BGkIAqwKhKots6jbMpxLA0bErXso9QTyws2dljMFvp9Sg6pLmqiPMPP5g57srX/stao+P4jQOSif28sDVdmCgTQNNLTNTymqxfo+bOD/vvFVRtFIwrwdJ+mXtVd8gs+U3hQGQ8oc7gzxPAg9HYGTNBNp89qAx2p2m3Idfgrfj+vdeNSUWgSFsLKyxLxCWddyBf1LjUdeiKbvClx1sa7a1lkuyzFBYwxM6jVmWyPH0/6zPPsDptc95NLSQlHaeadKKrPQmpssX4x0kiix/i8DfBtatMaZ6jKsPXCgdhL5zGVq2UXW48laxBnRxO0od8rUyRZDG+Uq040oTXpr68pzJe3kJ/yphu5K+EoUItk7H+lO0VhP6LsbXPyqZk63SBT7zyzEPYcOxI8dSb06NtGafC59Ya8ONvvCZF7I5FtrJPBPjzEtD9TD7Vhs/QoRBPLyFLwXRw== X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2949; 31:UvjTEZNq0RIxj8OGhv3nbCl+G8qd6935EzkaRiq81ZS3W3SrtK8YC4RIfD52ewBiRXBH9FX5C3qSOF/r/Wj76uxFIRDKg49OgwhlMGlgKnCZM69qzpZ29LDKDLFHYnKcew/Is7rWuiBlY6qdzfmP0s3ZPaKm0bPj1vugSwwWRbJ1eK2QTCt3ygYG54lMbsWt8vCMF+BXONWoXzV94S3PTVp22HBYgK4NRWp5th2jkcsJjTtGgSuV+rSCgX0vETEV98bRmjN3ErKKK8+h7ErULXamkElczr6Xan9w3jB5xlI= 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)(13017025)(13024025)(13018025)(13023025)(13015025)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6096035)(20161123556025)(20161123559025)(20161123563025)(20161123565025)(20161123561025); SRVR:CY4PR03MB2949; BCL:0; PCL:0; RULEID:(400006); SRVR:CY4PR03MB2949; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2949; 4:gVNeundqyqH2Ha/KOxb2Fo7zWfE1XHnFRJdU4U9P+unT6pKsZOSYMS5KrViDXK2Fnz0HfnKprVUkeUkCU49IYK3DnTIXj3zfrq+JtmtCWtnWG4JHuPxNQYMVg3MbNlvnWOCPL0HkAof3bS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FK0JIn6EfzUwyYDVZ/dA1b?= =?us-ascii?Q?g8fGOJ5+4V7tvZBgqhikWVu18QlICOXezi+3wlo+0v6H0oMi7lEA+hM67i4+?= =?us-ascii?Q?YqBvJF2ks3X7PMVpUr+mAbRwW67SzWamKFgWqKyn5mz6Du7Niqt3G+AnS5i6?= =?us-ascii?Q?AYgmxaOwAN3e8SzCbhekxFrlw5weqbAFyRSPporQiSdyeVvzwFs9m31ytY7s?= =?us-ascii?Q?fdfkQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2949; 6:61Sn2e4iRXprT/zOETCjAqRzOQKLIzBLYKSaXxs27ZEt+W807HVWBqEdp3WG52/C27I5OVqTHhcgbFEOL6556KQzzZdMaPlAmWfd6zrjCb9n0LhgMgHDcajrA5Z+6esSuKJ17itKERRAzy//T/Uxir0Zcx9zH0B8NHyQg59FzQ8lB71KIXJqJw7gkfHWvfh8ox25B8KzxP127huOCo3QwIjsdBqpBkgRqJLKFRJK5AQyWMnhSm7l8HfmH7V/WkJPWsIFrCe2l7kSd4c6NHPdubtndxogdYtA4GVaMqtf00VfM3/CsPe1GVS4b+FVb6EBE2LFVxKajJkUJHQM6D4AvefDxTdT/wqxTXRZrHOmJj6wnm/Df0D8eKrIJGjSkt6G796Ighw/iyAWMmzYI0Mzy5X77xOHwm4+LMRP/t/vmAw=; 5:7zqYirLoowkY3DfV1bpweK9cHToplXxLUtfydRYizDyHfNdURXH9U4n13pmjq+olC6Lbz1nnwQqXC4PEF21+YLG8DOX/jSS0Eq6NEv+polx4V848tet33HhxkYlOD437oZkcx8Dt4KZeQSVcB5dNdLthRtoN3683qdaD/wRC+kwWz4hWUwU+V0N+t7XVbXPv; 24:8PjPp6YZdkYh6/xQipEmVBxhEqHwgAFaRSwpGNMdVqY4FNSRXlPj/wAZtw0Go1kN+KbO/y55QwKi8ElfsyrRQ7OMd+KJMLIdQwIzIZNQCq4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2949; 7:cNBdHn21mGL4yF3jKOwTV4J786cq/QrElGj7luxsB5xH7sZC+XpDup5zETFnAfe6tzTJ7ZX0B7fttK7SyL9wJDqJUuIK3hrjTYACmy3EL+QyjuvYZXEFUapKeEAogPOB75O5TH97aiGqRybKg42VOwi4WTnXzweJW+9h7QySRspKalyhMz5tiFhzULmI0Y5JR6HRljZmu3DHyNaI2EzUftIoBzBsMmyPqil6ipzKUkka4x/Egh7R/xsvjOaneTs+VTbaeSr7fjk3w7Cne6iVW8p2sqDt9/oyRSOM73irKvuQXil6MkJcVn0lcKOIcqdU09du2bF22gPX2JieqH74qA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2017 19:06:09.9254 (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: CY4PR03MB2949 Subject: [dpdk-dev] [PATCHv7 08/47] 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: Wed, 15 Feb 2017 19:06:13 -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 | 237 ++++++++++++++++++++++++++++ drivers/bus/fslmc/mc/fsl_dpbp.h | 227 ++++++++++++++++++++++++++ drivers/bus/fslmc/mc/fsl_dpbp_cmd.h | 83 ++++++++++ drivers/bus/fslmc/rte_bus_fslmc_version.map | 5 + 5 files changed, 553 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 53ab17b..628e517 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..0d93e0c --- /dev/null +++ b/drivers/bus/fslmc/mc/dpbp.c @@ -0,0 +1,237 @@ +/*- + * 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; +} diff --git a/drivers/bus/fslmc/mc/fsl_dpbp.h b/drivers/bus/fslmc/mc/fsl_dpbp.h new file mode 100644 index 0000000..65262bd --- /dev/null +++ b/drivers/bus/fslmc/mc/fsl_dpbp.h @@ -0,0 +1,227 @@ +/*- + * 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); + +#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..a6bfabe --- /dev/null +++ b/drivers/bus/fslmc/mc/fsl_dpbp_cmd.h @@ -0,0 +1,83 @@ +/*- + * 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 ((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_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map index daf6b8f..5167262 100644 --- a/drivers/bus/fslmc/rte_bus_fslmc_version.map +++ b/drivers/bus/fslmc/rte_bus_fslmc_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; -- 1.9.1