From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0080.outbound.protection.outlook.com [104.47.33.80]) by dpdk.org (Postfix) with ESMTP id 6FBD069C6 for ; Thu, 29 Dec 2016 06:14:52 +0100 (CET) Received: from BN6PR03CA0064.namprd03.prod.outlook.com (10.173.137.26) by BN1PR0301MB0740.namprd03.prod.outlook.com (10.160.78.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.817.10; Thu, 29 Dec 2016 05:14:49 +0000 Received: from BY2FFO11FD021.protection.gbl (2a01:111:f400:7c0c::119) by BN6PR03CA0064.outlook.office365.com (2603:10b6:404:4c::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.817.10 via Frontend Transport; Thu, 29 Dec 2016 05:14:49 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) 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.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11FD021.mail.protection.outlook.com (10.1.15.210) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.789.10 via Frontend Transport; Thu, 29 Dec 2016 05:14:46 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id uBT5DOHp010218; Wed, 28 Dec 2016 22:14:42 -0700 From: Shreyansh Jain To: CC: , , , , , Hemant Agrawal , Alex Marginean Date: Thu, 29 Dec 2016 10:46:28 +0530 Message-ID: <1482988612-6638-10-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482988612-6638-1-git-send-email-shreyansh.jain@nxp.com> References: <1482180853-18823-1-git-send-email-hemant.agrawal@nxp.com> <1482988612-6638-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131274620892438169; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(7916002)(39850400002)(39400400002)(39410400002)(39380400002)(39860400002)(39840400002)(39450400003)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(189998001)(2906002)(69596002)(5660300001)(8936002)(85426001)(50226002)(110136003)(81156014)(81166006)(6666003)(92566002)(86362001)(626004)(38730400001)(2950100002)(104016004)(4326007)(6916009)(77096006)(5003940100001)(47776003)(356003)(8676002)(97736004)(2351001)(68736007)(33646002)(105606002)(50466002)(48376002)(50986999)(76176999)(106466001)(36756003)(305945005)(8656002)(7059030)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0301MB0740; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD021; 1:fuswtJedLnlBWfPn1pstQDprfwQU5EAuY+3uegIa84Y2emP77RZjmB2lFj62iJTyEASndE8gvKDzzy0Ljlu3W9zp5nwU4rU/VUoZG5e19rEjoCYmx4/xsJR9meUnmjiSYGiDRgAsdhele8vkXL4a62NsohJoYsNJ0RdN1dXl8qbsC7L5so+WJM0P4w5U1r6o42uLBMVzjTwve/dlkEH/nu+nCk57kwKmDcR4I6bSu/drBR+AJ5MDaN1SSdolyO6aBZTvvKHfFu9tAZdHz/9tin3CW9eth4TBG8SJRVwKBG3kY6zOzuhEPxN3nZgpdlFj12NxMg2/DgN2bBTVAdebJ6Y4zn71oBkWdlYpuTVIeMp1tCraajLPzXx+SPn2CalK1up+SAuOaxs3XN3FQLk7Xo58Gmba5enQoh92rAG7DwC1sOKfV3LL/nTssMC9d0mbUGaC/C2GxKDRI6GKt9AlscAf1NzPgW2GtKzQotGFVJwoBvr5S7gyTbWvC5FCq0lLXomeMaK7S1JazgUVsf3vehx4YpDD1DD9dBsB7V9VlclKvFnJbcEjLu4B57LR9Gfyad02+WU1i5KJo2mewlbaGa7qaOY+O5tmOrkwuHEKEnj0b+ef1w2knjHZDBKRddBb8xs2ibUy+BrMJKqhBaxsRqTwxPpd6jAGAopry1j36TUGPgIa5DrXXEh0m6K9I9k4MWg5qLK5qHTXt+z+02ewP9UPwaQ7h1gF9PMqR/lZTdDBRWUEFQxVPhOJ1wF7ZO9LzDaDR7pX022DNa2HmEWFKg== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 3b30f9aa-3dd1-4092-fd39-08d42fa99cc5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN1PR0301MB0740; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0740; 3:bURwvMhuWD0pa6wM2VyKygBy6ClSWBsRALMQin2KVhNZM8iFLKLGMrsY3Le3nHuvRIvKrFzVFHUAkd5NY6fWbkjvgqIahG/DtGzc2mz+wJkw02ZX0x+pSQyjOYth26y76NTmbX8JiXpJMTRYPtAAAIYdOxMtArGvH8TFDyOtNIaTeTwzv7LREeq47YbmFCjiS2KM+5+u8a9DWesRmFI/EJRvVB7GcZT9BA27cPeecxlRsk5I/XMWCPYzdSRQtFCv/5JJ/erWZruSwKMBsdraktIwb2qgeBE7YXsGh/7w5sHvT7OECMxaJ9o9KkMRzT2VKqJE5wC7h9JTFfhIJmCBsun8IP37VsgQauEf/A00/yE= X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0740; 25:xnvrhmF5JzxIPqbwtW6ykbAK2iXXQdyzuXc+xZosOyvizLE18C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PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13024025)(13023025)(13015025)(13017025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6096035)(20161123561025)(20161123559025)(20161123556025)(20161123565025)(20161123563025); SRVR:BN1PR0301MB0740; BCL:0; PCL:0; RULEID:(400006); SRVR:BN1PR0301MB0740; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0740; 4:7vb4oCycpTjGoTM+2QuHmdRNDl2jDoXmWbgclKq15oOhkqXcWLOK+u3bPt/GCmUxeIMVBPBnlp1tIasvyCFXDWwjFJkzHrnVte+h+Mk314r5M3OvQn4QCezkRGaLtXq3pTWOiGhQvhSoSNE0YEynnL5GwcfWUAJp5xzbi5O3HvHp3zrlVsECa6EQUpAttM6OAQWGcljQh1MaeZEs6FRAsdIiVNm5HFINkHNey4mJXvEge84iEDbp6AS7E8y1AQZHGVKNmbzV2GxVnJCSqYruFemG4L3Ro0b9Lj3je50VSpu6HKZL+m09Rj0WpIjN+Pyy8Ld0nvBmc7ELbZ2NbUprgocyvMr2c97QEPIE2+DGVm9G/saJ7UkrZze/zdY8BuAhgWASi1znAmnC9u0xoZeYHaqgP/1Q/8xhZRWu6CKBo8QECjgjm/12kMdSupOqWjo+LL1CU2uYHg1wpzmNFeHNbzHOZB+4TxlStetVRyfxhhE/pjtt0hQI9N5FT6Fh4+3lchEFzolg6s82ngFH7Rh6o4Ia7ru9T8VSo9BiMuRtITCc7IMj/X/IeIgTRnj+O9+0+6qpiMeFjqtWsc6H0k3knvdtMu19C0pOsaIsTEdj+JQGSnIshyQnCO/lMAYEE74RjW/4LMUC6y2LXhBxlW/CZYNxBpHbpI7vsc2aGK7UrJny5rYdWLEFq6+/M+hAIyvPgOIhh0qkNY6Bu7Gm2nyKhHJqr2t3Q9p0ANfDyVZyIoim5zgHCdpWKmoyESno2gxI1JheVtL4z8BFbiNVOdO8iA== X-Forefront-PRVS: 01713B2841 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1PR0301MB0740; 23:WJLJnkZOwY2c2ky2oc3D/3OIqAKjEa4zT5nx4Nu?= =?us-ascii?Q?jfxRu1qGtBMhBOJFO9ZxvIbFx+i7hg73ZKaVc4tGFEUJTNf8mt46f7k3Rbqp?= =?us-ascii?Q?ZjwvVWf5+anoCvN/qh6JF9lA3xsXk9qiWIglPmm9vOZTFIz0jae0oJ33mKVp?= =?us-ascii?Q?DTNt6J3WCHtvnuv3FjegfAENBRGLGmcrkGevj2hk4BHYtRVuiPSCZiN8L7kf?= =?us-ascii?Q?iPgwD/JU7qGpqOTIdik6tzjxVug67JdbBR6MI51j60crJjJr2jLTN/Nqb4U5?= =?us-ascii?Q?+iXMCwG+Uy7R+6I9Gbe5BzNmXbCZeCBNw6ntNIV3s98sorhxfQrI8r0cii2s?= =?us-ascii?Q?UGunNQoyjIXnP44i/galtN/aGQ1G0SrTqgAVOyyIDczcQeB2KC1vr0DvNzE0?= =?us-ascii?Q?QRLQVwDCjKduugxY30hiFY3dgwau21KucJucyF+cJ7HF9OUQyiQOVh3X0pjU?= =?us-ascii?Q?QlgDze3bLScb6uM+l/PFWB0DQYbWosgyudyOs+p2UiJZbeBgQ91WY53UOp0f?= =?us-ascii?Q?rZW7nMGpP/gJbFFV/cycllfpLjKXKt4/oYg9uL6Y9wcdG1Q5dYDisIjeWoFl?= =?us-ascii?Q?2x1gHOg5q2pKbOFtpxk5He9JCVMHPmclvop8GvlQzgwi1lS8+JTU7V7izX/q?= =?us-ascii?Q?80Cn2suNynk8lqZVVd/bpBnC198wlo24NrRZiOwN5uXWNnLsCrheng9XMgaq?= =?us-ascii?Q?cio5qnSu0GxFwPcwV2GfRnGkx4RwiJIZvtO5gDpS7C7pQyflKf1lB1S6HnCs?= =?us-ascii?Q?SYb6VtRZ4FcnbjAG/Y4se9TTxsx6Xsy/S0Ciiqxldy9rCiLB2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kRsiKn2Pu85XDZqNe00znX3iREqBU/yye6F7MWoNhzz0gj7aCmzp8k2n0mk29+f94rqWaMY; 5:XAhYHq8rExcwcWC2EVp2UKqU88zhmpXJRCVuQdzmLI+IHw3Kz0gwsNEAQXu+FFttnwSiOtppli6m/rGIBoavKLXMPQK01y2nbswVQm1pli2eftI669Hto9phMuvS0TjIt8AneAcP76V5l3h0G+K8es66+j0JwdoOiKC+ZUWQgchwEVZHL/jvU94QE9b6OvZV; 24:W9gIRTHLO+Gp/fHpEfBXgPszjvllGGjS/+C6DqhHiFPeTAfH4Ryb8aBQ7CDN32VvBE8hB2xXwp4dTfxIwNtmwo6f0cvjD74N1lmaQqJ1IuU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0740; 7:5KoLPz1wU4HWP4Otffj2smCj7b2tPf2nIFgCKrTluxRYKjWT0lMcWOkG+ZyWKznz3vPz/UMgmZQjPyldV3IeKB1NYN740/bG73IGHt97/P/kTdQKJM/2tpTinw0EGaevEm8J4FNp07GeUceClk+5iadJR2uSuNBnTGjrVTP0NLvekDoslbpfELfT8Fom7DSMsJ9uF217jEB4jjdg6KJ+5cJL7a0PWyssqi9wbQg1pUmLkySV9gQXpiiUwnBvxAwGr0RP+D+T6Ic7aBfYVTlRbiMq4zTnA3MJ73qrmipG+gz2J8TxdCuX86T7lk5/EUNnVuDGX9W/MhPE06sTlX+qS3CYh/wG6I83QwS9fVrx+vJ/Xw5xAAirEi0Ekd64yXFG/62+2ywrkbWhKrW0gP1MVapoxYrj6123Ud9/eKsg6ShSSFm0V00bevCxiQIAO875PB6jLSfBCk2d9w4rIW9r/A== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Dec 2016 05:14:46.2954 (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.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR0301MB0740 Subject: [dpdk-dev] [PATCH v3 09/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: , X-List-Received-Date: Thu, 29 Dec 2016 05:14:53 -0000 From: Hemant Agrawal 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; -- 2.7.4