From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0075.outbound.protection.outlook.com [104.47.2.75]) by dpdk.org (Postfix) with ESMTP id 1A403DE0 for ; Tue, 6 Mar 2018 07:49:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=switSK1KuDAhr3Y/euoCCLT18WzTu/lzDWF1wJJmJ7c=; b=ruZAvLbafHqvt4+f0Za7T6YpJcw285DVujEu6zke2C22poXLLSn/BviSeoS9nRHTF9wJ6lQ7gIC2suy1xK2SMRLoYOp78m4QfOQg1gAa8LrwiHq71Hao4PsZ4MKDhH809QxVPqm5uj00v5UOs0wQ1PPGNxgSpbY0cE8D9bltweg= Received: from mail-wm0-f44.google.com (74.125.82.44) by VI1PR0402MB2782.eurprd04.prod.outlook.com (2603:10a6:800:ad::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.13; Tue, 6 Mar 2018 06:49:23 +0000 Received: by mail-wm0-f44.google.com with SMTP id a20so16478723wmd.1 for ; Mon, 05 Mar 2018 22:49:23 -0800 (PST) X-Gm-Message-State: AElRT7HmBV4xNYe0Cisg990ewytzG3vH+uez9+yGuyapEd+ygBc4vL2w psrXdnvoH9fFSOFJ0c7xImu6CkvmEl/GjAelVm0= X-Google-Smtp-Source: AG47ELsvp88BwmXmoX8bacO3a8WB6XSnsdYLC8cjquCQ8KZ/9dfbcd+cUjO97CjY450SyPsnCNeoWrU3DTgRvRqYJbc= X-Received: by 10.28.59.130 with SMTP id i124mr9419941wma.23.1520318910861; Mon, 05 Mar 2018 22:48:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.135.130 with HTTP; Mon, 5 Mar 2018 22:48:00 -0800 (PST) In-Reply-To: <1520300638-134954-5-git-send-email-rosen.xu@intel.com> References: <1520300638-134954-1-git-send-email-rosen.xu@intel.com> <1520300638-134954-5-git-send-email-rosen.xu@intel.com> From: Shreyansh Jain Date: Tue, 6 Mar 2018 12:18:00 +0530 X-Gmail-Original-Message-ID: Message-ID: To: Rosen Xu Cc: dev@dpdk.org, declan.doherty@intel.com, tianfei.zhang@intel.com Content-Type: text/plain; charset="UTF-8" X-Originating-IP: [74.125.82.44] X-ClientProxiedBy: AM5P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:206:14::34) To VI1PR0402MB2782.eurprd04.prod.outlook.com (2603:10a6:800:ad::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: dc18057f-e1b2-42b9-e72f-08d5832e6529 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0402MB2782; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB2782; 3:Ef2SwCep5jyUssZ778eWAiQsXycnP6s7tdnXSWSt445tCueQevyBeLSdWBcBtpaRPVupchJwqf5P8ZLXMwUWZDdDU59pj7lXfbVTlcQn6tbGtOKnk3N/am89qesMuf+yUAlLWfFhUYa80pW3Rrru7BsQPQfbZ7RLacCcnCLRy5TKauSyb/sFXkg3EnIAi2HDPHRRmH0TsaS4agAgl5mhO5YjHvUF38dVmmNEhY6CeHqG5MqvQx2EgWvYGcfRpydP; 25:eqj+Mjnwf+Sw2IPb9DrKpO1v05RgIoQ3GY4TL0vPuRjQRMClc72dS4SY0BFtO9rR9ClhJGdlJ8d3IQvmg93J4Dp0Jxx6TqTD4mGZVmTAMpVChx9R7sXAmLiPXJOBibSWScRRCbFkj9PtlVOusR57tMCmQAPQU90ge1xMReJ2K/abSfOySUJjRSKlgdLOKNhbyS5M4kP1VSoSUyp7GO24wRJ3rG+EO7bxsQxwUj+7am6MTH9DpXPBtLMR6C5Ul/zXQgIP/ut4xhqi291YQLqsAo9bJ66FubpbyGSo6k4EkxW6ovKiJNjQu0OUmjCN11AE1lCQrysT3rMqreD8/6uCXQ==; 31:8UZBh1Sgtn1wjolmL4oLXeegIe+6jArdofacWxzT8LVpqld0FvZtXHVNVZSAJO47tRga0Xex6lAeu0SFLYoyZoImvOwM1uSZ7Mlb83lEUm/T7XyiN2Q96lLFRC0blW6vtTmRnsseJqbPi3lTrd2mVia1s40XxlAKQ5K3Z6R8j5wBP/MChYL4qJX8dbUIhmT1wUS9smX3Pc6LSpnAFoPgR43M0itmSRyfufO4vwOOGjE= X-MS-TrafficTypeDiagnostic: VI1PR0402MB2782: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB2782; 20:q7+YmLo/t/SnoJVknouI5N2nKAHq54mYPE0oMfbu6u+tkSe1065NplbfQKdXtgyPOSRT4eD2E8BKqCP9HtzfMN3On6IfeB5H3yB1Q3zkyJrf9zPewszg1hTcK5SpEJMSq731EHU2KYxuuuK2bPggRYhdRiRUhyszTTl/XgXVBAiiriLKtP1HIg6AlNQGqf6y0PjNRBm6n3bpclUTETqLJ0TDqai5g+5IYW4+MaNpq9Lf2E1u1qqtDUe2P8A3R/QosrCqexAyIgHljhw5TA02h20ogK1mmacrgbxE98aDSAsTipE2q7toU/NY0m3OhSAYtDVyKiuHJg6sFdeZHg5eoKxDaYxYOY0yLTJu3IzKxveFOfu+D+Q1d0cKwJqVgFQEXPoogyHVj1zDoCqVFEC5oE/JyuvvzpCgXeXElqhwNkuyareYDBLQWGsmtcQJtOw2I8vDWd0vHU384Bv+0zIhAhvmjN5gG3CeSOyDBg2WMgnchRQe5GJHRRz9gdCynKIU; 4:2i8/drgA3fu6fCCWrVTEU45TsxFaV5lhgYIgaszm1nMktXbUVH7ycwcWEQ0F52NroOOVQFgVE+YubXefRVQz6FqG6eBSOtXtgta7TNc1B7J/2Oge+nPNmcKUc60+0NfeC8iRlZ1sT+s08/Qgiz8h6hrZYnnSQftjS8B7AT4jZlwbM1uMmE2jgo0MYt0tu1KK+n0EaisiLTT03AhZxh4eFmbtz97Rl0PqnPGI8gRzwFEA3usqKtnYMa1YX22wxHE/F2Tlmh0U/Kna04d0H43/ttwIUox6E/2SsSnm9j8tMRyTRsIxZwNUA7Qjffqjmw41vush/cjQFPOKkzVd+TeX0d1WzEZUKIX5N7VY6vsSL/I= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(35073007944872)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3231220)(944501244)(52105095)(3002001)(6055026)(6041288)(20161123558120)(20161123560045)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:VI1PR0402MB2782; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0402MB2782; X-Forefront-PRVS: 06036BD506 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(376002)(396003)(39380400002)(39860400002)(346002)(189003)(199004)(93516011)(2950100002)(50466002)(5890100001)(8676002)(76176011)(69596002)(59450400001)(5660300001)(86362001)(81156014)(61726006)(23676004)(16586007)(52116002)(8936002)(55446002)(229853002)(5820100001)(575784001)(107886003)(386003)(2906002)(47776003)(66066001)(42186006)(6246003)(4326008)(7736002)(33896004)(6116002)(122856001)(81166006)(6862004)(3846002)(478600001)(95326003)(186003)(316002)(26005)(97736004)(53936002)(68736007)(105586002)(498394004)(53546011)(9686003)(305945005)(106356001)(55236004)(61266001)(9896002)(55456009)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0402MB2782; H:mail-wm0-f44.google.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtWSTFQUjA0MDJNQjI3ODI7MjM6THE1clV4TjFGQ3diai82UHFIdkIvMzAw?= =?utf-8?B?dVRTNGVUdGU4UDY0clBGRkJJRlZ5TTkyeEpadGtGNkVROGIrdUFaWWlicGwz?= =?utf-8?B?T3UwRHJMeU5jWW9jUVVQclp5VDA0VFJ0TlB1d1lnUU9OVVlENGNIeSswOC9a?= =?utf-8?B?TkdBL05XdVZmb050SjNEQWV1YjF1a2lXYlhvdWJoTGtsTGpMWnIzaHh5RVk3?= =?utf-8?B?ZUdDQWo2SlJxdThhQmJHZjUwMGhHSUxVYXZTc01EcmpxWk9BWmVIWGZ5QUNt?= =?utf-8?B?NnVIU2xDNHlNYWt5R3NGMVVobWVPenVLbVFXMmJYQjFENUUwb1RNaG9WQ0wx?= =?utf-8?B?Y2NsenBrcVlYMVdnNlc0M0xQcHdkVWNOb1JZYlBHKzBzZkl6bEVWSFFlcTVT?= =?utf-8?B?SmxIUkZiVVk4SXd1WTJVOG4xZC8zUmhlRzZhdytzNi9KTVlpckJYSGxuSlNs?= =?utf-8?B?SmZ2amRFVFVaQ0pzSm9IbG90N2tMY0IwT2EvekEvb2FSU01ibThZVC9YTVN5?= =?utf-8?B?bkJkNHJsK3BwUE1lV2l4bGxYb3pXSzBTc2VmbjZkeXV4ZHV1SkF6TnBXVjFD?= =?utf-8?B?Wnc5WWZlK2dmZTdJZ3NESE83cCt0RDdMSEtIb1J5MlgvMkdRdjJoNWJDRmxa?= =?utf-8?B?T056MWdwMWlPbkxQcFlwQityUHJZTEhMRlBFUERJc1FUa055QUNNK1dBMlBn?= =?utf-8?B?UlkvaEtkK0ZLTWxwQk4wZDRiNWs5R1dCT3FNS05uV0Y1K0p4NXk4dHVDd2hv?= =?utf-8?B?SE9adHVnekQ2dkd0U3B2c2hKRnRtTzhzOHVjTm5ZRkJjU015UytOd0tYblFQ?= =?utf-8?B?WndNSVpzOTl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hJBSlXMsPZeGZ0A+pQ/DfmYUzIbR4IgAXU2u5+zHoERwP1iVxytg4k9M5nTjxt8EJsqG8aNjO1k=; 7:MYIUcU6x/cD4s72mhR79mTEO2GxFVTJQefYvA1m/TdLqqZI9F6xmRAoiabF9qwCfr3Y+hQqmdqcZcuGmmCEG/8+quiPENMa42bMbTKf7fvmWxN0KU/MdgKB4CvGyw2+vpnMc0SYjMEfFujXqQI3mezcCvwD2kzKEsrrlHGqri9WoofYQGANtbvRSsJoVEamHKoqAkryAT2sFnn4AP3qKGl79cPrt2wg9KhsbJgMTSTdiH0QRwg8Mii5Vh/Sm+dno SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2018 06:49:23.1616 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dc18057f-e1b2-42b9-e72f-08d5832e6529 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB2782 Subject: Re: [dpdk-dev] [RFC 4/4] drivers/raw/ifpga_rawdev: Rawdev for Intel FPGA Device, it's a PCI Driver of FPGA Device Manager 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, 06 Mar 2018 06:49:25 -0000 On Tue, Mar 6, 2018 at 7:13 AM, Rosen Xu wrote: > Signed-off-by: Rosen Xu > --- > drivers/raw/ifpga_rawdev/Makefile | 59 ++++ > drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 343 +++++++++++++++++++++ > drivers/raw/ifpga_rawdev/ifpga_rawdev.h | 109 +++++++ > drivers/raw/ifpga_rawdev/ifpga_rawdev_example.c | 121 ++++++++ When rawdev skeleton driver was integrated, Thomas raised this point of naming 'skeleton_rawdev' rather than just 'skeleton'. So, rather than 'ifpga_rawdev' rather than 'ifpga'. At that time I thought we could use as model. But, frankly, to me it seems a bad choice now. Extra '_rawdev' doesn't serve any purpose here. So, feel free to change your naming to a more appropriate "drivers/raw/ifpga/" or "drivers/raw/ifpga_sample" etc. Probably I too can change the skeleton_rawdev to skeleton. > .../ifpga_rawdev/rte_pmd_ifpga_rawdev_version.map | 4 + > 5 files changed, 636 insertions(+) > create mode 100644 drivers/raw/ifpga_rawdev/Makefile > create mode 100644 drivers/raw/ifpga_rawdev/ifpga_rawdev.c > create mode 100644 drivers/raw/ifpga_rawdev/ifpga_rawdev.h > create mode 100644 drivers/raw/ifpga_rawdev/ifpga_rawdev_example.c > create mode 100644 drivers/raw/ifpga_rawdev/rte_pmd_ifpga_rawdev_version.map > > diff --git a/drivers/raw/ifpga_rawdev/Makefile b/drivers/raw/ifpga_rawdev/Makefile > new file mode 100644 > index 0000000..3166fe2 > --- /dev/null > +++ b/drivers/raw/ifpga_rawdev/Makefile > @@ -0,0 +1,59 @@ > +# BSD LICENSE > +# > +# Copyright(c) 2010-2017 Intel Corporation. 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 Intel Corporation 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 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. > + SPDX identifier in place of BSD boiler-plate. > +include $(RTE_SDK)/mk/rte.vars.mk > + > +# > +# library name > +# > +LIB = librte_pmd_ifpga_rawdev.a > + > +CFLAGS += -DALLOW_EXPERIMENTAL_API > +CFLAGS += -O3 > +CFLAGS += $(WERROR_FLAGS) > +CFLAGS += -I$(RTE_SDK)/drivers/bus/ifpga > +CFLAGS += -I$(RTE_SDK)/drivers/raw/ifpga_rawdev > +LDLIBS += -lrte_eal > +LDLIBS += -lrte_rawdev > +LDLIBS += -lrte_bus_vdev > +LDLIBS += -lrte_kvargs > + > +EXPORT_MAP := rte_pmd_ifpga_rawdev_version.map > + > +LIBABIVER := 1 > + > +# > +# all source are stored in SRCS-y > +# > +SRCS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV) += ifpga_rawdev.c > +SRCS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV) += ifpga_rawdev_example.c This is a copy-paste issue - CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV > + > +include $(RTE_SDK)/mk/rte.lib.mk > diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c > new file mode 100644 > index 0000000..6046711 > --- /dev/null > +++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c > @@ -0,0 +1,343 @@ > +/*- > + * BSD LICENSE > + * > + * Copyright 2016 NXP. :) - should be Intel. Even better - SPDX > + * > + * 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 NXP 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 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 > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "rte_rawdev.h" > +#include "rte_rawdev_pmd.h" > +#include "rte_bus_ifpga.h" > +#include "ifpga_rawdev.h" > + > +int ifpga_rawdev_logtype; > + > +#define PCI_VENDOR_ID_INTEL 0x8086 > +/* PCI Device ID */ > +#define PCIe_DEVICE_ID_RCiEP0_MCP 0xBCBD > +#define PCIe_DEVICE_ID_RCiEP0_SKX_P 0xBCC0 > +#define PCIe_DEVICE_ID_RCiEP0_DCP 0x09C4 > +/* VF Device */ > +#define PCIe_DEVICE_ID_VF_MCP 0xBCBF > +#define PCIe_DEVICE_ID_VF_SKX_P 0xBCC1 > +#define PCIe_DEVICE_ID_VF_DCP 0x09C5 > +#define RTE_MAX_RAW_DEVICE 10 > + > +static const struct rte_pci_id pci_ifpga_map[] = { > + { RTE_PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIe_DEVICE_ID_RCiEP0_MCP) }, > + { RTE_PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIe_DEVICE_ID_VF_MCP) }, > + { RTE_PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIe_DEVICE_ID_RCiEP0_SKX_P) }, > + { RTE_PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIe_DEVICE_ID_VF_SKX_P) }, > + { RTE_PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIe_DEVICE_ID_RCiEP0_DCP) }, > + { RTE_PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIe_DEVICE_ID_VF_DCP) }, > + { .vendor_id = 0, /* sentinel */ }, > +}; > + > +static void ifpga_rawdev_info_get(struct rte_rawdev *dev, > + rte_rawdev_obj_t dev_info) > +{ > + struct ifpga_rawdev *ifpga; > + struct rte_afu_device *afu_dev; > + > + IFPGA_RAWDEV_PMD_FUNC_TRACE(); > + > + if (!dev_info) { > + IFPGA_RAWDEV_PMD_ERR("Invalid request"); > + return; > + } > + > + ifpga = ifpga_rawdev_get_priv(dev); > + > + afu_dev = dev_info; > + //------------------------------- > + //Todo: fill afu_dev->rte_rawdev and afu_dev->rte_mem_resource > + //*get afu_dev->num_region from Rawdev > + //*get afu_dev->mem_resource from Rawdev > + //*get afu_dev->max_vfs from Rawdev > + //------------------------------- > + > +} > + > +static int ifpga_rawdev_start(struct rte_rawdev *dev) > +{ > + int ret = 0; > + struct ifpga_rawdev *ifpga; > + enum ifpga_rawdev_device_state fpga_state; > + > + IFPGA_RAWDEV_PMD_FUNC_TRACE(); > + > + RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL); > + > + ifpga = ifpga_rawdev_get_priv(dev); > + > + fpga_state = ifpga->fpga_state; > + > + if (fpga_state == IFPGA_IDLE) { > + ret = ifpga_enumerate(&ifpga->hw); > + if (ret) { > + ifpga->fpga_state = IFPGA_ERROR; > + IFPGA_RAWDEV_PMD_ERR("Failed to enumerate fme: %d", ret); > + ret = -EINVAL; > + return ret; > + } > + ifpga_fme_hw_init(&ifpga->hw); > + ifpga->fpga_state = IFPGA_READY; > + } else { > + IFPGA_RAWDEV_PMD_DEBUG("IFPGA is enumerated"); > + } > + > + return ret; > +} > + > +static void ifpga_rawdev_stop(struct rte_rawdev *dev) > +{ > + > +} > +static int ifpga_rawdev_close(struct rte_rawdev *dev) > +{ > + int ret = 0; > + > + > + return ret; > +} > + > +static int ifpga_rawdev_reset(struct rte_rawdev *dev) > +{ > + > + > + return 0; > +} > +static int ifpga_rawdev_pr(struct rte_rawdev *dev, > + rte_rawdev_obj_t pr_conf) > +{ > + struct ifpga_rawdev *ifpga; > + struct ifpga_hw *hw; > + struct rte_afu_pr_conf *afu_pr_conf; > + int ret; > + unsigned int num_resource = 1; > + > + IFPGA_RAWDEV_PMD_FUNC_TRACE(); > + > + ifpga = ifpga_rawdev_get_priv(dev); > + > + if (!pr_conf) > + return -EINVAL; > + > + afu_pr_conf = pr_conf; > + > + hw = &ifpga->hw; > + ifpga_port_hw_init(hw, afu_pr_conf->afu_id.port); > + ifpga_get_afu_mmio_info(hw, afu_pr_conf->afu_id.port, &ifpga->pci_dev->mem_resource[0], &num_resource); > + ret=rte_fpga_do_pr(hw, afu_pr_conf->afu_id.port, afu_pr_conf->bs_path); > + if (ret) { > + printf("do pr error\n"); > + return ret; > + } > + > + return 0; > +} > + > +static const struct rte_rawdev_ops ifpga_rawdev_ops = { > + .dev_info_get = ifpga_rawdev_info_get, > + .dev_configure = NULL, > + .dev_start = ifpga_rawdev_start, > + .dev_stop = ifpga_rawdev_stop, > + .dev_close = ifpga_rawdev_close, > + .dev_reset = ifpga_rawdev_reset, > + > + .queue_def_conf = NULL, > + .queue_setup = NULL, > + .queue_release = NULL, > + > + .attr_get = NULL, > + .attr_set = NULL, > + > + .enqueue_bufs = NULL, > + .dequeue_bufs = NULL, > + > + .dump = NULL, > + > + .xstats_get = NULL, > + .xstats_get_names = NULL, > + .xstats_get_by_name = NULL, > + .xstats_reset = NULL, > + > + .firmware_status_get = NULL, > + .firmware_version_get = NULL, > + .firmware_load = ifpga_rawdev_pr, > + .firmware_unload = NULL, > + > + .dev_selftest = NULL, > +}; > + > +static int > +ifpga_rawdev_create(struct rte_pci_device *pci_dev, > + int socket_id) > +{ > + int ret = 0; > + struct rte_rawdev *rawdev = NULL; > + struct ifpga_rawdev *ifpga = NULL; > + char name[RTE_RAWDEV_NAME_MAX_LEN]; > + > + if (!pci_dev) { > + IFPGA_RAWDEV_PMD_ERR("Invalid pci_dev of the device!"); > + ret = -EINVAL; > + goto cleanup; > + } > + > + memset(name, sizeof(name), 0); > + snprintf(name, RTE_RAWDEV_NAME_MAX_LEN, "IFPGA:%x:%x:%x", pci_dev->addr.bus, pci_dev->addr.devid, pci_dev->addr.function); > + > + IFPGA_RAWDEV_PMD_INFO("Init %s on NUMA node %d", name, rte_socket_id()); > + > + /* Allocate device structure */ > + rawdev = rte_rawdev_pmd_allocate(name, sizeof(struct ifpga_rawdev), > + socket_id); > + if (rawdev == NULL) { > + IFPGA_RAWDEV_PMD_ERR("Unable to allocate rawdevice"); > + ret = -EINVAL; > + goto cleanup; > + } > + > + rawdev->dev_ops = &ifpga_rawdev_ops; > + rawdev->device = &pci_dev->device; > + rawdev->driver_name = pci_dev->device.driver->name; > + > + ifpga = ifpga_rawdev_get_priv(rawdev); > + ifpga->pci_dev = pci_dev; > + ifpga->fpga_state = IFPGA_IDLE; > + > + /* Initialize the shared code (base driver) */ > + ret = opae_init_shared_code(&ifpga->hw); > + if (ret) { > + IFPGA_RAWDEV_PMD_ERR("Failed to init shared code (base driver): %d", ret); > + ret = -EINVAL; > + goto cleanup; > + } > + > + return ret; > + > +cleanup: > + if (rawdev) > + rte_rawdev_pmd_release(rawdev); > + > + return ret; > +} > + > +static int > +ifpga_rawdev_destroy(struct rte_pci_device *pci_dev) > +{ > + int ret; > + struct rte_rawdev *rdev; > + char name[RTE_RAWDEV_NAME_MAX_LEN]; > + > + if (!pci_dev) { > + IFPGA_RAWDEV_PMD_ERR("Invalid pci_dev of the device!"); > + ret = -EINVAL; > + return ret; > + } > + > + memset(name, sizeof(name), 0); > + snprintf(name, RTE_RAWDEV_NAME_MAX_LEN, "IFPGA:%x:%x:%x", pci_dev->addr.bus, pci_dev->addr.devid, pci_dev->addr.function); > + > + IFPGA_RAWDEV_PMD_INFO("Closing %s on NUMA node %d", name, rte_socket_id()); > + > + rdev = rte_rawdev_pmd_get_named_dev(name); > + if (!rdev) { > + IFPGA_RAWDEV_PMD_ERR("Invalid device name (%s)", name); > + return -EINVAL; > + } > + > + /* rte_rawdev_close is called by pmd_release */ > + ret = rte_rawdev_pmd_release(rdev); > + if (ret) > + IFPGA_RAWDEV_PMD_DEBUG("Device cleanup failed"); > + > + return 0; > +} > + > +static int > +ifpga_rawdev_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, > + struct rte_pci_device *pci_dev) > +{ > + return ifpga_rawdev_create(pci_dev, rte_socket_id()); > +} > + > +static int ifpga_rawdev_pci_remove(struct rte_pci_device *pci_dev) > +{ > + return ifpga_rawdev_destroy(pci_dev); > +} > + > +static struct rte_pci_driver rte_ifpga_rawdev_pmd = { > + .id_table = pci_ifpga_map, > + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, > + .probe = ifpga_rawdev_pci_probe, > + .remove = ifpga_rawdev_pci_remove, > +}; >>From above, what I understand is that ifpga is a PCI device, but there are certain functions which are not available in PCI rte layer and thus you need a rawdev representation. But I somehow feel that you could have worked without adding another bus type (drivers/bus/ifpga). - PCI devices are scanned by PCI bus. (which is still happening in this RFC patches) - When probing is done, this driver (rawdev/ifpga) would identify and attach itself to those devices (using PCI ids for matching) No other driver would pass the probe because of PCI_TABLE - and then using rawdev APIs, interact with the device. Am I missing some obvious logic here which requires a new bus? > + > +RTE_PMD_REGISTER_PCI(ifpga_rawdev_pci_driver, rte_ifpga_rawdev_pmd); > +RTE_PMD_REGISTER_PCI_TABLE(ifpga_rawdev_pci_driver, rte_ifpga_rawdev_pmd); > +RTE_PMD_REGISTER_KMOD_DEP(ifpga_rawdev_pci_driver, "* igb_uio | uio_pci_generic | vfio-pci"); > + > +RTE_INIT(ifpga_rawdev_init_log); > +static void > +ifpga_rawdev_init_log(void) > +{ > + ifpga_rawdev_logtype = rte_log_register("driver.raw.init"); > + if (ifpga_rawdev_logtype >= 0) > + rte_log_set_level(ifpga_rawdev_logtype, RTE_LOG_NOTICE); > +} > + > +void ifpga_rawdev_test(void) > +{ > + printf("ifpga_rawdev_test \n"); > +} > diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.h b/drivers/raw/ifpga_rawdev/ifpga_rawdev.h > new file mode 100644 > index 0000000..dfa63c6 > --- /dev/null > +++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.h > @@ -0,0 +1,109 @@ > +/*- > + * BSD LICENSE > + * > + * Copyright(c) 2017 Intel Corporation. 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 Intel Corporation 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 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 _IFPGA_RAWDEV_H_ > +#define _IFPGA_RAWDEV_H_ > + > +/*++++++++++++++++++++++++++++++++++These functions should be implemented by OPAE++++++++++++++++++++++++++++++++++*/ > +struct ifpga_hw { > + void *pci_dev; //share code will not involve any DPDK defination > + > + int fme; > + int port[4]; > +}; > + > +static int opae_init_shared_code(struct ifpga_hw *hw) > +{ > + //init ifpga_hw > + > + return 0; > +} > +static int ifpga_enumerate(struct ifpga_hw *hw) > +{ > + return 0; > +} > +static int ifpga_fme_hw_init(struct ifpga_hw *hw) > +{ > + return 0; > +} > +static int ifpga_port_hw_init(struct ifpga_hw *hw, int port_id) > +{ > + return 0; > +} > +static int ifpga_get_afu_mmio_info(struct ifpga_hw *hw, unsigned int port_id, > + struct rte_mem_resource *mem_resource, > + unsigned int *num_resource) > +{ > + return 0; > +} > +static int rte_fpga_do_pr(struct ifpga_hw *afu_dev, int port_id, const char *file_name) > +{ > + return 0; > +} > +/*++++++++++++++++++++++++++++++++++These functions should be implemented by OPAE++++++++++++++++++++++++++++++++++*/ > + > +extern int ifpga_rawdev_logtype; > + > +#define IFPGA_RAWDEV_PMD_LOG(level, fmt, args...) \ > + rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "%s(): " fmt "\n", \ > + __func__, ##args) > + > +#define IFPGA_RAWDEV_PMD_FUNC_TRACE() IFPGA_RAWDEV_PMD_LOG(DEBUG, ">>") > + > +#define IFPGA_RAWDEV_PMD_DEBUG(fmt, args...) \ > + IFPGA_RAWDEV_PMD_LOG(DEBUG, fmt, ## args) > +#define IFPGA_RAWDEV_PMD_INFO(fmt, args...) \ > + IFPGA_RAWDEV_PMD_LOG(INFO, fmt, ## args) > +#define IFPGA_RAWDEV_PMD_ERR(fmt, args...) \ > + IFPGA_RAWDEV_PMD_LOG(ERR, fmt, ## args) > +#define IFPGA_RAWDEV_PMD_WARN(fmt, args...) \ > + IFPGA_RAWDEV_PMD_LOG(WARNING, fmt, ## args) > + > +enum ifpga_rawdev_device_state { > + IFPGA_IDLE, > + IFPGA_READY, > + IFPGA_ERROR > +}; > + > +struct ifpga_rawdev { > + struct ifpga_hw hw; > + struct rte_pci_device *pci_dev; > + enum ifpga_rawdev_device_state fpga_state; > +}; > + > +static inline struct ifpga_rawdev * > +ifpga_rawdev_get_priv(const struct rte_rawdev *rawdev) > +{ > + return rawdev->dev_private; > +} > + > +#endif /* _IFPGA_RAWDEV_H_ */ > diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev_example.c b/drivers/raw/ifpga_rawdev/ifpga_rawdev_example.c > new file mode 100644 > index 0000000..c506c0e > --- /dev/null > +++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev_example.c > @@ -0,0 +1,121 @@ > +/*- > + * BSD LICENSE > + * > + * Copyright(c) 2017 Intel Corporation. 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 Intel Corporation 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 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 > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > + > +#include "rte_bus_ifpga.h" > +#include "ifpga_logs.h" > + > +#define RTE_PMD_REGISTER_AFU(nm, afudrv)\ > +RTE_INIT(afudrvinitfn_ ##afudrv);\ > +static const char *afudrvinit_ ## nm ## _alias;\ > +static void afudrvinitfn_ ##afudrv(void)\ > +{\ > + (afudrv).driver.name = RTE_STR(nm);\ > + (afudrv).driver.alias = afudrvinit_ ## nm ## _alias;\ > + rte_ifpga_driver_register(&afudrv);\ > +} \ > +RTE_PMD_EXPORT_NAME(nm, __COUNTER__) > + > +#define RTE_PMD_REGISTER_AFU_ALIAS(nm, alias)\ > +static const char *afudrvinit_ ## nm ## _alias = RTE_STR(alias) > + > +static int afu_dev_probe(struct rte_afu_device *afu_dev) > +{ > + return 0; > +} > +static int afu_dev_remove(struct rte_afu_device *afu_dev) > +{ > + return 0; > +} > + > +static struct rte_afu_driver afu_dev_driver = { > + .probe = afu_dev_probe, > + .remove = afu_dev_remove, > +}; > + > +RTE_PMD_REGISTER_AFU(net_afu_drv_example, afu_dev_driver); > +RTE_PMD_REGISTER_AFU_ALIAS(net_afu_drv_example, afu_dev); > +RTE_PMD_REGISTER_PARAM_STRING(net_afu_drv_example, > + "bdf= " > + "port= " > + "uudi_high= " > + "uuid_low= " > + "path= " > + "pr_enable=" > + "debug="); > diff --git a/drivers/raw/ifpga_rawdev/rte_pmd_ifpga_rawdev_version.map b/drivers/raw/ifpga_rawdev/rte_pmd_ifpga_rawdev_version.map > new file mode 100644 > index 0000000..179140f > --- /dev/null > +++ b/drivers/raw/ifpga_rawdev/rte_pmd_ifpga_rawdev_version.map > @@ -0,0 +1,4 @@ > +DPDK_18.02 { Will be 18.05 > + > + local: *; > +}; > -- > 1.8.3.1 >