From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0042.outbound.protection.outlook.com [104.47.32.42]) by dpdk.org (Postfix) with ESMTP id 90FCB58CF for ; Tue, 21 Feb 2017 10:28:23 +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=fUQmTD99CYLoOfRxkOeP0SCjho5aXcMIPf83YV02TzA=; b=IaZt+OThoSqb0ldkhU8seVKheLdtfLd79GUIEMpgptLPkGpeIevL4aZug53ro8qzTyAvPlg4BKHeKtr81bZYQ7kTp95RieTSitrFjtsR6aWjFoBN3cgKealOcuWB9++7ZghsOTHpyxoSLUgQGvS1qfv6sL+mLg4Q2yeU9wmHekc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shijith.Thotton@cavium.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.13; Tue, 21 Feb 2017 09:28:19 +0000 From: Shijith Thotton To: dev@dpdk.org Cc: Jerin Jacob , Derek Chickles , Venkat Koppula , Mallesham Jatharakonda Date: Tue, 21 Feb 2017 14:56:21 +0530 Message-Id: <1487669225-30091-7-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-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: MA1PR01CA0089.INDPRD01.PROD.OUTLOOK.COM (10.174.56.29) To SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) X-MS-Office365-Filtering-Correlation-Id: 9ae35917-0cb4-4140-8ceb-08d45a3bfa87 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 3:aeyGrrS60qNA5H2dEswW4xylGdDBuuUrhXHhlEwEq4rheQCHcgjALfUsmrX76oSgZOj+bFA2Bv1dv1ADn+AvBAYYrHuBLisfo3TjkVeuKCW+BwIuS1RbRwJTtzAy2r34PLCiKcFY8ggoe7LyHSr/4dG/9JAnNyUkqvNyz8H5a1D5YgG5scVMclIELpLEfzd4JIexyJH7zrPn+3fq1pxBHHp73hdz2JAvI00eOSjvuGXijo/YheOizVLgnZdkR8WPi+VBad7IFhotHmZAmO5WIA==; 25:EPHdJ0bOjfLb0uIVl42z+AGVdDyBgQ7m38XKt6f//dew/2EVB1Oz4vCOfNXgWCO/6gi8xoKFYVr9wLmsKbHTu7Nv3GxjVBRIghY5trCRKkaXQvAiPweuS9GedQwDZ1PmGy1VkChC7A9cfa7Pm5radnONo30LtV4q7n3qzmEjFCrxk6MGsukqzecLiDfZQ0+WlD8Yw2jc7RY3nPieWTynrs/FTc0qwTp233BLod3y7Tyw4J5uY7W0X8mwXcI6K0SzIFeK23DSVEq5iX9XZLwFBsn9mkIjnkeXT6fheqYfkg5ShHMJPAn0ts05sxnlaLF1hIHhYvYT8i6h9ZXuDkSQro25MjDPPnP9XuRgGiMhVLYg0NtWuXD4ZsstV5gZGZBNZ5gRjLK5jwqtevmcCegm6nq2RgVHN3DGsywFmO0i0cYglrfrOb5j/NTH1CU1Crcpm0J8IJiGWraCO0rr83irYA== X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 31:ahgs8ttL0//jUWXwzrEe9SG8C2AfLpU66lKt6lHWGlE/lXTISa9SuTxh+x9/amx1NH6gBlO5Poh2DbigY9vwQOVeHUZowVQbkEzoL824+ZdzZkp1GxNjyamW9avk1qCYTedCHXLV4OKKtkyBocA+cPifEtZnRwdw9ZVhlSyvNteg+x3ykWiH2u4IWEo3YPLjACNtFavJsjf6VFo2GL55X5u0G1vdxVUCo/zUCHIwHQw=; 20:QVnkTgblpC20zmX4BkY7pXBvdl+dxhY68BAwPb7jO5LOZNeCJOcy6V2n5K8aUWvoRrqVZ55odJ1IEQJFtHTyLFIh2rXVsuN+NBrsrzU0i8k/4DHa/D987CxpiuWCKQOrufepgF3hR1eeBciBM90wzhqORIw2I0qu3fKMsQOxnXN3QQS1yD2JZ6X980HJ7EaOlGKyfU4HSo8uR5R/2Vf4ZpiMBdL/IyvRSS3nmh3fh0vc9sA3V7B86CVyE1dV88pV8IZ7fuOLNjrp/L6VeN4EWb4SuRRx4L1CNBx7MQ3t6mLNS/bHWo0p/OQw2GW7XGURKSSXA8+9UccA1dujiSZBxH9xMUZ1K+8W4GfR4k2pBgZKb6KHntQM4jMy24nz63IkILWlFC6rj5iDjHs6AFQ4jw9iiZwIm3h7jC83Y8Mo6Y/r/CSlR317oj46zP+0mBikiFA6hvuiNXzKMvKrFEhpdfZZuixSfkaboR3BvdWnAxVU+8ADHNFRqf5f3EPH1im8lxgooT/lyCIw8hgvTIMQH9qB7zyzxIdiH83M/81LLgL3sKnrcPFEZwfbVf/Haw5878FONf/6NeMDLie/YceqGvaz+nn0cVOhAQqSlHUfLsU= 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)(3002001)(10201501046)(6041248)(20161123555025)(20161123564025)(20161123562025)(20161123560025)(20161123558025)(6072148); SRVR:SN1PR07MB2285; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 4:RSNkj4J8Jz/HrD3RcBYTESfy6a6lYmvZE9nO+6uUsSJxV1aVCaAo/5m1FUWpJHt+3EqeFoWowKHxBz2LsqACqpa7Flf/oSmmhMbUFxYspx9O03+kFGyZJuRiSZ1AqbQSC9mhmqNud2KKS7Ogsap6ViZHsiz5OECDaYP/HXXrxgcS8xMaTLb6Pt1s4iWnlSEOaZGX4CVyoKeWnTUSubmxjw1eM4vV1DUzG0tVoi3xiuHZO9PRegFv8DwMNagaxEyfEWC5wrmBApFvJ/t7aCgGTYt/tcTc/2OvOQHFyEF+ryVxN/4DR8UwAHiQRWGw00waWyh1FDJ0Y22fxtdslFbGi56GWLD8KPpY9V9w2usZFe9mfa97z3bEEOmpI4ddqtOeJEMiYN6oltA0tiZ+ci300/px/yftPzVqxwcKfOUYz12rv/YwAwYRavNqEFV64StqEpAjgbYzwEADJt0GFA2kbYncODCFzdnio/XWIbj8FPYCDK4hV3SzUoFWmAbPNTkrYgLbM0FlertAxhZXpbMhn7aaQfB+RxrcS+VUUxGA5D+d6SYutld8UD0cJPd02Ixe03NaPDe52dkNjgJrO9sZbeFBab3dj0LaWEw+vYjvD7o= X-Forefront-PRVS: 0225B0D5BC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(39410400002)(39830400002)(189002)(199003)(50226002)(81166006)(42186005)(2361001)(101416001)(81156014)(305945005)(3846002)(6116002)(5009440100003)(31430400001)(8676002)(105586002)(7736002)(53936002)(36756003)(110136004)(106356001)(6506006)(25786008)(38730400002)(2351001)(92566002)(48376002)(6486002)(97736004)(50466002)(5003940100001)(189998001)(68736007)(2906002)(4326007)(33646002)(76176999)(54906002)(5660300001)(6666003)(6916009)(50986999)(2950100002)(6512007)(4720700003)(42882006)(66066001)(47776003)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2285; H:lio357.in.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR07MB2285; 23:x6GTJgH2ofyiLtuAOEm+LxK8/UOVk8zhopobREQbC?= =?us-ascii?Q?GHlkBKb4jz1eExJxAEMkXC2EHlv8tslJY9WsPjwpFprZaDf6590+uX2eJDNC?= =?us-ascii?Q?by7EgKvr+nVNeNZBSqivT4ocJXD7m8Re1NBvcb0crAeiulVYPNqzg/kakHDW?= =?us-ascii?Q?Ntw8X5om4j7YlC4hBTtGkx3zPRLx0Hqgmea0SZbPNCacI/s45g9Hg1I1l+PL?= =?us-ascii?Q?gI/D221pt0FUqSVrxNToxP5ihsYzubMwWP0tl2aLRkyXIEoxjRcSGYZZvWwc?= =?us-ascii?Q?11a4aWDaewQ/KJCXa/j9qp6zYjBnZtFyKQtKOAqVPyTbluMK3khb248mzxqo?= =?us-ascii?Q?8EX5zgFZO6modB0y5v9S/PuhjjauinjPWBgabkkcrPXjBu7v/ZwLGprfH3Dm?= =?us-ascii?Q?6J1V5gqyn5pfjX5P2CCiUvgxbIG8h9op59lDqBzNUA1/KkTK2uJBiIU1f6dM?= =?us-ascii?Q?2kdLfFi8x9b+gjqiK3cIe1EXLF63VX10PW7aMP9PSxRB3YXSxEKhFS6W1wgi?= =?us-ascii?Q?QRr3D+r38LRCePU8HosA2eQhP3SPvabnQfOf1fvge4rJ9DQ/mhI5ILewvyx2?= =?us-ascii?Q?4uJwQvrKqc3Di710n2gsMFlm3H853T6j1yY4EKtowmkiO2blOLckQ27uiIOR?= =?us-ascii?Q?NXNYuhGhx4D918LBdZ73xtcgz67WSqytDor42jAQHn+72ch/P4/NEJxfDeCl?= =?us-ascii?Q?Bm6WGD+Dpv9w+94XpAr/FLjbMV4rIPJNoVbnBDXtLz3LexK9t/cVvZdaNRj+?= =?us-ascii?Q?gAHmFIF7XpV9RqJ1LUAS+bcfGIXyVe7lATz9umRTvY2biMOMsvf9HevTDjLQ?= =?us-ascii?Q?4itR4JAmBAUGXrHR2klDEF+XsHeHqHTgToctvP1Xdy293E9HROoy8MK2syML?= =?us-ascii?Q?N8nbdhOrNUFl1c5dcevf3AxWqH7B3bgyRHQSRppKYwbH4v1y2ZHpyyDe+4E0?= =?us-ascii?Q?wNn629/6XgqX4xqdlRKkYdonHYDXQVJ4Jqj9exxgyjNbOI1IcQaxNWjFUpvS?= =?us-ascii?Q?3G90aUFgqWGK4pvmGnhGiGxAveddZ7jttLgyjXBMlj0x39Inb4LSMNP/JZio?= =?us-ascii?Q?6izqBqdUUHqEVZk7yI4Uak21m+BpOFUFotiLq7Xl5meDzu94eDnsqovQloQ+?= =?us-ascii?Q?9CL0KyQ1cl5YbJVNbSR7JrAFj1MPSah+oc5Tj2F83VkAHaOE3lV/x+3t0wOd?= =?us-ascii?Q?e7cXGbAm5xj82yQvgT9chjM0J2rUjDssGudURrS3qfgw2tmeOytXpbW4FkYO?= =?us-ascii?Q?qyFwx+Zy121mahiOhNPs9feLlr78FMV+39+VVe95LiYqcFxZhW/eQ6m7emmC?= =?us-ascii?Q?0PmtnzfMm72oDImMnn4nz3yGLB1rvJ/Nw5h4q7kDFXb?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 6:0DHFB+rNlrtrIj+R/HU7AJLL1Tvd+4fAD1unXPvKSs8XHPAZ3B3PL/5gaOkFj6l+0WPPgjaUgEaI7t0WB1sDVTrFX9jNXTGYkH9QftavVhc7ZGkEI3HmGeSzD7YqZyvRsdTAOPUJx2gB/6WhE2Gd6KnKz5J4SvN4uHPrLx9ejFs2NV+OqELt6hX8vRpITr3TU0Zv6uGcB7Jslz19YvA+2mp+7ZQ/Tp1nHXNoMPay+3+VABmexPUiz7fipmQe0s9hExIityoHEqa/dwEOpac+lDma423m8w0dcbNQKPFqir4hNElsS+I3x4YuRLDfUYCgA+V9dswXyRQkkmaZqM6V5TBiC/X6GvTLZzhxSroDm6ajr+OlNHlQbNjBV2ORc3ltbPS9cdwTikmwcYD1suq3AQ==; 5:gOwGpZFdx4XigOuBRr9dwf/z0wpY+z7/9z6hleNsZ3IPLvVbPOGgok2sdLQpZIobGoBObvzEFPmtdKpo/kQMEJW5fiakCQKQ+hQcc020Ifq+W0BVwWWIzJUaX6KR7s+vKC7F3b6gs9ibuZ+EtV6IJQ==; 24:Nh4UDm0tcBf2NANh0wj/efxhVq6JRbgfvxVeUVf+Uxo54USI+HbuF6x5jdJe1oYlm+PDU406v58DmfZWRyqddsQha4KksONO1IYIq3e1IFM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 7:GqP6YcYEsU4zaa+Z9C8yKStYc6NmnfqmXOVfl5qGo3YJiQDT3etPh0aVeS9UKzpJrQi/E337+NrgtRDq0Gd1tvq8ZoXJUV6PudZoOvtMcZC1HuLJTxmD07nAWwkstDWNbBwiasgFiEkDGATiHrVuFKGmTArqJW1sGPIduE3qeX1ibo4vhOWVxcgK664oawz4gWiI8996oVPNW785/LI+hIUFAPWek1u5AlHHpSdWqLz3TL0c9uG0mgFbZD/tUrRpN510ajlClaD4tI4mYf3dgsRtJuD8fCIEpRfkBv97sRHO8fYa+/n20f9wSeOukLaEqggAtAYXw6uCEgrTpze68A== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2017 09:28:19.3527 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2285 Subject: [dpdk-dev] [PATCH 06/50] net/liquidio: liquidio VF PMD Driver registration 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: Tue, 21 Feb 2017 09:28:24 -0000 Register LiquidIO PMD (net_liovf) and define APIs to init and uninit. Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula Signed-off-by: Mallesham Jatharakonda --- drivers/net/liquidio/base/lio_hw_defs.h | 44 ++++++++++++ drivers/net/liquidio/lio_ethdev.c | 120 ++++++++++++++++++++++++++++++++ drivers/net/liquidio/lio_ethdev.h | 40 +++++++++++ drivers/net/liquidio/lio_struct.h | 65 +++++++++++++++++ 4 files changed, 269 insertions(+) create mode 100644 drivers/net/liquidio/base/lio_hw_defs.h create mode 100644 drivers/net/liquidio/lio_ethdev.c create mode 100644 drivers/net/liquidio/lio_ethdev.h create mode 100644 drivers/net/liquidio/lio_struct.h diff --git a/drivers/net/liquidio/base/lio_hw_defs.h b/drivers/net/liquidio/base/lio_hw_defs.h new file mode 100644 index 0000000..db42f3e --- /dev/null +++ b/drivers/net/liquidio/base/lio_hw_defs.h @@ -0,0 +1,44 @@ +/* + * 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_HW_DEFS_H_ +#define _LIO_HW_DEFS_H_ + +#ifndef PCI_VENDOR_ID_CAVIUM +#define PCI_VENDOR_ID_CAVIUM 0x177D +#endif + +#define LIO_CN23XX_VF_VID 0x9712 + +#define LIO_DEVICE_NAME_LEN 32 +#endif /* _LIO_HW_DEFS_H_ */ diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c new file mode 100644 index 0000000..b808a55 --- /dev/null +++ b/drivers/net/liquidio/lio_ethdev.c @@ -0,0 +1,120 @@ +/* + * 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 + +#include "lio_logs.h" +#include "lio_struct.h" +#include "lio_ethdev.h" + +static int +lio_eth_dev_uninit(struct rte_eth_dev *eth_dev) +{ + PMD_INIT_FUNC_TRACE(); + + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -EPERM; + + rte_free(eth_dev->data->mac_addrs); + eth_dev->data->mac_addrs = NULL; + + return 0; +} + +static int +lio_eth_dev_init(struct rte_eth_dev *eth_dev) +{ + struct rte_pci_device *pdev = RTE_DEV_TO_PCI(eth_dev->device); + struct lio_device *lio_dev = LIO_DEV(eth_dev); + int mac_addr_size = 0; + + PMD_INIT_FUNC_TRACE(); + + /* Primary does the initialization. */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + + rte_eth_copy_pci_info(eth_dev, pdev); + eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE; + + if (pdev->mem_resource[0].addr) { + lio_dev->hw_addr = pdev->mem_resource[0].addr; + } else { + PMD_INIT_LOG(ERR, "ERROR: Failed to map BAR0\n"); + return -ENODEV; + } + + lio_dev->eth_dev = eth_dev; + /* set lio device print string */ + snprintf(lio_dev->dev_string, sizeof(lio_dev->dev_string), + "%s[%02x:%02x.%x]", pdev->driver->driver.name, + pdev->addr.bus, pdev->addr.devid, pdev->addr.function); + + lio_dev->port_id = eth_dev->data->port_id; + + mac_addr_size = ETHER_ADDR_LEN; + + eth_dev->data->mac_addrs = rte_zmalloc("lio", mac_addr_size, 0); + if (eth_dev->data->mac_addrs == NULL) { + lio_dev_err(lio_dev, + "MAC addresses memory allocation failed\n"); + return -ENOMEM; + } + + return 0; +} + +/* Set of PCI devices this driver supports */ +static const struct rte_pci_id pci_id_liovf_map[] = { + { RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, LIO_CN23XX_VF_VID) }, + { .vendor_id = 0, /* sentinel */ } +}; + +static struct eth_driver rte_liovf_pmd = { + .pci_drv = { + .id_table = pci_id_liovf_map, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING, + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + }, + .eth_dev_init = lio_eth_dev_init, + .eth_dev_uninit = lio_eth_dev_uninit, + .dev_private_size = sizeof(struct lio_device), +}; + +RTE_PMD_REGISTER_PCI(net_liovf, rte_liovf_pmd.pci_drv); +RTE_PMD_REGISTER_PCI_TABLE(net_liovf, pci_id_liovf_map); +RTE_PMD_REGISTER_KMOD_DEP(net_liovf, "* igb_uio | vfio"); diff --git a/drivers/net/liquidio/lio_ethdev.h b/drivers/net/liquidio/lio_ethdev.h new file mode 100644 index 0000000..76c9072 --- /dev/null +++ b/drivers/net/liquidio/lio_ethdev.h @@ -0,0 +1,40 @@ +/* + * 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_ETHDEV_H_ +#define _LIO_ETHDEV_H_ + +#include + +#define LIO_DEV(_eth_dev) ((_eth_dev)->data->dev_private) +#endif /* _LIO_ETHDEV_H_ */ diff --git a/drivers/net/liquidio/lio_struct.h b/drivers/net/liquidio/lio_struct.h new file mode 100644 index 0000000..dcf99ce --- /dev/null +++ b/drivers/net/liquidio/lio_struct.h @@ -0,0 +1,65 @@ +/* + * 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_STRUCT_H_ +#define _LIO_STRUCT_H_ + +#include +#include +#include + +#include +#include + +#include "lio_hw_defs.h" + +/* ----------------------- THE LIO DEVICE --------------------------- */ +/** The lio device. + * Each lio device has this structure to represent all its + * components. + */ +struct lio_device { + uint8_t *hw_addr; + + char dev_string[LIO_DEVICE_NAME_LEN]; /* Device print string */ + + struct rte_eth_dev *eth_dev; + + uint8_t max_rx_queues; + uint8_t max_tx_queues; + uint8_t nb_rx_queues; + uint8_t nb_tx_queues; + uint8_t port_configured; + uint8_t port_id; +}; +#endif /* _LIO_STRUCT_H_ */ -- 1.8.3.1