From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0062.outbound.protection.outlook.com [104.47.38.62]) by dpdk.org (Postfix) with ESMTP id 7AF4B69C6 for ; Fri, 24 Mar 2017 13:42:04 +0100 (CET) Received: from DM5PR03CA0055.namprd03.prod.outlook.com (10.174.189.172) by BY2PR03MB555.namprd03.prod.outlook.com (10.141.141.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.977.11; Fri, 24 Mar 2017 12:42:00 +0000 Received: from BN1AFFO11FD041.protection.gbl (2a01:111:f400:7c10::155) by DM5PR03CA0055.outlook.office365.com (2603:10b6:4:3b::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.991.14 via Frontend Transport; Fri, 24 Mar 2017 12:42:00 +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 BN1AFFO11FD041.mail.protection.outlook.com (10.58.52.252) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.977.7 via Frontend Transport; Fri, 24 Mar 2017 12:41:59 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v2OCfacD031007; Fri, 24 Mar 2017 05:41:56 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Fri, 24 Mar 2017 18:11:16 +0530 Message-ID: <1490359292-18773-7-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1490359292-18773-1-git-send-email-hemant.agrawal@nxp.com> References: <1489754201-1027-1-git-send-email-hemant.agrawal@nxp.com> <1490359292-18773-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131348329199381966; (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)(39450400003)(39840400002)(39860400002)(39380400002)(39850400002)(39410400002)(39400400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(9170700003)(6666003)(8936002)(189998001)(110136004)(38730400002)(4326008)(104016004)(8676002)(50986999)(81166006)(76176999)(2351001)(47776003)(2906002)(106466001)(50226002)(50466002)(105606002)(48376002)(53936002)(33646002)(36756003)(8656002)(5003940100001)(77096006)(5660300001)(54906002)(85426001)(6916009)(2950100002)(356003)(305945005)(575784001)(86362001)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR03MB555; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD041; 1:hHcnXDB4bIuI2e5N0+p6SHn4e96zHURUDnoACVUCt9T25mg/LorP7g3FYOx+TS1xSrVYgbPCgq3vsVmlNLSVxbf458LKlou0HzXjwCdXpHLEKMtQ4V08fPj7OXxDpksDA+pF7BpZatwmVIHOBmFcyRFc40Rmx48JsyFknQFxuMbsJ5H7V8xNvei1JteB8pXuyt4olPNlrceLxfeovn3OZDkHaCa4yzVxE/dST+Bqb4k+kjVBSwT7T3jsuh59wjs4ROQxrH3e0PIT9qq8yNwGOInncvjO11pVnQoWYrAqnYD6ixkwnK7XEe6/jSy8zMKUYVN+yKxtXfk1AUrLpFe9OeExqfD3W6R+8sglxtL0D7JyETClZ2FrRhf4qtWJSH9ElM+Q8LLroVYANsQTogLzfoDDfS9M7V/t46kE/0I+ZaTh9Xf2r67mLOw39TRmQlu1RU4A7/8IV30DrFzQXZ1C/pxdtHluJJ463KGPasnzmQz3LU/O4Y05DtWYBM+0kfS3Awrvsj7sVMUe+xrvZCh8NCGHwyhpicD91fXCmrycAhEvu8hhbfy/fghxMUOXTGRIbqK4fFd6YTzRjDpqIrLpTuzgAuBsOOMLmMwEy3LOiJawF0brukET1a7kw9h/5H+WElFVc5JHhWLmwtA1eqhyZg== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: b00d278c-cec4-4220-cc6e-08d472b32a39 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BY2PR03MB555; X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB555; 3:mArvyhg4YKZRDqYHElZ8AlPQOhi6sTNHjxvnEIBfUYqJEEmIDTe04VnZ6jaANGxK3hCdU8jcEwLbFg7oUdxulDKlmLOmVrTD9Vp3aaEGahIDs+B4NxnD0eDsZ5wc8bROb/9XKebLRxX0cvL2/U9zh9T8NYRB7FkQjQTk8E1RLjHg/hc98/ArE28uomuHpOM3gh8JO2A8+P2WZ0gayT1BmQy2ey/jSP8BxbV4nw8hBZGyvthMY2Q0a4/5pxdhrOi0ZEAe2wt7fv3gm6+foAHsDHfbm5BuDJ8MMvL3O0ZAlVM61kVepwSbjWuhS0pGPrxwmSL35//U8jKVp4G1shdUwskKmrcVRoHhTwKA5auGKIcesyK/HHYV/7rwY3hBwKiV; 25:fAdZshf9gieaoko3DvVFVZsUX5C5bKilHRkpbtYsHP7kdEAzFACRWGLL9dSg+ZErTYwRXuGX/4YjrlCUKSkLVUTtQgTbAxC+a9qkZH3kdfREn8za7IrS7p1ZRC+VY8/ixUAcKPpWGn2Bf640OkLIeP7Dp7JEoA4kb210Y4sb1TymUYY2FUuYlb0+zW1jAVfYU/v23XJD2ClY/B7XwsTziUd8ZSvri40gu2A1OrFQ+3wI9T8vijBKmuGrULrvN41MwUpWJCfwpUFxw8/L4ID94YpGkNV+xEi1sCbghTlf2YXvNPfoS5T0EZremmLuhxKjiPiM3jSXHYXlI3lkSHYOqte/65ouDWiO9OaeR1flMUFvxQ73L9XggYr/KqqS/j5QbCfEn+6xZsMWNtzxBhKwKfKTPm+YI1I0NHn+keYX1oPz3OC3IV9FnRN816B7K0HjhU6DjjRsjMYdkhOQXrWihQ== X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB555; 31:AxQitffv5s8TrwADyZTitgBMPwKdWF4lmX6z+4iQUhZxGl31ZhrU4zo5aNyDzzoGC09d/CEaEhVyScvMeZcugNZTnWND1oyQFB7DeBYrvE4Pzas7AGM9VNkXwGv87q0S1V0nuYptKfa63QcjDAjElg20uWkRMRaqiDubR4te2tklaZWl1l5lex7tOvpMB5B00hVffkG9GGHcPpPm4IiVC1qGMi0Iqg2e9pci1P+7l1UnFN1K082VLqPyHszJQFZDCp+JKQRi4a27QUtNy+0V4w== 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)(13024025)(13015025)(13018025)(13017025)(13023025)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6096035)(20161123563025)(20161123561025)(20161123559025)(20161123556025)(20161123565025); SRVR:BY2PR03MB555; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR03MB555; X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB555; 4:zL+fEIOpLKi4+pE2sNExFwH1eGOK2BHHkoC2Qds8ASML6dbWG1B5paDqDBpz7/2juBAZYU6wfDcBeTzDfzNWQZk3tovcdxSPEV8MHqoXUEEkyJj9ZQnAHezwJZ2pc9jLwTOhGybtiposCLtis/eP2/FvReRU5XSsq7zaR9XXK7ZUJzfOwzixwJN3fdbUUmcuWKY+NjK/0qP3u10GwgX6kpLDeD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simCXbJBUkaJKHE351YqX7BJvOYVoelADOdPLj3GCq9/vsq4qEu?= =?us-ascii?Q?HG5g6o6MyDJ0eklTM=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB555; 6:sjdfX6dHLWZK5vFmAijoWQnqXgMpRRL/29UUDYtk4pAY8F3SuLb3Ms3tCmc/73liWurj3PR6DuGj4csvFH3m/O6c5wQWtMrz37X9DTnoC1rj3L5gkw2iD9dE//kL6egCDp+Q2zNvPfFx5DmKphhWLV1CUT693cacdWywjDKZcgTGU+XMaEqcHO/JiArXbHZJLz9OpiZcKtzh/RxxoZfJRW8b330G1h0NfKM+TZ+ftmgogmGoU1DneCdkleHBA+RcdhWqMgSObhR2rfQoVxwiLjj0ZmaQ6hePV72dlZZmyLGlBbWE+iDAckMsaChhHrRW85KENwTFPpzv9Wg+EOJ0sXljsUafLqIjCKAgcEmWftEl9hcMUlYNH/gWibOWqt35A2F471FSSP3EezEwZlWH0PbupS/7tM73X3loIm8mFkQ=; 5:CwS5fo44Af0EosDCrJLo55IqdBXw2lzM+uqDSaQnjVHAUjqGqnjLmtAOyl7MJkGIGY9GDdvgzyPmnOxJRk+v74QnNm/iMDCAqYicGHOuSkD+oK0FCAaNECHlSf7/SHcGSHX2KCROqvA/mXDG/J/3qSwiMfCXsRDC93y9a1NKDb2WNi/WX0keHiPdqH3MC2Ym; 24:yMNkKe7xh7gd3IWH5lm5pKbpy3f+YC1tZURxZloYTwu8vVY1flEFkdjU+DFUjDf+3nPPwUzipGLSblSx8zfgkhu71rcLkigC50R9VB5mRB4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB555; 7:oG8cFlk6RXunM3GHqOZEuPWhstram3wjM4rQdvUzSc9r2XawoOXWof1YzUGyAUcN8PZtK4vDbSHlP9JpOHlHRaE+R3LSREajqOAjhUPhlr2S/R1leH2o1phjUhajw3ADR1KMlnOjbRPgjZZmtu5D4SbK+7+G30aUuYDto4KJNoOW+XEigBlb0X8lcefgqPAuoDqdqTabswCd13XIUaD946QdLKCobDEYkfzO1DFK060LFiZHGeUao5fgJ5MWy3cGx1ScLKiPtfy0QT4vbFvEpfUJ04rbLz9FeLFqxjTN1oXZgwuDKu5Pg95BDyPx8XJIisJm2yVLHczqguLLEXUNng== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2017 12:41:59.7509 (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: BY2PR03MB555 Subject: [dpdk-dev] [PATCH v2 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: , X-List-Received-Date: Fri, 24 Mar 2017 12:42:05 -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 d968a09..cfa88c2 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; -- 1.9.1