From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0089.outbound.protection.outlook.com [104.47.42.89]) by dpdk.org (Postfix) with ESMTP id 97EEB6CB5 for ; Thu, 2 Mar 2017 12:38:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=k/l4B+lqGWY2/toRithfqtrHGwiw3qzZjWDf8ZGzQvI=; b=APfywLwpHPRM/dKkpR+cLYPLvyrotRbtWObExMWEzPHrjoqN6XzyzGJJodkomJDlGT1VuYK+kmTml5s4X4GKvr2j7B/uCOCaFJQ5Rywbjpo+qDyE8oVILk/dhtprueX2RJaMd3JdiNZQ7gfqECyLkmk8Ac/EGnAoB+n7PyDGmqA= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Thu, 2 Mar 2017 11:38:09 +0000 From: Shijith Thotton To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Jerin Jacob , Derek Chickles , Venkat Koppula , Srisivasubramanian S , Mallesham Jatharakonda Date: Thu, 2 Mar 2017 17:02:11 +0530 Message-Id: <1488454371-3342-7-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: BM1PR01CA0021.INDPRD01.PROD.OUTLOOK.COM (10.163.198.156) To CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) X-MS-Office365-Filtering-Correlation-Id: da3ddfc7-ea9b-4ba8-cd50-08d461609b99 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 3:GG4jlyzASAclWb7uC0y0YCe7MwCtMmyHm14yYpCDBT6ICL8owzwiIDJO0iZkeMN6v0jaO32OKzCdi289VvCY0wS4p2jto6fQMFg5/0A5YwpYLD+lU4v2VEICIpP3GBnJGChCNGfSGnA82TB0jTng9ZSreTkvqqWJkzeLQtPkmQ1396J9pfBACus4tFuxZwFt3Y+3sHF++iGjoc045dMcohDmhMLHsE3cXqswkE8d+a9QBYE5hxDBc8QB0FrszObtc47c2VtfMPrAJCLYQXaNeA==; 25:KgGPHXApGDpJJ549jOiYUhkDlAHv9CaXIJJ527sCqvVi4NUPm9ySwuPmf/2EsrQ/W5a6lqARij8ssNyu9VzLjZ2AX6kr0iWh9D3H8xlpPe3eVMQTtiVVphGu+mpzlmXQkVlOQs+NSamQtUJqnq772v+U8Ub2tIT3ZkAAPEnzfuxFK8zVzJwPw5519+a7EjvoglZrIapeDTue4qYVkidwFEz6Txol9XJEIegSVBQDSpi3nemXeAyCNdcQLgaoyRxx0RUFFe7TPgc4d8ijgrg97mdqObrtcGNo4QuiCwBHu8Gliom8FsP9GkRNhuGqJFay0rBRSIN6kf9vyFahMG34qLmrll0W2AGePyJNSY6ILQlwG/+mHgyOuvoOn9jFo5nPF101/1lcH47ZkqufYAYj6xlBVSpYzFavdBItHzviOxcmut6yR6wvTuclTKlvhvKmljG6oDF4DZNC1hhoO9Aw3w== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 31:hyH7WSj2UXPlwjLEEG1B6XzlbXA1AoPwHRpN3Vnr493gAGyNAXhDLNw1lmShNZUDws0gX2xKqfP2Dnq7xtxj5HHS/wkvF2sr5/z1AH0/Vpsd5YV1mJx59YYTzty3CHbX5jSEx+tSQi3guUQtUmtJrwRD0pERmTrFlUJcBLRRJQVKtI+cW/eu0kBz566GtLh0F+1WMTXK3wXAY4FHpo5FfuvA739h4TQhTUdhBDUnHDU=; 20:XU8cxFHRO5FpmXKHYDwOpP2U5HbEmR6zf/rrEme98rdFTnxvUgq7wb9UwgoNCOuVReFCRKr5eDIzKO151TLbZU6LWOZeCNILRZVttZL0rYrBa1ZUhBy0H5nUr20NaD+6Zxz/K270+pZbvee9/oJ1uRdcVipCotTh03fNRmD6FfF+Js8BNCu3Z9M09Txj+h6BMP+FDTnOC6ArJVV1xlcS3jKZ6+DZ0GGtkxpqIrq577LoKhIGhaxao2RLNJ0KK83H6hJ3qMlC0RaKvYO/DzZkf+WhQKiCHvYYaQh8k7FigdnEf0js6XS7p/pbJZtOV/gxiOV6j1Sy7LB2pnz4G11V5dg+5h5G2cs+0SGEjFRup5XCH9YMsUq7Dg7wZHnUF9ZSVBkO8/Eduv/YI837RVXTaiw5rpmP1mF1v28mlIResz7iMhZZdnop8y5KjM/wjteWQESCnYsntKwJSHJL+bhYyk2uMyFf1hMiPenFiDR0q6g+C6mM9Kde7ktapCUZGs6ev8+9VopDucKfoWdKfD044HR/YrSMAJ3xVtxq3A3JxRnADeUtttz9F7JznIzrQs1qoWhMdzFeydjUbSWCcuVlMYiIzIWvJHv12nLKWyjC7uY= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6041248)(20161123558025)(20161123555025)(20161123560025)(20161123564025)(20161123562025)(6072148); SRVR:CY1PR07MB2277; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 4:hV/1Z4NbFCQLYmYXMLWnYSBYg8jupbNja8tUYYF7wu06514tjgRT7/PYD47yGRFe6uN4msqBKLItHzChYdyiEaStKwDiOXLlKF/+Iz7m+3tWBL/U6D3agSmv1uyv/y4tj/oUN25dqNvrbd7rh7ea26u91lBvh1k/Xjxj9w2L3YjzeoA6p5IaaLf7edQzDAan8mI7l6PkP4OlqIISJy9JZ4xnOgSXiRYAPheVkOUR+edALkHDXc03D2oAm36VnSgK51Vt9kuJK9oymVmMJLWg+f7pgSa+fIYWghRJAzo8cY4UwpwuSy+IEInmjERWgM0xCirA/88D0AOvq3sg52Poyj9BOX8xluQMi0UqKfgdIvZkmHoICwM+IpgHw1Ctp7dtCJ0XQ5338PkAhEqsPHLstWvuAhe32XMOqRG4uXpOXCvGOj64KwKrFQNWYo8cuGp9D59FIvxjqwaw7grXLL+HU+d1Hz66LK8K2USG8KA1p+OPcQn2I2oDszekMi11dPXqWv8EGgw1XJjL6Qbqing1Yc4cF7DE1NqXul9c9tvJxNUtKyCMI72tc/i4uTgLP+VuO71DAGljbym3vm60PuLDCQkqiZUP7R7z1+ryHigOcBA= X-Forefront-PRVS: 023495660C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(31430400001)(2950100002)(6916009)(42882006)(5660300001)(92566002)(4720700003)(33646002)(551984002)(48376002)(50226002)(6666003)(2906002)(5003940100001)(36756003)(8676002)(50466002)(81166006)(110136004)(38730400002)(4326008)(305945005)(2361001)(53936002)(2351001)(25786008)(6512007)(189998001)(54906002)(47776003)(6506006)(6486002)(66066001)(6116002)(3846002)(50986999)(76176999)(5009440100003)(42186005)(7736002)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2277; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2277; 23:Z0+i+tuNejqmZkWzgDcAZkKA8wFkPDM7j9aiAEHjA?= =?us-ascii?Q?qiHVosUyk80VGVIj4FF4U3O6qFV0MjJIkCrGzdQrEYqIjK31bFEmqEIEuixk?= =?us-ascii?Q?aNMnW0wcOYmiOiCMAr9z8HEaiqBm3xzfr6/vFvFVYzdgM+nND6AYkseOHMWl?= =?us-ascii?Q?QWSp7Clal+1+WDKasBDSDrTkBtyohpQczccYvhuSq4cHafD8jLTaYKtV2BW6?= =?us-ascii?Q?TcC3is2f+yr4EMgDXQMM8WCsObJo/ECkRSFXI2LzBXMENqfveB27L/LjNnXY?= =?us-ascii?Q?VkrRYXp/ozjrBIj6kpwPZDuMhPE6UXeZtlrPJjkIMNpJtnpDidkj+rV3Rxfk?= =?us-ascii?Q?wukSfExlxlLXwxCTrl9uOI4dqLNEc1vvVQVXvzG3GqCP2DOSG8lToiOlIIkc?= =?us-ascii?Q?SLei7uQj9dLEygpQWozibjXzVY7zK/roVuMzE8pKfvqgPwTm181abA3hnVUH?= =?us-ascii?Q?tlsTvCqHzSSCfheawVSpOjtiK60WN8pnylQDNKHQ/L/g202WhDA7kmD1FYZx?= =?us-ascii?Q?YlbSBm9L+YwRDnvOhT7xCHyJDlBWpYM2Of2Q+R9BJzxLkBmwGDTmNusfBbUM?= =?us-ascii?Q?SFYB1zlVzDqFddbt3UnzLHTMwTW9wsFo8cjIsa6491erc25sDs5yRSlkGaOK?= =?us-ascii?Q?SLs1UTMhcj2pNC12rEMLHe/g1FMtjnNEbukaqx1kmVG1zbpThNp51OUFzajX?= =?us-ascii?Q?fCB/54NDk6U0kxeRC/6RgnOBL5QDU/tHIggp9KckbMAaVWSdSTHKdFUz+j03?= =?us-ascii?Q?GGluHmm6hyAOsLl6mMbsrx2vChTQscu+aHFAtL5yLoCSg2Yo4JukM278lnUq?= =?us-ascii?Q?3v9icMKyyWkIBbpyCNBrQoCGKuz7wsQSbAL8EQaYv72iUdme6pv+fKvRmyVx?= =?us-ascii?Q?EPi7z1n3QtDCYaYs/C/bN82ofdzqmVBExtUbn9CKjl/464EaXiIFgzYaokA2?= =?us-ascii?Q?26Lu4zyE7tsMwKCys14/9bDuPOGrm+yeFmS9rWviyeIgxpnP6Bzz26d4klyu?= =?us-ascii?Q?ue8Qx5aCMHcYQ1a6kLrxLHZd0Z3YSmM5rZGMXiHAb8p/veGNQKOqGeV8sVXN?= =?us-ascii?Q?MmkpG5yVrfeOQvGbnaKDE+Ir78wiUSs3ieC8yqwVm/k6W7jj72zF5sRKj4pO?= =?us-ascii?Q?DIhZMSQsi0a1yl3yUY/5bPiZyS/31jQ?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 6:loHi7lEXaesBpRXPhVdJH5rTDNbS8AH45WWb93gXZClh8oxiaBakMxZJSWUvDySFaCgH2nBdwI/kWRSXv7Bod2uQdWsgyEtP0ms9V39Wae2yvC/8p1B04SebyNNnRTOgF90uXYp78o63sgS8K0y+XkLVF/dr1RM4kUQc2QVGVb2N1hiJKePgt9go8hCvX8RqsYHZqU7aNHnc6WNKjm8N+dViDlJ0+fqfORx6Jc4rtPGFtUw8F0ZIKZ2ceWvlx2ZtUYXewt/JZPxcgz/+D64/zRbyxUZFLvYVbWJLAqZs5ADHlxzLbB5YWioemtfjY2TZmGocL/fsTuvedX5cvGrLFJ9GEw9udNJXxebw+MFoNzA5eyRqX2bj1PiKL17Z1hN0XK6QP/a81J+yY8bjSH4BjA==; 5:mHd2FII7kcTP+3dMfL5wAwKKKOhubH6X5Gq9e4aNrgFRADqPorsRe/i2k4uXEqkmOfLsLvY5kBIO4J2S1rx/BMTP7Ny1xZxk+4Cw+fW8befZpvbFdxmBvhCcYhu9Ah1Y5eiXCpBDTIGHhwiUikF1uQ==; 24:kRIOm7PdCxZRWx9GAESpacrvTtG9ynnUz34gQuEo662hju2rxpMeY6M5Tws/9f4KnyI/KA5O2idLkt6qLuZ257/aMdpdrrkkcNPeAC/NvoU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 7:AIOMYqJX19WgiTMLPUZXafg5lNhM82vJGU7YTWUmH41LRekbGTtIBScScR4irlNxfpq2MppaNK7o6Dzzo/vjHBcMI/Z9g9udv7kSNgGJFnXsvVr5M5k+o7vj16csJ2nUXQwsaTXsWGzczfoS3JXLcxu3Ys+50GivzpTRr2Jk1bem5KeOLsiKkUy31XpbuA7Z7TJ2RtseEqNWOpADH+va5ffcD/Bpad0JIwBLVsuo1/2fmQb9V30pn8xBJuAl4pkt5+OyldxFcmiHwHaVgbwCj9cOl+YVm2R8ks+YLmd9RRDS4MdGF6PuAgbzKKkD2X3ZMIRhYBcGbV50C1UvTUoWBg== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 11:38:09.4353 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2277 Subject: [dpdk-dev] [PATCH v2 06/46] net/liquidio: liquidio device init X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Mar 2017 11:38:14 -0000 Default device configuration and initialization code. Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula Signed-off-by: Srisivasubramanian S Signed-off-by: Mallesham Jatharakonda --- drivers/net/liquidio/Makefile | 1 + drivers/net/liquidio/base/lio_23xx_vf.c | 67 ++++++++++++++++++++++++++ drivers/net/liquidio/base/lio_23xx_vf.h | 84 +++++++++++++++++++++++++++++++++ drivers/net/liquidio/base/lio_hw_defs.h | 34 +++++++++++++ drivers/net/liquidio/lio_ethdev.c | 61 +++++++++++++++++++++++- drivers/net/liquidio/lio_struct.h | 70 +++++++++++++++++++++++++++ 6 files changed, 316 insertions(+), 1 deletion(-) create mode 100644 drivers/net/liquidio/base/lio_23xx_vf.c create mode 100644 drivers/net/liquidio/base/lio_23xx_vf.h diff --git a/drivers/net/liquidio/Makefile b/drivers/net/liquidio/Makefile index 25685a7..8880a10 100644 --- a/drivers/net/liquidio/Makefile +++ b/drivers/net/liquidio/Makefile @@ -51,6 +51,7 @@ VPATH += $(RTE_SDK)/drivers/net/liquidio/base # all source are stored in SRCS-y # SRCS-$(CONFIG_RTE_LIBRTE_LIO_PMD) += lio_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_LIO_PMD) += lio_23xx_vf.c # this lib depends upon: DEPDIRS-$(CONFIG_RTE_LIBRTE_LIO_PMD) += lib/librte_eal lib/librte_ether diff --git a/drivers/net/liquidio/base/lio_23xx_vf.c b/drivers/net/liquidio/base/lio_23xx_vf.c new file mode 100644 index 0000000..dd5e3a6 --- /dev/null +++ b/drivers/net/liquidio/base/lio_23xx_vf.c @@ -0,0 +1,67 @@ +/* + * BSD LICENSE + * + * Copyright(c) 2017 Cavium, Inc.. All rights reserved. + * All rights reserved. + * + * 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 Cavium, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 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 + * OWNER(S) 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 "lio_logs.h" +#include "lio_23xx_vf.h" +#include "lio_23xx_reg.h" + +int +cn23xx_vf_setup_device(struct lio_device *lio_dev) +{ + uint64_t reg_val; + + PMD_INIT_FUNC_TRACE(); + + /* INPUT_CONTROL[RPVF] gives the VF IOq count */ + reg_val = lio_read_csr64(lio_dev, CN23XX_SLI_IQ_PKT_CONTROL64(0)); + + lio_dev->pf_num = (reg_val >> CN23XX_PKT_INPUT_CTL_PF_NUM_POS) & + CN23XX_PKT_INPUT_CTL_PF_NUM_MASK; + lio_dev->vf_num = (reg_val >> CN23XX_PKT_INPUT_CTL_VF_NUM_POS) & + CN23XX_PKT_INPUT_CTL_VF_NUM_MASK; + + reg_val = reg_val >> CN23XX_PKT_INPUT_CTL_RPVF_POS; + + lio_dev->sriov_info.rings_per_vf = + reg_val & CN23XX_PKT_INPUT_CTL_RPVF_MASK; + + lio_dev->default_config = lio_get_conf(lio_dev); + if (lio_dev->default_config == NULL) + return -1; + + return 0; +} diff --git a/drivers/net/liquidio/base/lio_23xx_vf.h b/drivers/net/liquidio/base/lio_23xx_vf.h new file mode 100644 index 0000000..1c234bf --- /dev/null +++ b/drivers/net/liquidio/base/lio_23xx_vf.h @@ -0,0 +1,84 @@ +/* + * BSD LICENSE + * + * Copyright(c) 2017 Cavium, Inc.. All rights reserved. + * All rights reserved. + * + * 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 Cavium, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 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 + * OWNER(S) 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 _LIO_23XX_VF_H_ +#define _LIO_23XX_VF_H_ + +#include + +#include "lio_struct.h" + +static const struct lio_config default_cn23xx_conf = { + .card_type = LIO_23XX, + .card_name = LIO_23XX_NAME, + /** IQ attributes */ + .iq = { + .max_iqs = CN23XX_CFG_IO_QUEUES, + .pending_list_size = + (CN23XX_MAX_IQ_DESCRIPTORS * CN23XX_CFG_IO_QUEUES), + .instr_type = OCTEON_64BYTE_INSTR, + }, + + /** OQ attributes */ + .oq = { + .max_oqs = CN23XX_CFG_IO_QUEUES, + .info_ptr = OCTEON_OQ_INFOPTR_MODE, + .refill_threshold = CN23XX_OQ_REFIL_THRESHOLD, + }, + + .num_nic_ports = CN23XX_DEFAULT_NUM_PORTS, + .num_def_rx_descs = CN23XX_MAX_OQ_DESCRIPTORS, + .num_def_tx_descs = CN23XX_MAX_IQ_DESCRIPTORS, + .def_rx_buf_size = CN23XX_OQ_BUF_SIZE, +}; + +static inline const struct lio_config * +lio_get_conf(struct lio_device *lio_dev) +{ + const struct lio_config *default_lio_conf = NULL; + + /* check the LIO Device model & return the corresponding lio + * configuration + */ + default_lio_conf = &default_cn23xx_conf; + + if (default_lio_conf == NULL) { + lio_dev_err(lio_dev, "Configuration verification failed\n"); + return NULL; + } + + return default_lio_conf; +} + +int cn23xx_vf_setup_device(struct lio_device *lio_dev); +#endif /* _LIO_23XX_VF_H_ */ diff --git a/drivers/net/liquidio/base/lio_hw_defs.h b/drivers/net/liquidio/base/lio_hw_defs.h index 9a7a894..a2654cd 100644 --- a/drivers/net/liquidio/base/lio_hw_defs.h +++ b/drivers/net/liquidio/base/lio_hw_defs.h @@ -42,6 +42,40 @@ #define LIO_CN23XX_VF_VID 0x9712 +/* --------------------------CONFIG VALUES------------------------ */ + +/* CN23xx IQ configuration macros */ +#define CN23XX_MAX_RINGS_PER_PF 64 +#define CN23XX_MAX_RINGS_PER_VF 8 + +#define CN23XX_MAX_INPUT_QUEUES CN23XX_MAX_RINGS_PER_PF +#define CN23XX_MAX_IQ_DESCRIPTORS 512 +#define CN23XX_MIN_IQ_DESCRIPTORS 128 + +#define CN23XX_MAX_OUTPUT_QUEUES CN23XX_MAX_RINGS_PER_PF +#define CN23XX_MAX_OQ_DESCRIPTORS 512 +#define CN23XX_MIN_OQ_DESCRIPTORS 128 +#define CN23XX_OQ_BUF_SIZE 1536 + +#define CN23XX_OQ_REFIL_THRESHOLD 16 + +#define CN23XX_DEFAULT_NUM_PORTS 1 + +#define CN23XX_CFG_IO_QUEUES CN23XX_MAX_RINGS_PER_PF + +/* common OCTEON configuration macros */ +#define OCTEON_64BYTE_INSTR 64 +#define OCTEON_OQ_INFOPTR_MODE 1 + +/* Max IOQs per LIO Link */ +#define LIO_MAX_IOQS_PER_IF 64 + +enum lio_card_type { + LIO_23XX /* 23xx */ +}; + +#define LIO_23XX_NAME "23xx" + #define LIO_DEVICE_NAME_LEN 32 /* Routines for reading and writing CSRs */ diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index 49efede..734f6c4 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -37,9 +37,63 @@ #include #include "lio_logs.h" -#include "lio_struct.h" +#include "lio_23xx_vf.h" #include "lio_ethdev.h" +/** + * \brief Identify the LIO device and to map the BAR address space + * @param lio_dev lio device + */ +static int +lio_chip_specific_setup(struct lio_device *lio_dev) +{ + struct rte_pci_device *pdev = lio_dev->pci_dev; + uint32_t dev_id = pdev->id.device_id; + const char *s; + int ret = 1; + + switch (dev_id) { + case LIO_CN23XX_VF_VID: + lio_dev->chip_id = LIO_CN23XX_VF_VID; + ret = cn23xx_vf_setup_device(lio_dev); + s = "CN23XX VF"; + break; + default: + s = "?"; + lio_dev_err(lio_dev, "Unsupported Chip\n"); + } + + if (!ret) + lio_dev_info(lio_dev, "DEVICE : %s\n", s); + + return ret; +} + +static int +lio_first_time_init(struct lio_device *lio_dev, + struct rte_pci_device *pdev) +{ + int dpdk_queues; + + PMD_INIT_FUNC_TRACE(); + + /* set dpdk specific pci device pointer */ + lio_dev->pci_dev = pdev; + + /* Identify the LIO type and set device ops */ + if (lio_chip_specific_setup(lio_dev)) { + lio_dev_err(lio_dev, "Chip specific setup failed\n"); + return -1; + } + + dpdk_queues = (int)lio_dev->sriov_info.rings_per_vf; + + lio_dev->max_tx_queues = dpdk_queues; + lio_dev->max_rx_queues = dpdk_queues; + + return 0; +} + static int lio_eth_dev_uninit(struct rte_eth_dev *eth_dev) { @@ -84,6 +138,11 @@ lio_dev->port_id = eth_dev->data->port_id; + if (lio_first_time_init(lio_dev, pdev)) { + lio_dev_err(lio_dev, "Device init failed\n"); + return -EINVAL; + } + eth_dev->data->mac_addrs = rte_zmalloc("lio", ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) { lio_dev_err(lio_dev, diff --git a/drivers/net/liquidio/lio_struct.h b/drivers/net/liquidio/lio_struct.h index dcf99ce..a1203e4 100644 --- a/drivers/net/liquidio/lio_struct.h +++ b/drivers/net/liquidio/lio_struct.h @@ -43,16 +43,86 @@ #include "lio_hw_defs.h" +struct lio_sriov_info { + /** Number of rings assigned to VF */ + uint32_t rings_per_vf; + + /** Number of VF devices enabled */ + uint32_t num_vfs; +}; + +/* Structure to define the configuration attributes for each Input queue. */ +struct lio_iq_config { + /* Max number of IQs available */ + uint8_t max_iqs; + + /** Pending list size (usually set to the sum of the size of all Input + * queues) + */ + uint32_t pending_list_size; + + /** Command size - 32 or 64 bytes */ + uint32_t instr_type; +}; + +/* Structure to define the configuration attributes for each Output queue. */ +struct lio_oq_config { + /* Max number of OQs available */ + uint8_t max_oqs; + + /** If set, the Output queue uses info-pointer mode. (Default: 1 ) */ + uint32_t info_ptr; + + /** The number of buffers that were consumed during packet processing by + * the driver on this Output queue before the driver attempts to + * replenish the descriptor ring with new buffers. + */ + uint32_t refill_threshold; +}; + +/* Structure to define the configuration. */ +struct lio_config { + uint16_t card_type; + const char *card_name; + + /** Input Queue attributes. */ + struct lio_iq_config iq; + + /** Output Queue attributes. */ + struct lio_oq_config oq; + + int num_nic_ports; + + int num_def_tx_descs; + + /* Num of desc for rx rings */ + int num_def_rx_descs; + + int def_rx_buf_size; +}; + /* ----------------------- THE LIO DEVICE --------------------------- */ /** The lio device. * Each lio device has this structure to represent all its * components. */ struct lio_device { + /** PCI device pointer */ + struct rte_pci_device *pci_dev; + + /** Octeon Chip type */ + uint16_t chip_id; + uint16_t pf_num; + uint16_t vf_num; + uint8_t *hw_addr; + struct lio_sriov_info sriov_info; + char dev_string[LIO_DEVICE_NAME_LEN]; /* Device print string */ + const struct lio_config *default_config; + struct rte_eth_dev *eth_dev; uint8_t max_rx_queues; -- 1.8.3.1