From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0087.outbound.protection.outlook.com [104.47.32.87]) by dpdk.org (Postfix) with ESMTP id 08DEB56A1 for ; Sun, 9 Apr 2017 09:48:32 +0200 (CEST) Received: from BN6PR03CA0092.namprd03.prod.outlook.com (10.164.122.158) by BL2PR03MB273.namprd03.prod.outlook.com (10.255.231.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1019.17; Sun, 9 Apr 2017 07:48:30 +0000 Received: from BY2FFO11FD003.protection.gbl (2a01:111:f400:7c0c::104) by BN6PR03CA0092.outlook.office365.com (2603:10b6:405:6f::30) 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:30 +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 BY2FFO11FD003.mail.protection.outlook.com (10.1.14.125) 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:29 +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 v397mBLO024015; Sun, 9 Apr 2017 00:48:27 -0700 From: Hemant Agrawal To: , CC: , , Date: Sun, 9 Apr 2017 13:20:08 +0530 Message-ID: <1491724224-6319-6-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: 131361977099308799; (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)(39410400002)(39840400002)(39450400003)(39860400002)(39380400002)(39850400002)(39400400002)(2980300002)(1110001)(1109001)(339900001)(3190300001)(199003)(189002)(9170700003)(76176999)(5660300001)(305945005)(48376002)(50466002)(50986999)(85426001)(54906002)(33646002)(38730400002)(104016004)(53936002)(36756003)(86362001)(105606002)(106466001)(575784001)(77096006)(189998001)(4326008)(47776003)(5003940100001)(2906002)(8656002)(2950100002)(50226002)(6666003)(356003)(81166006)(8676002)(8936002)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2PR03MB273; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD003; 1:BvcbKvce1AaWO7MEKBByNcC79qri/ujO0DVF/yoaLgY+h1OOkhRmEdjYcMFm+sAS8Slk3WjrgP33tMrGGoC7nyOaNvY/yyr/lTBrLE0D+z6USOEEwkRv7SLGR8CSt72XDy7JFls5oMfqW1BOPYRVBGS3+yhCQyICH/yPnWa0L5HRzzQTaEyc/UceSImC3+QL0Wo5g2GlznrjsiTzWWRDFj746RqC5C8qaViSs0D7+5R63khvNjAT8okWW24cEBc4FgS7dFCl5LHt/XH1KNOfFKMj3EXSfe6C9snucY1YaMQ+Us5yoU03schE8BJZGWV0UYnQugmM85D/lbkN3YMZvjAas6KmXKsH6IQ/CoqBegnLMSqWXERioKKFzkcaZ1nXbYWvPsQtJk/V9anAzzZ8d6+oDhzeV1tYl64NMKBBIpzb6F3StmgALqiaqiH197o3dRNAcNysmQ/6WOV3oQ5mRrg+l4esBw6nS3Gp6viyy3C7/bal/m+nPxLiTb1hwPgDFTELDlsFKPsQUpN7YB5M1d4Ry9M/KKelWWoMFwFNnVwxy2UWoxPqZiJ2TUtR3fvzc05fwqH6qamMB29QWFbQ5D4CE3GHImmizWnP/be5XKa7Cz5/M86JESvR+YbR6b9HLbGqBMlpb8CmlwiE30JiRq5wqdkhe+EeCluiyN0RIPK583+PL30Bf/W9Syyi08uQ MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 886cb75d-3e1d-443f-43f7-08d47f1cd063 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:BL2PR03MB273; X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB273; 3:PFzXFpFP1VPGM24xGfFzx+UQrlbzcg06h9uDYVdSvVi37M5iN4kNa7hOl45KOscEvQ8cYI2ZiRY5xnrUzZahzBnOaYjFL2N1or3R8zdyLfVPCApsJGhsMtmQWKTH8kFR94mGtfEPSpIddAnRSELWuIEqhUa6b9ilbu0qzA6sTuN7LA196SdYctkgGpYZyM711qb2fZhfBlpltvViLfdT4qb3kc45zHWptsNJurP+m+JaKZTKb2Q9cHhTP/JLw8scq9IUdF9AEzzVqXhNTcpezo2CeW3dbbnorYbzj6aZ87DTs+s0sVenUr+9bcqayt9YiL42tjZFcHAUe17U3SuwmPzGjgrp7EQDMoQEOiBDIG9ckUsgMAhIT8DUnUQlwyC+Js1a89Vfg4r2aeucODjk9lmVcG/z5lqugVmO1a6ecKUQzouaOTLI/L5Umjh8vwD/; 25:IjqtvSEm1x3i+CYkhq1c1EBLuv+lUcSB3IGz3cyKDJig05FLYc5l4CKqGdZjfgCm6rEj9zsiZ/8AQ2l8fp1DGn3Y/b8u8pzyLLK8gt0TEwgHLv59bCLtqZDREdDIQYvB6HDKjjXyKYWOqde9VhAUwC8FrMroUD9I74oIPz/5WBEgSKZbbegIwFqmGexRc2PuEt+HzIVg5rmID7rytiZp1GcmmFYx3KWIB4d/gMEk4diSPtxHGgNaU38jCYpaN2xvEQvtAr/NgbKpD5nQ67RrxmvlJMzXDCRW3eSMfdhLmYH3FsGooRTzvv5Dw03HwVfShrzy/0kLNCX1hu5o0tw1sfH3sfKMI4Xb3ZCkftXy9twNPd1Ak1gxv4fRiDuw54IZGg6roEzEcWC7XgHeYorwXTn7+E17/ANWKZ0dedWFiF+2hm3DD9Toipoerp5TLnzm44ooaIAZ2n7cqQNbWueDAw== X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB273; 31:kDgAXtiY4o/XQxE6OoVcHt8T61MyimU+7+2nn72SlDNttV7LJNQNeyfHTgh6k4En7x4TTQgCodfK1yKWG6YQmdk4SdHgRgj2iQSVpDIUdkydlalNT4xKIjeR9fQgJ5QXk2k0mAHTqp8et8/HuZvwjIfTQRKJq4OggkGqxIxuTUe8U2dmR/mFZFux9PS71gfUNwPndaaGgU8rqBYq33XEf3mc6O/9Sz6zX9ezw8MjqSlMrWPzefJ6dyq7EAsgJHaU+q+fDt4DeATpOP838pcQhw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(227817650892897)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(13018025)(13024025)(13023025)(13017025)(13015025)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(6055026)(6096035)(20161123563025)(201703131430075)(201703131448075)(201703131433075)(201703161259075)(20161123556025)(20161123565025)(20161123561025); SRVR:BL2PR03MB273; BCL:0; PCL:0; RULEID:(400006); SRVR:BL2PR03MB273; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL2PR03MB273; 4:qL1JQ8PPgBa4+DXy78yd5SCyAUFKZVZ4yw9m+vv6wy7?= =?us-ascii?Q?3elsi2mJ6IKELrEuAC3jD57GJT+f+D28Swzthd5OYS3pEuN2oseidAOVgdox?= =?us-ascii?Q?exmuB7tohz2u/6V2wS3bgOwYh55vs/tU2eLz2mY3AlwzkJtrSBtdNBCrlEkP?= =?us-ascii?Q?qu8CFCYXrPe5AamoClf5zqS+Yb4+8ihrqu2rsHQL5qFN/waZWmIOQTeiv5tU?= =?us-ascii?Q?kYsnrKYVFs+17kX/y9wCLiebttafQZb9ZL66GM5TcmwxvFyN2Suo09jQQNAN?= =?us-ascii?Q?BwKQmS1LIxU1Hv+iX4aznN8SF2lbEEmQQcIg55jkAvczZvIZSOcLLng3g4bw?= =?us-ascii?Q?wWXUOZqPaU1+BEeQ6CsOjOL8SjaoM8NojZDjkAQigyD+5fx5eU0YxchhBNm8?= =?us-ascii?Q?m3asUCorYdnrYeugXYVNG4CToMTJ7raWXr3+zspXyMKmpka695WMJZ7PQ+hI?= =?us-ascii?Q?QrTkjcCYP5BcUdAR47NquhRj7JsLOVVIHDBqHWmcQxklELyCVceoG04gTrfg?= =?us-ascii?Q?hQYwIP0dXdho1cEtadx5jB+U3inKg6d6WQZQ0WYq0c8jIueMfvw1ZtiHPECo?= =?us-ascii?Q?kfVU5O/7ROMVtw9sJ/86aYhWPZaUFkTlsjpQ3bh6C6k9+mkDuWRdivNydwZE?= =?us-ascii?Q?mc80uxpN1oota/Kzi9v4WX6U8luWUVY6QGpTyrbJM8xdhShGVtgXDtNcfXmU?= =?us-ascii?Q?1isGy9XYrAPsyhPSXa+oaM+f23JxdcX7XWnv/Grd5SgEQyrVuYXb5lWYy8QO?= =?us-ascii?Q?HkXv+0pI1J3rZF7dPp/qkIND0TZjFq38rhrhkC3GDzPumNeAy73V94IhqOig?= =?us-ascii?Q?DVqbat6W1woLIEiEclvb819JC6rNACTCBc9vpecJGSR9W1IgctdLgTtxqSET?= =?us-ascii?Q?Jjx0otjXsOFh9ZjuIakIWJ19WeydLCPioV5DvOwXW7gSSMKpCmJ/GR25YFVS?= =?us-ascii?Q?Xk6QANLSDCn8iWspokO0OVnuopPDe/yUNOaFKBA=3D=3D?= X-Forefront-PRVS: 02723F29C4 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL2PR03MB273; 23:qQc3qu9RqFPtBHR3mllTycS177bGtkR32z/mnIUF2h?= =?us-ascii?Q?APHSVSk1ZAenJTUByoS5DBgYC0urQlqh4G+IAMWyXuUA92CJY9rgEoI+DwBg?= =?us-ascii?Q?jxFD7rypzQnHd8ziOOmRv37KAIOvkAPfebAp4ujrGgeQD6L3x250sssenOSX?= =?us-ascii?Q?77SHyTK05EnptHlyvOvaaSCRnZvo3tQ8xIC7jw3uVdMOmEN8A9Aa3TKHeZo0?= =?us-ascii?Q?ameWQufyBPBNe43UVlKNcQPi9qQHPwiqYirkl3trdt1wpqgnsHtmeN7l5o8a?= =?us-ascii?Q?OjICm8R6hDSCGj7r+oMkP0WlGihf3rRLcezaMRl6y0lVpa9BJ/2AgVoFFrI5?= =?us-ascii?Q?QDk/Dz3gk8jP6YgOaxZ+IWaJCDrtQxqEbWKtZV5vm9m00kgwwgAiQae8YL/P?= =?us-ascii?Q?Jllg2oZYKijLOa6dpak8f3aZVmbm3FepJeDfXrcuteDptV4Ug/QADxaClhbb?= =?us-ascii?Q?q+104lNB9UuCTM4bJewfm0zQ1ijJEvRf4tI4hInXEd6/9zm5hWNhc1YtYlS7?= =?us-ascii?Q?GIV/StsV86eD3BiufZrxJ+OHGo6qQG8uuZmU2WIcINNUOraTyTBSbMZV7Dl2?= =?us-ascii?Q?zHtqXK+4igfmFSLMXMF1biaV8b3cj8wB03uM1jxJTJ2JYa0prHRxurr0+fps?= =?us-ascii?Q?FWIg1FsrNGlnJLLLekRg5SiP0Y9SVtpf+6r+c6b/uzRmE37o0VM6+DVbIBQX?= =?us-ascii?Q?rcUtiV0pnTulBpTvBocKq30Fb8orI6viSQoSUfVEc6s7KoXi4TI6Ifthphhz?= =?us-ascii?Q?FqKs+iK8h7sCDf1pS45QK39MfpEDtOCT6rpkraZUXhG11ScnFE1uoyCwHKMz?= =?us-ascii?Q?jzrKiJm/cA+J5HM6rmzjAjpdoJSfvh1q5/xolk6dVm4f2VzWfcz+zdHDkkki?= =?us-ascii?Q?hmtnxdwwmr2bMJ8xe7Hf83zt2jXldXs+D8B6njz86Oq4hWQ/HdZ0I/foEp0k?= =?us-ascii?Q?NafMgoQQcJTT7UiuxExaOV12WWtIkHIn9/OF4+MpVFxiIM8K1HXVJClokcnC?= =?us-ascii?Q?YWc1k57jV7WB/2PqKjxhNV8GTxiIfalRS7Diiu1OVguRwyb3b8d4huWiBM0L?= =?us-ascii?Q?zwHPjfM5j4v/HpWmU2DX6Hn2RA/gtyCYr3PbEWIHdq2jpSWBTRx4QIhmoGwJ?= =?us-ascii?Q?/ukbBT98Ltg1WE+p1lPIxW8P1iPrqPxUqq4RVQwQDy54tktna7zAbNTvPTkw?= =?us-ascii?Q?aQ3D2vh9ZhkAHAFh/2mJJ08M2oHm4XQ/nWIF9M8M7UYMm1Ki6eTx7jxA=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB273; 6:bwvtwSqZxfSfogo4J4nFbuvP/O5mxJN3W9xA4oa5iQt28DYejDHr4EMIV/RFxbjt7YlnLoABD9TOK+W9Pmrrr+dkqDH3qAEUMzjvyJ1qCgYj+WCiU04zdRtrvjSphMO5LGrtJRNsW88b1F+BTpON8VS3k6Kk8x/HTRrjRL7RXHc26JA09PsWyHzSU23tlA3AJf6OLq2KpLGmf5GSdss7Qpl3iuH/hlk9XoK5MQ3Bq/lVNF9+WohcMZY3qrSAJliNedRw5DwS/GW5O4MKTdvfFgfGNprrp+RAY7T/wfgdJWDFDax0umoKZHTki4nigUHvIioHc9HTprvXeFEqoyvH2qnWA6xfLTKKVqpevqPUwkqzFlcRXxAeTgsNs78n2DRTUCzgPVBagownkwGjYSkSj5QhSTtzZcMFVG2zg17XDBzqaE0h23wcvRHE+YyLFKZbiUIdm6m9C2eJx2NgekRyUg==; 5:l6FODBneaidlYFNJt1rj7sXq1Uaf7h/KCc4m8pz03TVY3jHFDcKM7hbVXnAz42HJvYsYr6hBNtDnsWoB00nwirs9ixrRyNpcpotmIQnn/XHcaH61Tu8gyoyZAAHi761IJU0QEpXyeVuHA8+SFGKEAWaxHD38i52Ogpexm5jiKbSuvfAnaSaWky1wIY+ABWuN; 24:/CedDOx9vK+fFzGNl3mD2zdRGAuoLNBjcG4i3IRi+P57RFR0vuU/wwR9+e07O8dCxZnz3t7mUfFUfQ9/YqAo2b8X4rM5DNEzToaCt+nIjtk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB273; 7:VXp7T2dzdFXt8c5cZ8/TDyI0yWS/VxXncWeRt3j5c6ioFfqXTg4PNB4kAqDQjvKS7hKeVqtvAHzEz0d7BsWTrW4tWHxOwpFloj1sg01n2Tx5C+kmuG71dgx/EMxjBgLXsl7W95fFj0O5Q3HJJFPkdJLpzpPnzT/qjnBhS7EW2N9kfm+qa0wG4rBji6T9VCvv+BuY7d8quiejJ3I9LnrNVlPsdlBfYWyTgfdZWfglpFMz5oCRxqh4LqDvI+xi1cG31VVXY2Sdpxpl2SqEu9qjjPgtzKJ4tYB5Tigb0KAKPirXmtkZuzwePsp9b7kz1SknMligohHKvJH1JcFl5XF3sA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2017 07:48:29.6188 (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: BL2PR03MB273 Subject: [dpdk-dev] [PATCH v3 05/21] bus/fslmc: add mc dpio 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:34 -0000 This patch adds the DPIO object support in MC driver. DPIO - Data Path Input Output represent the processing context to access the QBMAN HW for packet I/O. Signed-off-by: Alex Marginean Signed-off-by: Hemant Agrawal --- drivers/bus/fslmc/Makefile | 1 + drivers/bus/fslmc/mc/dpio.c | 279 +++++++++++++++++++++++++++ drivers/bus/fslmc/mc/fsl_dpio.h | 282 ++++++++++++++++++++++++++++ drivers/bus/fslmc/mc/fsl_dpio_cmd.h | 122 ++++++++++++ drivers/bus/fslmc/rte_bus_fslmc_version.map | 7 + 5 files changed, 691 insertions(+) create mode 100644 drivers/bus/fslmc/mc/dpio.c create mode 100644 drivers/bus/fslmc/mc/fsl_dpio.h create mode 100644 drivers/bus/fslmc/mc/fsl_dpio_cmd.h diff --git a/drivers/bus/fslmc/Makefile b/drivers/bus/fslmc/Makefile index 7000f2f..0c474da 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/dpio.c \ mc/mc_sys.c SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc_bus.c diff --git a/drivers/bus/fslmc/mc/dpio.c b/drivers/bus/fslmc/mc/dpio.c new file mode 100644 index 0000000..d84232a --- /dev/null +++ b/drivers/bus/fslmc/mc/dpio.c @@ -0,0 +1,279 @@ +/*- + * 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 dpio_open(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + int dpio_id, + uint16_t *token) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPIO_CMDID_OPEN, + cmd_flags, + 0); + DPIO_CMD_OPEN(cmd, dpio_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 0; +} + +int dpio_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(DPIO_CMDID_CLOSE, + cmd_flags, + token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpio_create(struct fsl_mc_io *mc_io, + uint16_t dprc_token, + uint32_t cmd_flags, + const struct dpio_cfg *cfg, + uint32_t *obj_id) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPIO_CMDID_CREATE, + cmd_flags, + dprc_token); + DPIO_CMD_CREATE(cmd, cfg); + + /* 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 dpio_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(DPIO_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 dpio_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(DPIO_CMDID_ENABLE, + cmd_flags, + token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpio_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(DPIO_CMDID_DISABLE, + cmd_flags, + token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpio_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(DPIO_CMDID_IS_ENABLED, cmd_flags, + token); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + DPIO_RSP_IS_ENABLED(cmd, *en); + + return 0; +} + +int dpio_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(DPIO_CMDID_RESET, + cmd_flags, + token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpio_get_attributes(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpio_attr *attr) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPIO_CMDID_GET_ATTR, + cmd_flags, + token); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + DPIO_RSP_GET_ATTRIBUTES(cmd, attr); + + return 0; +} + +int dpio_set_stashing_destination(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t sdest) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPIO_CMDID_SET_STASHING_DEST, + cmd_flags, + token); + DPIO_CMD_SET_STASHING_DEST(cmd, sdest); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +int dpio_get_stashing_destination(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t *sdest) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPIO_CMDID_GET_STASHING_DEST, + cmd_flags, + token); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + DPIO_RSP_GET_STASHING_DEST(cmd, *sdest); + + return 0; +} + +int dpio_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(DPIO_CMDID_GET_API_VERSION, + cmd_flags, + 0); + + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + DPIO_RSP_GET_API_VERSION(cmd, *major_ver, *minor_ver); + + return 0; +} diff --git a/drivers/bus/fslmc/mc/fsl_dpio.h b/drivers/bus/fslmc/mc/fsl_dpio.h new file mode 100644 index 0000000..6d86f07 --- /dev/null +++ b/drivers/bus/fslmc/mc/fsl_dpio.h @@ -0,0 +1,282 @@ +/*- + * 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_DPIO_H +#define __FSL_DPIO_H + +/* Data Path I/O Portal API + * Contains initialization APIs and runtime control APIs for DPIO + */ + +struct fsl_mc_io; + +/** + * dpio_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_' + * @dpio_id: DPIO 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 dpio_create() function. + * This function returns a unique authentication token, + * associated with the specific object ID and any MC portals + * assigned to the parent container; this token must be used in + * all subsequent commands for this specific object. + * + * Return: '0' on Success; Error code otherwise. + */ +int dpio_open(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + int dpio_id, + uint16_t *token); + +/** + * dpio_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 DPIO object + * + * Return: '0' on Success; Error code otherwise. + */ +int dpio_close(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +/** + * enum dpio_channel_mode - DPIO notification channel mode + * @DPIO_NO_CHANNEL: No support for notification channel + * @DPIO_LOCAL_CHANNEL: Notifications on data availability can be received by a + * dedicated channel in the DPIO; user should point the queue's + * destination in the relevant interface to this DPIO + */ +enum dpio_channel_mode { + DPIO_NO_CHANNEL = 0, + DPIO_LOCAL_CHANNEL = 1, +}; + +/** + * struct dpio_cfg - Structure representing DPIO configuration + * @channel_mode: Notification channel mode + * @num_priorities: Number of priorities for the notification channel (1-8); + * relevant only if 'channel_mode = DPIO_LOCAL_CHANNEL' + */ +struct dpio_cfg { + enum dpio_channel_mode channel_mode; + uint8_t num_priorities; +}; + +/** + * dpio_create() - Create the DPIO 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 DPIO 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 dpio_create(struct fsl_mc_io *mc_io, + uint16_t dprc_token, + uint32_t cmd_flags, + const struct dpio_cfg *cfg, + uint32_t *obj_id); + +/** + * dpio_destroy() - Destroy the DPIO object and release all its resources. + * @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_' + * @object_id: The object id; it must be a valid id within the container that + * created this object; + * + * The function accepts the authentication token of the parent container that + * created the object (not the one that currently owns the object). The object + * is searched within parent using the provided 'object_id'. + * All tokens to the object must be closed before calling destroy. + * + * Return: '0' on Success; Error code otherwise + */ +int dpio_destroy(struct fsl_mc_io *mc_io, + uint16_t dprc_token, + uint32_t cmd_flags, + uint32_t object_id); + +/** + * dpio_enable() - Enable the DPIO, allow I/O portal operations. + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPIO object + * + * Return: '0' on Success; Error code otherwise + */ +int dpio_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +/** + * dpio_disable() - Disable the DPIO, stop any I/O portal operation. + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPIO object + * + * Return: '0' on Success; Error code otherwise + */ +int dpio_disable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +/** + * dpio_is_enabled() - Check if the DPIO 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 DPIO object + * @en: Returns '1' if object is enabled; '0' otherwise + * + * Return: '0' on Success; Error code otherwise. + */ +int dpio_is_enabled(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + int *en); + +/** + * dpio_reset() - Reset the DPIO, 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 DPIO object + * + * Return: '0' on Success; Error code otherwise. + */ +int dpio_reset(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +/** + * dpio_set_stashing_destination() - Set the stashing destination. + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPIO object + * @sdest: stashing destination value + * + * Return: '0' on Success; Error code otherwise. + */ +int dpio_set_stashing_destination(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t sdest); + +/** + * dpio_get_stashing_destination() - Get the stashing destination.. + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPIO object + * @sdest: Returns the stashing destination value + * + * Return: '0' on Success; Error code otherwise. + */ +int dpio_get_stashing_destination(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t *sdest); + +/** + * struct dpio_attr - Structure representing DPIO attributes + * @id: DPIO object ID + * @qbman_portal_ce_offset: offset of the software portal cache-enabled area + * @qbman_portal_ci_offset: offset of the software portal cache-inhibited area + * @qbman_portal_id: Software portal ID + * @channel_mode: Notification channel mode + * @num_priorities: Number of priorities for the notification channel (1-8); + * relevant only if 'channel_mode = DPIO_LOCAL_CHANNEL' + * @qbman_version: QBMAN version + */ +struct dpio_attr { + int id; + uint64_t qbman_portal_ce_offset; + uint64_t qbman_portal_ci_offset; + uint16_t qbman_portal_id; + enum dpio_channel_mode channel_mode; + uint8_t num_priorities; + uint32_t qbman_version; + uint32_t clk; +}; + +/** + * dpio_get_attributes() - Retrieve DPIO 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 DPIO object + * @attr: Returned object's attributes + * + * Return: '0' on Success; Error code otherwise + */ +int dpio_get_attributes(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpio_attr *attr); + +/** + * dpio_get_api_version() - Get Data Path I/O 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 i/o API + * @minor_ver: Minor version of data path i/o API + * + * Return: '0' on Success; Error code otherwise. + */ +int dpio_get_api_version(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t *major_ver, + uint16_t *minor_ver); + +#endif /* __FSL_DPIO_H */ diff --git a/drivers/bus/fslmc/mc/fsl_dpio_cmd.h b/drivers/bus/fslmc/mc/fsl_dpio_cmd.h new file mode 100644 index 0000000..b1147de --- /dev/null +++ b/drivers/bus/fslmc/mc/fsl_dpio_cmd.h @@ -0,0 +1,122 @@ +/*- + * 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_DPIO_CMD_H +#define _FSL_DPIO_CMD_H + +/* DPIO Version */ +#define DPIO_VER_MAJOR 4 +#define DPIO_VER_MINOR 2 + +/* Command IDs */ +#define DPIO_CMDID_CLOSE 0x8001 +#define DPIO_CMDID_OPEN 0x8031 +#define DPIO_CMDID_CREATE 0x9031 +#define DPIO_CMDID_DESTROY 0x9831 +#define DPIO_CMDID_GET_API_VERSION 0xa031 + +#define DPIO_CMDID_ENABLE 0x0021 +#define DPIO_CMDID_DISABLE 0x0031 +#define DPIO_CMDID_GET_ATTR 0x0041 +#define DPIO_CMDID_RESET 0x0051 +#define DPIO_CMDID_IS_ENABLED 0x0061 + +#define DPIO_CMDID_SET_STASHING_DEST 0x1201 +#define DPIO_CMDID_GET_STASHING_DEST 0x1211 +#define DPIO_CMDID_ADD_STATIC_DEQUEUE_CHANNEL 0x1221 +#define DPIO_CMDID_REMOVE_STATIC_DEQUEUE_CHANNEL 0x1231 + +/* cmd, param, offset, width, type, arg_name */ +#define DPIO_CMD_OPEN(cmd, dpio_id) \ + MC_CMD_OP(cmd, 0, 0, 32, uint32_t, dpio_id) + +/* cmd, param, offset, width, type, arg_name */ +#define DPIO_CMD_CREATE(cmd, cfg) \ +do { \ + MC_CMD_OP(cmd, 0, 16, 2, enum dpio_channel_mode, \ + cfg->channel_mode);\ + MC_CMD_OP(cmd, 0, 32, 8, uint8_t, cfg->num_priorities);\ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPIO_RSP_IS_ENABLED(cmd, en) \ + MC_RSP_OP(cmd, 0, 0, 1, int, en) + +/* cmd, param, offset, width, type, arg_name */ +#define DPIO_RSP_GET_ATTRIBUTES(cmd, attr) \ +do { \ + MC_RSP_OP(cmd, 0, 0, 32, int, (attr)->id);\ + MC_RSP_OP(cmd, 0, 32, 16, uint16_t, (attr)->qbman_portal_id);\ + MC_RSP_OP(cmd, 0, 48, 8, uint8_t, (attr)->num_priorities);\ + MC_RSP_OP(cmd, 0, 56, 4, enum dpio_channel_mode,\ + (attr)->channel_mode);\ + MC_RSP_OP(cmd, 1, 0, 64, uint64_t, (attr)->qbman_portal_ce_offset);\ + MC_RSP_OP(cmd, 2, 0, 64, uint64_t, (attr)->qbman_portal_ci_offset);\ + MC_RSP_OP(cmd, 3, 0, 32, uint32_t, (attr)->qbman_version);\ + MC_RSP_OP(cmd, 4, 0, 32, uint32_t, (attr)->clk);\ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPIO_CMD_SET_STASHING_DEST(cmd, sdest) \ + MC_CMD_OP(cmd, 0, 0, 8, uint8_t, sdest) + +/* cmd, param, offset, width, type, arg_name */ +#define DPIO_RSP_GET_STASHING_DEST(cmd, sdest) \ + MC_RSP_OP(cmd, 0, 0, 8, uint8_t, sdest) + +/* cmd, param, offset, width, type, arg_name */ +#define DPIO_CMD_ADD_STATIC_DEQUEUE_CHANNEL(cmd, dpcon_id) \ + MC_CMD_OP(cmd, 0, 0, 32, int, dpcon_id) + +/* cmd, param, offset, width, type, arg_name */ +#define DPIO_RSP_ADD_STATIC_DEQUEUE_CHANNEL(cmd, channel_index) \ + MC_RSP_OP(cmd, 0, 0, 8, uint8_t, channel_index) + +/* cmd, param, offset, width, type, arg_name */ +#define DPIO_CMD_REMOVE_STATIC_DEQUEUE_CHANNEL(cmd, dpcon_id) \ + MC_CMD_OP(cmd, 0, 0, 32, int, dpcon_id) + +/* cmd, param, offset, width, type, arg_name */ +#define DPIO_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_DPIO_CMD_H */ diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map index 9b0fec5..bcd29a8 100644 --- a/drivers/bus/fslmc/rte_bus_fslmc_version.map +++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map @@ -1,6 +1,13 @@ DPDK_17.05 { global: + dpio_close; + dpio_disable; + dpio_enable; + dpio_get_attributes; + dpio_open; + dpio_reset; + dpio_set_stashing_destination; mc_send_command; qbman_check_command_complete; qbman_eq_desc_clear; -- 2.1.4