From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com [74.125.82.44]) by dpdk.org (Postfix) with ESMTP id 5AEAF4F93 for ; Wed, 21 Mar 2018 11:20:41 +0100 (CET) Received: by mail-wm0-f44.google.com with SMTP id t7so8655640wmh.5 for ; Wed, 21 Mar 2018 03:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=7oQhrKyKqLFZVZY/wkT9qDZX/XPkxTi4zHN9IKx8ovc=; b=F8KVoRYt7yucIkk+40WmZzMgQ/uoMNfhxmjH3wUBlh2kPTY0wKJfAcK3etjH1Hhzp0 2/y3UOu3HUqiFISmxCYv4xB4BvmqmgJOtBgt6auOPSXP3tGKdijQXs5q8uHg1GCEU7/r w7Rf9K41veH7eb5c0fDlmgGVCf4dVhoxrt/bhEEg/r3KJAQBmMZNfk51T9H9np/eTsZv cL04GJGf9v37Zw8vdcx67mU0PD4KtpLJGScMMd1qKAfL8wfxAHx4DxpanX62KYKYSujZ osXf1eDwbGnKJblJmngbOdYgo4hAIr1gmFFlm1cMUOZV71QJIDoasxMr/EWouWaPcUY+ 0rVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=7oQhrKyKqLFZVZY/wkT9qDZX/XPkxTi4zHN9IKx8ovc=; b=Fzk1Gu0NpFMlAhasOK1+vDalbWo9gCjwf5luZIMcRy7jejoCV+GFCzhAE9vrMUjVqL CpCg2F2bOXvJtY8gJWuNC5RQvu1Kg7lCcD5+XnT/ZxdqYlN0yRv153z/oRSbXFjvLS1j RVZiKZOPNTNUFYuoLJyjQxWKoRsMbwVnXIVDSfYZVtPMeCETsBtbjIsPbXzCqHf35swE TsPDaDTYSq9kE0TcK7a4jqk7LtX75OPgIA82cvIS+IkC/O/q3ldpXZ8zpGuGwucGdcml VEheG/YaBPk7WG4sxyhCE897/B2XjF4aOoC0LB/5AYROiaUJ2FINcM+u2PjUuNCp+3wQ u9EA== X-Gm-Message-State: AElRT7Hjq3Q1c0y02Lk9/lT417KVt01kpJBFtbHOpft4+sDr/tb97Ioa WW+fPsgzULzEE0CnyTfLCOJehw== X-Google-Smtp-Source: AG47ELtRtd+KSaPV6Sftc5niI0wj/e7chr5l07nCWd5zbP6jx7sIJgJJb+Pv/qL2jOrw9ZukOQeKuQ== X-Received: by 10.28.5.198 with SMTP id 189mr2064395wmf.155.1521627641039; Wed, 21 Mar 2018 03:20:41 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id y68sm4063420wrb.73.2018.03.21.03.20.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 21 Mar 2018 03:20:40 -0700 (PDT) Date: Wed, 21 Mar 2018 11:20:25 +0100 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Rosen Xu Cc: dev@dpdk.org, declan.doherty@intel.com, bruce.richardson@intel.com, shreyansh.jain@nxp.com, tianfei.zhang@intel.com, hao.wu@intel.com Message-ID: <20180321102025.v2zeijxrsauuvkss@bidouze.vm.6wind.com> References: <1521618694-140757-1-git-send-email-rosen.xu@intel.com> <1521618694-140757-4-git-send-email-rosen.xu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1521618694-140757-4-git-send-email-rosen.xu@intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH V2 3/5] Add Intel FPGA BUS Lib Code 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: Wed, 21 Mar 2018 10:20:42 -0000 Hi, I have had issues compiling a few things here, have you checked build status before submitting? On Wed, Mar 21, 2018 at 03:51:32PM +0800, Rosen Xu wrote: > Signed-off-by: Rosen Xu > --- > drivers/bus/ifpga/Makefile | 64 ++++ > drivers/bus/ifpga/ifpga_bus.c | 573 ++++++++++++++++++++++++++++ > drivers/bus/ifpga/ifpga_common.c | 154 ++++++++ > drivers/bus/ifpga/ifpga_common.h | 25 ++ > drivers/bus/ifpga/ifpga_logs.h | 32 ++ > drivers/bus/ifpga/rte_bus_ifpga.h | 141 +++++++ > drivers/bus/ifpga/rte_bus_ifpga_version.map | 8 + > 7 files changed, 997 insertions(+) > create mode 100644 drivers/bus/ifpga/Makefile > create mode 100644 drivers/bus/ifpga/ifpga_bus.c > create mode 100644 drivers/bus/ifpga/ifpga_common.c > create mode 100644 drivers/bus/ifpga/ifpga_common.h > create mode 100644 drivers/bus/ifpga/ifpga_logs.h > create mode 100644 drivers/bus/ifpga/rte_bus_ifpga.h > create mode 100644 drivers/bus/ifpga/rte_bus_ifpga_version.map > > diff --git a/drivers/bus/ifpga/Makefile b/drivers/bus/ifpga/Makefile > new file mode 100644 > index 0000000..c71f186 > --- /dev/null > +++ b/drivers/bus/ifpga/Makefile > @@ -0,0 +1,64 @@ > +# 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. Please use SPDX tags here instead. > + > +include $(RTE_SDK)/mk/rte.vars.mk > + > +# > +# library name > +# > +LIB = librte_bus_ifpga.a > +LIBABIVER := 1 > +EXPORT_MAP := rte_bus_ifpga_version.map > + > +ifeq ($(CONFIG_RTE_LIBRTE_DPAA2_DEBUG_INIT),y) C/C issue, you probably do not want to rely on a DPAA option. > +CFLAGS += -O0 -g > +CFLAGS += "-Wno-error" > +else > +CFLAGS += -O3 > +CFLAGS += $(WERROR_FLAGS) > +endif > + > +CFLAGS += -I$(RTE_SDK)/drivers/bus/ifpga > +CFLAGS += -I$(RTE_SDK)/drivers/bus/pci It is not okay to directly include PCI elements. Either you use the public PCI API, or you make the elements you need public (with proper versioning), or you come up with a different scheme. But you cannot directly include the PCI bus. > +CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal > +CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common > +#CFLAGS += -I$(RTE_SDK)/lib/librte_rawdev > +#LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring -lrte_rawdev Please clean-up those commented lines. > +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring > +#LDLIBS += -lrte_ethdev Same here. > + > +VPATH += $(SRCDIR)/base > + > +SRCS-y += \ > + ifpga_bus.c \ > + ifpga_common.c > + > +include $(RTE_SDK)/mk/rte.lib.mk > diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c > new file mode 100644 > index 0000000..ff72b74 > --- /dev/null > +++ b/drivers/bus/ifpga/ifpga_bus.c > @@ -0,0 +1,573 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2010-2014 Intel Corporation. > + * Copyright 2013-2014 6WIND S.A. Copy-paste error. > + */ > + > +#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_logs.h" > +#include "ifpga_common.h" > + > +int ifpga_bus_logtype; > + > +/*register a ifpga bus based driver */ > +void rte_ifpga_driver_register(struct rte_afu_driver *driver) > +{ > + RTE_VERIFY(driver); > + > + TAILQ_INSERT_TAIL(&rte_ifpga_bus.driver_list, driver, next); > +} > + > +/*un-register a fpga bus based driver */ > +void rte_ifpga_driver_unregister(struct rte_afu_driver *driver) > +{ > + TAILQ_REMOVE(&rte_ifpga_bus.driver_list, driver, next); > +} > + > +static struct rte_ifpga_device * > +ifpga_find_ifpga_dev(const struct rte_pci_addr *pci_addr) > +{ > + struct rte_ifpga_device *ifpga_dev = NULL; > + > + TAILQ_FOREACH(ifpga_dev, &rte_ifpga_bus.ifpga_list, next) { > + if (!ifpga_pci_addr_cmp_1(&ifpga_dev->pci_addr, pci_addr)) > + return ifpga_dev; > + } > + return NULL; > +} > + > +static struct rte_afu_device * > +ifpga_find_afu_dev(const struct rte_afu_id *afu_id) > +{ > + struct rte_afu_device *afu_dev = NULL; > + > + TAILQ_FOREACH(afu_dev, &rte_ifpga_bus.afu_list, next) { > + if (!ifpga_afu_id_cmp(&afu_dev->id, afu_id)) > + return afu_dev; > + } > + return NULL; > +} > + > +static const char *valid_args[] = { > +#define IFPGA_ARG_BDF "bdf" > + IFPGA_ARG_BDF, > +#define IFPGA_ARG_PORT "port" > + IFPGA_ARG_PORT, > +#define IFPGA_ARG_PATH "path" > + IFPGA_ARG_PATH, > +#define IFPGA_ARG_UUID_HIGH "uuid_high" > + IFPGA_ARG_UUID_HIGH, > +#define IFPGA_ARG_UUID_LOW "uuid_low" > + IFPGA_ARG_UUID_LOW, > +#define IFPGA_ARG_PR_ENABLE "pr_enable" > + IFPGA_ARG_PR_ENABLE, > +#define IFPGA_ARG_DEBUG "debug" > + IFPGA_ARG_DEBUG, > + NULL > +}; > + > +/* > + * Scan the content of the FPGA bus, and the devices in the devices > + * list > + */ So you seem to scan your bus by reading parameters given to the --ifpga EAL option. Can you justify why you cannot use the PCI bus, have your FPGA be probed by a PCI driver, that would take those parameters as driver parameters, and spawn raw devices (one per bitstream) as needed as a result? I see no reason this is not feasible. Unless you duly justify this approach, it seems unacceptable to me. You are subverting generic EAL code to bend things to your approach, without clear rationale. Best regards, -- Gaëtan Rivet 6WIND