From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0044.outbound.protection.outlook.com [104.47.36.44]) by dpdk.org (Postfix) with ESMTP id 7ED442B93 for ; Fri, 3 Mar 2017 08:13:31 +0100 (CET) Received: from BN3PR0301CA0021.namprd03.prod.outlook.com (10.160.180.159) by BN1PR0301MB0722.namprd03.prod.outlook.com (10.160.78.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Fri, 3 Mar 2017 07:13:29 +0000 Received: from BN1BFFO11OLC004.protection.gbl (2a01:111:f400:7c10::1:146) by BN3PR0301CA0021.outlook.office365.com (2a01:111:e400:4000::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12 via Frontend Transport; Fri, 3 Mar 2017 07:13:29 +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; 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 BN1BFFO11OLC004.mail.protection.outlook.com (10.58.145.15) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.933.11 via Frontend Transport; Fri, 3 Mar 2017 07:13:29 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v237D509005035; Fri, 3 Mar 2017 00:13:26 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Fri, 3 Mar 2017 18:16:23 +0530 Message-ID: <1488545223-25739-7-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1488545223-25739-1-git-send-email-hemant.agrawal@nxp.com> References: <1487205586-6785-1-git-send-email-hemant.agrawal@nxp.com> <1488545223-25739-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131329988093588407; (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)(7916002)(39850400002)(39400400002)(39840400002)(39860400002)(39380400002)(39410400002)(39450400003)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(9170700003)(8656002)(575784001)(86362001)(8936002)(305945005)(5003940100001)(356003)(2906002)(81166006)(5660300001)(8676002)(77096006)(189998001)(76176999)(50986999)(104016004)(626004)(50226002)(105606002)(106466001)(2351001)(36756003)(92566002)(85426001)(48376002)(6666003)(2950100002)(54906002)(53936002)(33646002)(50466002)(47776003)(38730400002)(6916009)(4326008)(110136004)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0301MB0722; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11OLC004; 1:RNLpkIXNEReoucfixlrLCjK0pKgiR0Volu8n3/+Yf9ps02nPCrE38VTwKPY7ru0w+vJ2eFQX4QB7DOwCKqkuIrOkqXua4MP4TvDoin4GmA20Yu3w7x+qWumAALcOhZt19/PmEUQFMnNi6fn5Vvbt3dM2Dbzpxq+M945psRqwkWOfjHfQWpF1w6OS2enjxxPFBIrR6LxFIgxMiHFhfFN5pNBAVgMVctWhTyQB54Pit2gJsX8WtjSqEHEvkQCvxeMnnW19edbl8mBMoXtvFHtPNQjqOpyXcQxqefpoNHxq/UOTbMVE0bpVKH4Kzkx3W6J6KbBETg7DkV+aAgrEdCcIbOFgWCh2F94GBZ9QbkO11DyzIFL66dZ6mSDWX6FauhGev7NljZjPmMkgM71E92ENrHZ9oA2ATU8e76R9+tJVjw/84eapCTrECEU2+/MMOfuA0N66WPPAuHpFlDC3+ehM7JbZgHfenosCWEN2D+wf+gjpTbFgibyqcE5rPdoq5E1OaqhKXAgWjYMc2XHb9WDEP6AYyLEk1fO6SrU5vGYDteq+plrcb2YjN3ssDdpcex6mbzMh+lGSuY9brX1BvsQpsjK3SmaDEBVKaaXRjllgTJrjzBTIBZfw2UJQAP2M3rpBpSZE0D9LPE2irq/GDhmHXA== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 7115612e-812e-4dc7-b3b7-08d46204cb23 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN1PR0301MB0722; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0722; 3:hc7S/JteH6HSox+Y59sTLyq4cCvWcokoXzJlFWJwOUSb8c4deppKBJnZvFx0PKYpm+S8X79uC58QVjGLUQclfqikEDjlk1K7aFaNzI39X0QjJ4E0GeHU3H8854HNiOLSL3RzsqM2meLj+oBqC0rfv7gMBbkJUqeaZg+Zm4e95U7lXLjUmyYfYjbmnoVSGKAihurxEZyjJCxf+A4o7skemyPtVamiUxMTkDYuj0KlzF2imxJ/5lLX00nxbqmS5OnzrhUUqYOKaL75ij3y3z2wzpf3PlfWnRgq4nO2LyCseHCt8MLKEUoBRpZdZ+VFmLBRw6BOeQlvfsMQdk2jI0X4pLUuSiPMC0XCkcgack7FQjLrfxkXWvwy8qHP1/AgXjSs; 25:Vfmq73U3c7dQ8ocoBnj7/rI94ZsydWOSJ86SdOXQOtM7Ey9xrYk60ynS5G/znDatGxUkzl6VHe7jdgwQLf+8XnudyOP1Z5rfBvg5JCPHW2hvS3hOrRbEMRXn/j8Ie33p6eXYLSS+3EK6XT9yPyCft3lJFD9kXSu8i//1n3YxjPDElsV4j6+zdimEP/4JtcerThmfMFHLNC5ccEVK4somH81+cNjzM/IfGn+8656hOdZYMqPqOj6ClYjAUm2ntYnfpVdVDToqebwNpC8FdsNF97/xbdbEZRT/vB6uWnkZuDE/+ROVv2fbIrov6ehDuFrXehzEffOH7eZ8jU4ylIktpnBXRTS/WshtEGwIPFtwue1Nkp5EZq4lu7m15AHKDN8vrQYL8mdUymzDLaxkvL4seXv2a13DsMEVa6tqSRbsTOlONExnLHhPNfcosfBsvbo4mmOmtG1LD/BYwr15FTBqQA== X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0722; 31:tY/Htx7LpUMOdy8GaJn6qKbDsE5cXiRYtPrrWeFrvHiV59GcysSgNh3nmnwLJPpumIOpmuTUS/UhJJzjgIpjWTXHEJKT6sbhqLr8vBo8VhY2DiEveF+KTQ5B8ZjMsdSVJgW4h422ifWKjDiF6aQXnZrRuwiRIvRCiWOm8FiB1FAoR9nFj+EdORVixPuNO1SwIByIDlHYXcMgK+2QuOp+XF/X8OZOAVwqAgop7/hsbPhp2tmMGHJj4gSYKjjs+iV9UJqg33J9USuwTw47C9a5b0iUFANK1Jwm06VXmprAFT8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(227817650892897)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13015025)(13017025)(13023025)(13024025)(8121501046)(5005006)(13018025)(3002001)(10201501046)(6055026)(6096035)(20161123563025)(20161123561025)(20161123559025)(20161123565025)(20161123556025); SRVR:BN1PR0301MB0722; BCL:0; PCL:0; RULEID:(400006); SRVR:BN1PR0301MB0722; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0722; 4:2XFQQ7DJuSj7gX2ZjgIpBvMHUnbPwib/IR8T9HMuixbpzVxQ0XO86drqG84KAR+xhnHS1ormXyF1us7aj/jVxJxw76XDofrcU4pztsNyk2DO19ngoYxwjfVG3w2MuqZLYLV+1nCZKM2cce9RfsPjIRP7NUeKNrscF0n4XyV/gRbw7l8VDXJllQj4RurPR5AaXlbqgtXOMIpc1f161KnNCahAdnYEitAjPL6JblKRMvC51tEMkNnim+ljpIycTGB+vAba2aSiY844Ijla12uOiPmbBynao1kUyQIv1Q6dRRqLqTevCg+wLmwe9sgfgng6OQv+KhbAQDc0wT7Wn62y0hMHScIJrGMUypDGfTUHQsl6p6tuwdxNzJMRERIpwWWb4AZiYtFf95i3O5ePV3tN6zNaQHHuTrOjH7Mb6R6PFn34cxiSeTFZzWXoyHjzCTjB0zj1GruJ4iVdPyJHCt85pQXReE2QhjlYI87kr/pA9PL6CXcv9EbNf6NqEve6zWkJagDgDHlgNLZ+2oXAGMReg5cfNguYGG5lKN330v6tACrfy2KNHXbUN8UQIPuks63my7W8bj27GYVABR2c7YzsPwsSq0tYZxxYjA7acRDVIpk2KfMYVhOxUvNhtEm58/K9LNxNQn3JHWSmEZj6t6bcJwXm+o32ZH+NgzLdWtP432P/tU7gDls7/fUAJJIcN5rCNYE2cshrdgBnhUUDTZrs1j3J5MpqkLZf2vvjtt9htZUjHF63NZJ2D3hVz4XbpKnxZiialfT81FC/hwVnPXN1mv4pxKXnRz3nlUh3PDE27KvJbSbCbIreZmL69RiFrAYu X-Forefront-PRVS: 0235CBE7D0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1PR0301MB0722; 23:74d5teR880MUpeg9W7L1d4nOfq1HHdpDE7ikuJ0?= =?us-ascii?Q?KbCJ5u4i8LotG0IMoSYeZCRkvhD+7yShalNkbESPKDGFL7Biue5ATdZc3NQh?= =?us-ascii?Q?p8N8m+rAUa6TbAiUqughgbH+CK9HBpIbWrLUgU39rbmi9czyBG1k34uK7aJ5?= =?us-ascii?Q?Og/tZ7q61ZWffm2P69Nl1WrELJrCGmw6txO5dhQUZ/1hOfkkL7D9r1nqV2zC?= =?us-ascii?Q?c5uTvFtcTNC22/Tk0H4N28ysbIZ9rITMWGMLABazhsYlgKVzLJE1L10pvNa+?= =?us-ascii?Q?4lSoC4jy3x9ADE8onP8sKqRTFXIeLU0PPlLhebXYllFG5egOZEmDlfyabgIk?= =?us-ascii?Q?d6YJkMGhH7fQrXtr2zjdx0zrz5ewr4mf9O4QqPLSKlJ9UpkBTHbdLi4FzCVb?= =?us-ascii?Q?dPLHZD6tiJY2OZ3fWm5bm9IkcEm7MEeqKl+YlZASFdChkBVf/fGaTogRoaFN?= =?us-ascii?Q?+PoilZtMVkiNaV/qW4wXfJ6rrQsWJ9W+RHYbIJ8W17yTR+3tRgarnFbEnf+k?= =?us-ascii?Q?KyxZEt6S6448DPPxIf8z9b7loi1XIhnIE8TDbk2avKUPyp40/c76iAJys+sF?= =?us-ascii?Q?+a+fVbMhvRkBtxTJnEkLS1/M+W27n1fzlFNflNU/xMAqWaDW2IcjYA6ud7CV?= =?us-ascii?Q?xebsB89pE9qQzc7ekQO12naf1mk03bqLfI+V2O6CcSdhpms1U6a+ItT/8b7f?= =?us-ascii?Q?cMIZeh+x4LHCXpuYOxLKqjPhra0/BRgr5rG18GvKrwZsXcgvY3ws/q5WvBHN?= =?us-ascii?Q?uRB0DKiOcwGmJKPZh2FFZl6tvjuGFV0FNZhHf8eHRUQRpmOP3fTZYqAulOEQ?= =?us-ascii?Q?U63CGGC/Lid9JFaHsw6CLlt07tCHx5uVDFVZWlzzgvLhwPfEeBj1oPpaZrG+?= =?us-ascii?Q?H3KqVZ4YW1/v76+mzlr1hCH6twBaJhLLVMHlFIRqJanhwOwoZhtTFKql2z4D?= =?us-ascii?Q?a0aOJSBaHjbHP2aG1pXaSZ8fg/XQyNXip3i+zJvebL/e90Z9BXRPoBXtThEO?= =?us-ascii?Q?mFnhR8sE8ckr7gww8q8t36HO/qJv+vKA/eyu4rt/xejB+uKbW7+srxf6UbBz?= =?us-ascii?Q?bcZVlL7HiEdZ4n61CmO5aI512BTvWUqbo60Iz41R1Qtc93IhglUgTmA1mpOe?= =?us-ascii?Q?CK9RhkmW4nQ07dlZ5fKdPXBjl3CZ5VIQx+EFRgwDO8yjU749m9mkaJV/Sps0?= =?us-ascii?Q?XIFVKLbacbE3Iro5dycbHI/MYLyEqBd/MtMtxhcT1s8e2p7zN7pqi1+iHKxr?= =?us-ascii?Q?Jwj0ZfMsXYUafgKc4IcfF+uQD6B+88IMpS9Ip+yDmiJbMCVG+1D66GXJ/jrl?= =?us-ascii?Q?k0RQvRpRrs2x6aQqYjE2DLlM=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0722; 6:nU2kYGMGBeMauPSa9RJLF1ZCBcNE7pRAFCfUWaajaSa3p+emRafvaNpN1n7LHNRnypQMRzFhiIddSScTUBAp/aqs0mdbTTn6eDO1mng5IttmncNE1vMLwWl0p89CMEtOV3bwSv4RpwGVoGUWuOF2/59klbPXkLablc98SPyRZsP3VzU17iPKdYIOKUxptO428j/WQyoqD+3tiLPEhjHEf4pxl1B8cKB+AOvaS2FyyWreB5rQJfBX4dH4CC61IdAE/Ei5gYn2gjxeL+gkNlQmSm3bHgJTYQ2QZGjt6WXAV+rDWipmSJGc6XsKnVQ0BX6cEsF3tLnRQW2A6Tfdv05zSwOBDq7MgnfDu4t81rfkYDXHauvfxbyvK1M7lxGfWnIjEe3LyOturvXlJE9n5Nd9kfMlPuDI9nL+3njG7X3xEto=; 5:zh4J2kT4yHFrC6agzMjH2jdB+epXziGSyueNxXraU5SphQCJKk1h+AluVVCdDR2Bj9ViaCei7z+H22ICKoCNWPyVCCjOQ5dXcmLsHJkNM9p/bNoyGSxm1zfAYrmfT3OGzrTUfM9iYBWymI3bPLKNYFow/1E8bEPBIhP46iLc9V4fJ1LW9PEYa65tp+Z5WPtU; 24:0fUzUv1hyZrlPKivZWpWoDAnIW5s8aDGvy7i3o1GvB2SYpKFnJKcO2VuO+ZXtJH3OasFUBjEXo0iqdt1tadcH5MXBilqaOVxE3WFbF8f9Z0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0722; 7:4ubh7PSIesvj0m2vu9EwaSUbLu+QdmHY18/iy6dy1eXQMZQPQOV4lH5NmcOfrwzSkp2F/cX+50axBpyCvZRt7cYu1hK17O+ogY8bgy0md9kIVG07N33xbDW1fVcN9Rh8h8n8qpNriXU7MOFUjgKxVl9wZxfMzt/wnuFJH4j5nC3VM+iC6fTffnVvu45UDsvz+YQ8rNApA77CdWZ2dqmqW4cNLpL6H8EpUxFHwAnC/Anrke6cjaF+kHAa9HKz3aNnwH+KtuMLBO3rjLuas3VVWNChWNewCw71mAfq2QiLpYq8Gh3sLffOw/yrjurpzTPpuZAYFzKTpKlRPCB7GghP/Q== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2017 07:13:29.1716 (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: BN1PR0301MB0722 Subject: [dpdk-dev] [PATCHv8 06/46] 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: Fri, 03 Mar 2017 07:13:32 -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 | 121 ++++++++++++ drivers/bus/fslmc/rte_bus_fslmc_version.map | 7 + 5 files changed, 690 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 0b09fe6..ce9ed90 100644 --- a/drivers/bus/fslmc/Makefile +++ b/drivers/bus/fslmc/Makefile @@ -64,6 +64,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..7f7359d --- /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_ATTR(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..c4b613e --- /dev/null +++ b/drivers/bus/fslmc/mc/fsl_dpio_cmd.h @@ -0,0 +1,121 @@ +/*- + * 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 ((0x800 << 4) | (0x1)) +#define DPIO_CMDID_OPEN ((0x803 << 4) | (0x1)) +#define DPIO_CMDID_CREATE ((0x903 << 4) | (0x1)) +#define DPIO_CMDID_DESTROY ((0x983 << 4) | (0x1)) +#define DPIO_CMDID_GET_API_VERSION ((0xa03 << 4) | (0x1)) + +#define DPIO_CMDID_ENABLE ((0x002 << 4) | (0x1)) +#define DPIO_CMDID_DISABLE ((0x003 << 4) | (0x1)) +#define DPIO_CMDID_GET_ATTR ((0x004 << 4) | (0x1)) +#define DPIO_CMDID_RESET ((0x005 << 4) | (0x1)) +#define DPIO_CMDID_IS_ENABLED ((0x006 << 4) | (0x1)) + +#define DPIO_CMDID_SET_STASHING_DEST ((0x120 << 4) | (0x1)) +#define DPIO_CMDID_GET_STASHING_DEST ((0x121 << 4) | (0x1)) +#define DPIO_CMDID_ADD_STATIC_DEQUEUE_CHANNEL ((0x122 << 4) | (0x1)) +#define DPIO_CMDID_REMOVE_STATIC_DEQUEUE_CHANNEL ((0x123 << 4) | (0x1)) + +/* 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_ATTR(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; -- 1.9.1