From patchwork Fri Mar 17 12:36:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 21843 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 7899CCF7A; Fri, 17 Mar 2017 13:40:32 +0100 (CET) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0055.outbound.protection.outlook.com [104.47.40.55]) by dpdk.org (Postfix) with ESMTP id 14D5CCF7A for ; Fri, 17 Mar 2017 13:37:16 +0100 (CET) Received: from BN6PR03CA0052.namprd03.prod.outlook.com (10.173.137.14) by BN1PR03MB187.namprd03.prod.outlook.com (10.255.200.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.961.17; Fri, 17 Mar 2017 12:37:14 +0000 Received: from BN1BFFO11FD044.protection.gbl (2a01:111:f400:7c10::1:135) by BN6PR03CA0052.outlook.office365.com (2603:10b6:404:4c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.977.11 via Frontend Transport; Fri, 17 Mar 2017 12:37:14 +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 BN1BFFO11FD044.mail.protection.outlook.com (10.58.144.107) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.977.7 via Frontend Transport; Fri, 17 Mar 2017 12:37:11 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v2HCalHs023358; Fri, 17 Mar 2017 05:37:07 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Fri, 17 Mar 2017 18:06:25 +0530 Message-ID: <1489754201-1027-7-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1489754201-1027-1-git-send-email-hemant.agrawal@nxp.com> References: <1489754201-1027-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131342278337225238; (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)(39400400002)(39850400002)(39380400002)(39410400002)(39450400003)(39860400002)(39840400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(9170700003)(54906002)(2950100002)(48376002)(575784001)(4326008)(6916009)(77096006)(356003)(8656002)(50986999)(2351001)(5660300001)(6666003)(33646002)(76176999)(104016004)(5003940100001)(110136004)(189998001)(38730400002)(106466001)(50226002)(47776003)(86362001)(8676002)(81156014)(105606002)(50466002)(8936002)(53936002)(305945005)(85426001)(36756003)(2906002)(81166006)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR03MB187; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD044; 1:SRrnY0YSVoEFE9Yp4xJ2Wd0dvzAhlQr0p9gnxNNkZdn6YEFFLR2h2e1jWdapf4NGpBtuS4xUHr0jcJkIOD0/FyPAi3GBdQn+/ppxMsdxJlXAjr1KidNvdEb+roPekIN4RNY+oKIM6L/y3k8kLP1RWp3TpM+NZUG3QhjKPVaeOal1AOletElcOhOf/a9c3qkT/09JfZxndWQ3kLYPDwqPZ3nhPGa1IUEqHaq+MdTV0fUXFimT29A8YbjTs2be+lVk9IaeDVbNKgOP6e8PQZaC+kqOGKipIqEAdstGkWsBPxH/IWDP51eE/RFfNmdGrq9duW6eqTi1pHQ/e/cL9S8KEfoiD+vYQ/U46cDCJVu1lNsNVCbYB8FYni6Mr93cFPYMOzt7VqXaWJPFDKGDM9y83g/iu4giKiVBmxsE7wTmDqbF3rQ8GItAZNmRn3qDRGBOIeqEopSaWmWJ0rm3pepMp6f5tDv30lJJjpPH6JHEO4gAXtI0Qfhf5MoIqvjA9+8OkF5OBjDdwOzhnekVAtz47qkUDotqCU4/7ohRHL0luYxlhfqxJHQc+WH/pvPKTiqaPSrbmIzqiZPA9B1gPL9myhrBNMXQdVtzDLaGUgs1QiwGva1iz5TEGcjdWmIdDU3K07aVG7mfYTuVxMVg9jiqMw== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 734b7132-5551-4fa7-80b5-08d46d3256bc X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN1PR03MB187; X-Microsoft-Exchange-Diagnostics: 1; BN1PR03MB187; 3:Tcrn4PkgicAz7B2UH85GMIJjusxyef/s0ja/bA2LQDGm9Q+fqjK7nRbYN8xLWviUn3p7cyU6aV8bYX/Q6JGjrKfO9y3VDYsdPOJfwJhKiI0P9DvAWGCjDSMIYcOCr1kMs3NPCgDIxwDzsGmxdV+e7ErAEA2MGoj/JU5q2X0NMd4xeZwmWTh64hT/djHTA3JsVUIwTjL6cdnzhCfDGXU1YNjWJN98dqGkyx92cnGfYel4PrHgso+l10H0z+bSTDr9GMRJwjjIIxjzZ37RmcH3odxM+LicNobcNxzlvAcAH9VMEIvMukBWJ8/dxhA8pGUWb66q5nbo4p9v+6b2R/pVb0M6KJCO9Esc9bINMFfzaAeOQ8fEbuGvzpmrXheNhwkh; 25:JmBIYowXetGZs1YhFElWlBFbnkHGygOfRS9bansQ5y+Meox7HXx4Mt7LmGFcLgAzqXvWj/SLPMr0WfsofUVBE9zlvblhzNEzNJPtZ2Ur2LApxZ0h6mrgpQXM+G0yNlaL6nDIz1UFdMA66hZAvXOMvVA8ppr4k9Z0/Cn3+hbBfN3c8YZDGY1SC8rP9lOT9hsLnNUmlgzVpBUFgKiEPnvmR2TRncAbCoq7DCxLe5N1E0kAp3o/Ns8tP3C9n8lQ0XR1o8j3BYAUKMxljD9Dx6CnjJTqxEyNG/BkfVI7UOkhqsofcBd3Bc9iJPtxk9HvGil9LR8j5zxAtMXWhEcIHrpz+r4bMRIRj3SxL8g9NeBO8/v9GjcbKYJq3iJ+C4feD+aWj2AyTFxswu8ziRYTamx009t/XAbrzWXq/zNTh8/AqzyjYmUW8E8iW4j8/a4zKKqxezvHioCIkf5+7swJXBP/YA== X-Microsoft-Exchange-Diagnostics: 1; BN1PR03MB187; 31:f1qH4iwxNhyzziX/SauuiySWzpJ/wkfTjXMumKLbQE31lOGMo+TyWWyKUcMuENQMYviJEe4uIS8u8RSzlnxEgnZPI2n+Fbl6tLY7UM3EP4HFAepzU6c9DEOtronH/W8S3bsPQJilpcfDqHP52EOMQ0cc7tE6tQxiHtkd3/hvDoDCbHbg0iEGFZu4jQY9+462ay4Do8PCNpQc8v3c9j8g0kqFzf6XkD1igcY2D8pI0aQr2ORk4BivugQQ2INKk3QUUSbD1DL4QJuw0Srg743KJ/cC47kg+vvjLQlIGaqaLAk= 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)(13018025)(13024025)(8121501046)(13017025)(5005006)(13023025)(3002001)(10201501046)(6055026)(6096035)(20161123563025)(20161123561025)(20161123565025)(20161123559025)(20161123556025); SRVR:BN1PR03MB187; BCL:0; PCL:0; RULEID:(400006); SRVR:BN1PR03MB187; X-Microsoft-Exchange-Diagnostics: 1; BN1PR03MB187; 4:ODwT06/6jMAkfqYCUtXzzXBGYqfCnqr5Tc3Cg/RY/9NN82jDkLz935vbc5OL/qanVqyHQdyxhJC2jfSaAtDGPP/fSw9OXHfcRDzQWozCCYDJzQU7awlIdMuMc0CK8MJDwvRG1L7FRD68pYgsdgeAQ0No0wAiE+Zoyrd+uq9aO5yofkCqUKoahdfki8wvPtvOR7+st1tbbhiWJaBa1Lii5hldYl8oCjGeEpRCbdzBoPFuDtQpsIOcJlsYCIv5ug9UNeiXgjDZFJ8BsL0qqT03Jre+z9br0tvLvbrK/5Bl5A//i/0btK62UbATjtl17+jgwHBAWpaLjEmiVCapngikxCAqI6pmNIJz5hhWxZm6zkQwDgiSokwqHdF8Zw5Ar6Vy+MfXiQPHdHNcWq2rT5mX85KmZ9lgNVgYHTNN/jSR8d02xJVmN+WQtztW85xz+SIlkKU5A8zpn39vXmV/GsColqZUe21DTcjCypWKHjPbWc4G55fMlianaz/JVzmbTochGcr5vqwu3Eit6lfZz1XOPEdC8M/SaE6c0/ALprfTDGsO5fVPMnPNQn7sGAKzf3fVM5CPbao2EJyZUsRhqTyovQB8iUGTALlhcr79sXxcwt7JJVblaYYJfVivfb7SHWyK9QTrhEKqL0LIu1KikjkqiuPKBov9OJ/E14yBisgfSEEknhpot+lBEpXmr6jmulIl9CKkOpiOMnVVuix/m+n1tPoFWUerItQMyvK+xGyfBvcefQ8swJgT+MDUE7KgWhr+gp8NElpAQfWsJyQxO+BFzIbMSLth69MYWSy8ttvz0ftxwK0NLtr+wGD5cBx6BaNm X-Forefront-PRVS: 0249EFCB0B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1PR03MB187; 23:uNCRvxZ/WPSz7ZZ54cgmFSJDydh2K7WCD6jB8REzCp?= kUs47hkQqkPXUWmY5A3/8fy+DxXrh13+7nffSfPosHajGLsG6YjLstIZmDDAx99aoE/uGbDhxAyM8etshPxafd+jhwsGbHP3/0SnTuOJC0lar8KZxFFe87g7F6alVk2U7muk8lop3B8MpCRU47IDa+KDismFyie7fkBBswpZIYwUwgQXGBG8qia5Lv3zviunpPFNM/2bgTCv4lFj7K2KNCp8lhQQZ2KFrJRqyL3uhuKs5Vh9ClgJuKhRyH6o7kSZdgL01xfHB3l10AvyKY/BRVn9TvnbA6dlKNnefjVWL+iHyIzNILdfHwcF67vNH6byVG07VpMYROiDQq6eCBIAZDmumW4gTHcwIKD4Yh1++puJhQEKMecIneOFj7d8houTQhCYGgs8vAQLHftpyVe55F6Q/wyHgWIQAiXH+k1LABRGg4AmwVtY9cILRMxpj9D2Z8h1Mwx6TjwRHXK4A/rMAiEUR43dfSlkjPE3/77UTlTPNmWnEbaMfXt40d5X0GHq31eBayY3ZxgpBXUKUD1pHfPG261OF42fkXCQyZXpItrR/hyQUxO29oVCOaEULj4C0yO2D5FSjsBozKLM9Rql817WLVtRjYgfXKycWe+m/9Gt/dC9Piyc+ablnFJYDtJ1ThDGuuhWeu8V/7vuLem86Nd0pIzp3IBS6CRm39EibvERcDIZKWnOACBL/b3PfbwwDM5dQGP+csXH28PyOsfs2tp1XOE46fBYokny8NiPI5BYniSGtSadYRlxaoj4GLloq3DNjwV4zd7Cu4y+B8IPkm4z0oxOwc69b/5nJbGH/vUJqtPI6O3y0guSr8lFX06VzLS5+nhI9NGIF1S3nneDeSmRpjx3LC8kgBoSvfX+0na1KiduOdl/We8QbENllu7ie66sQb7kOt4uyShjrbimxvYNbGSBGP7z7n1nHPmXniFezJh5p+N5qtvYfmrsfo3Lc8dcX69HDdLLsrplvTlsZQlyT/cyBBiIhFUAgK5fTcYznmi0vmOhwM49iaWQtmNO4ftFnpJp9bHfGWrIlb4xpp2+Qj5ETeQfVATCBPoNjR/OIQMjzmNDnJdjJ+klmpNp6pvcM3JkyElhkJlTl7B7o5tsdT6xL/iFyCidxjcAdDEAEr1R62YZH4M8XKXDhA0BKUQ4lE6IrCtvaxXYQybA1OoMVW5arpseDp37Qj5oV/etELOfFXzwVoAbMcubG6++xmZA1qZr6BqAHB9/oIpG0L X-Microsoft-Exchange-Diagnostics: 1; BN1PR03MB187; 6:oi9Z3TJNM6suq+qBkplG3Z1/kY8Os3qL8rp+o3pgN7hd0rglEO4epMHKFABQWhLSCfseT42zl6oT9B+hDerwK8a+06s6d2gprAeDtrccJsdbIixJoB6hxZLVOqQLRgCpodPR85tEpjJ9JDwhXP38/U7IN72Pga7irvmsAHyHU7t+p2RN+0IH7F44yr6d4aOwxHA+wOBqT6F0opFt3pIAgs9vA5hxBt6JJaz97oFDlVTyPGF4dQOgURmxu1+jD7X1grPfu1zj0m9NvoRbuLABKDxXvTveiiWfEphWW+KP0eegZBQHD8SnIguM3/lfQ3Lq7QdZLW6FrND61hJ1LhdU3LXxlNWJk2WgHtIgBbAOxRQdSGM9qWZQH0sj91KgRu9HDVN+aasmxU0baCNUQOPyRCeD4BxcAuOknRkCLA/DMM8=; 5:mXb1Cf8/wUD6PDaQxXAFRlZJG070Z2iYuI7qJQUbUtwllgfBuijDOJJlgoDM7OtBo7lCxyeyhxWrKkJh3tsuXjE5uS0MxWpJy3mL8waShZqhxsZ6ac23fY0ykkt5r4SmysAuPs1Vm3be9zMd0fALgrgqEtL2QYcDbX7NR0VEI0MkpthtmNmNE29IffHzqjKY; 24:3rsn9cKJNrylg2mmxjPYaKxVMEYowrhhB5h4l4E+EEUuJ5FdruBEOgWkQYuAfwOEkaeIaTg3IvsXA27PltcVIM5KuR4An10t3x8GIZm1OIY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN1PR03MB187; 7:V8ah/tPBUz9EtHAeeRppdPRD0kWrCC9uumjTh0fYrYFz/t0UCIt6lFITR66JlfbrJCGcB0VnaAQIgaos9f1qk89PcXnD80BW//eR4bDASqabrNMf2QaA8YVvRF7rezB1RRfvFyAD2yVE5jt47nyLEz3PTMcay+Cf3hL347tF880p/YIoEv/D9upehIvXtfKuekEWJfNTSj7zjRJAEg9D7zM0N1I1QdUOK1b6HNndSfrUotzvCffIR5xGakhwhII89DyKx7llFhSDopUZtok/7UV0822kNNCtu1fudu/PS40b8+w3R24ucIysRgRzSRIIzqvj+LnUcILbRE0xFNRyXQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2017 12:37:11.0549 (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: BN1PR03MB187 Subject: [dpdk-dev] [PATCH v1 06/22] 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 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..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;