From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id C68712BC7 for ; Tue, 6 Mar 2018 02:42:51 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Mar 2018 17:42:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,429,1515484800"; d="scan'208";a="31631362" Received: from dpdkx8602.sh.intel.com ([10.67.110.200]) by FMSMGA003.fm.intel.com with ESMTP; 05 Mar 2018 17:42:50 -0800 From: Rosen Xu To: dev@dpdk.org Cc: declan.doherty@intel.com, tianfei.zhang@intel.com Date: Tue, 6 Mar 2018 09:43:58 +0800 Message-Id: <1520300638-134954-5-git-send-email-rosen.xu@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1520300638-134954-1-git-send-email-rosen.xu@intel.com> References: <1520300638-134954-1-git-send-email-rosen.xu@intel.com> Subject: [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 01:42:52 -0000 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 ++++++++ .../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. + +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 + +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. + * + * 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, +}; + +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 { + + local: *; +}; -- 1.8.3.1