[PATCH] Staging : Add RIFFA PCIe driver
This patch adds RIFFA PCIe linux driver for https://github.com/promach/riffa/tree/full_duplex/driver/linux This staging driver is modified from this upstream driver at https://github.com/KastnerRG/riffa/tree/master/driver/linux For further details, please refer to https://github.com/KastnerRG/riffa/pull/31 Signed-off-by: Cheng Fei Phung --- Changes in v1: - added full-duplex capability drivers/staging/riffa/Kconfig|5 + drivers/staging/riffa/Makefile |1 + drivers/staging/riffa/TODO |7 + drivers/staging/riffa/circ_queue.c | 188 +++ drivers/staging/riffa/circ_queue.h | 96 ++ drivers/staging/riffa/riffa.c| 152 +++ drivers/staging/riffa/riffa.h| 121 ++ drivers/staging/riffa/riffa_driver.c | 1643 ++ drivers/staging/riffa/riffa_driver.h | 131 ++ 9 files changed, 2344 insertions(+) create mode 100644 drivers/staging/riffa/Kconfig create mode 100644 drivers/staging/riffa/Makefile create mode 100644 drivers/staging/riffa/TODO create mode 100644 drivers/staging/riffa/circ_queue.c create mode 100644 drivers/staging/riffa/circ_queue.h create mode 100644 drivers/staging/riffa/riffa.c create mode 100644 drivers/staging/riffa/riffa.h create mode 100644 drivers/staging/riffa/riffa_driver.c create mode 100644 drivers/staging/riffa/riffa_driver.h diff --git a/drivers/staging/riffa/Kconfig b/drivers/staging/riffa/Kconfig new file mode 100644 index ..afe5beee1882 --- /dev/null +++ b/drivers/staging/riffa/Kconfig @@ -0,0 +1,5 @@ +config RIFFA_PCIE +tristate "a simple framework for communicating data from a host CPU to a FPGA via a PCI Express bus" +default n +help +Transfers data with full duplex capability using PCIe protocol diff --git a/drivers/staging/riffa/Makefile b/drivers/staging/riffa/Makefile new file mode 100644 index ..79ef3b9b8c8f --- /dev/null +++ b/drivers/staging/riffa/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_RIFFA) += riffa.o circ_queue.o riffa_driver.o riffa_mod.o diff --git a/drivers/staging/riffa/TODO b/drivers/staging/riffa/TODO new file mode 100644 index ..5f1b0287cb52 --- /dev/null +++ b/drivers/staging/riffa/TODO @@ -0,0 +1,7 @@ +TODO: +- optimize the driver code for further speed improvement although it can now achieve defined PCIe speed grade +- solve all the coding style errors from scripts/checkpatch.pl +- add vendor and device IDs for more supported devices after actual hardware testing + +Please send any patches to Greg Kroah-Hartman +and Phung Cheng Fei diff --git a/drivers/staging/riffa/circ_queue.c b/drivers/staging/riffa/circ_queue.c new file mode 100644 index ..fb43ca22e3c0 --- /dev/null +++ b/drivers/staging/riffa/circ_queue.c @@ -0,0 +1,188 @@ +// -- +// Copyright (c) 2016, The Regents of the University of California 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 The Regents of the University of California +// 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 REGENTS OF THE +// UNIVERSITY OF CALIFORNIA 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. +// -- + +/* + * Filename: circ_queue.c + * Version: 1.0 + * Description: A lock-free single-producer circular queue implementation + * modeled after the more elaborate C++ version from Faustino Frechilla at: + * http://www.codeproject.com/Articles/153898/Yet-another-implementation-of-a-lock-free-circular + * Auth
[PATCH] Staging : Add RIFFA PCIe staging driver
This patch adds RIFFA PCIe linux driver for https://github.com/promach/riffa/tree/full_duplex/driver/linux This staging driver is modified from this upstream driver at https://github.com/KastnerRG/riffa/tree/master/driver/linux For further details, please refer to https://github.com/KastnerRG/riffa/pull/31 Signed-off-by: Cheng Fei Phung --- Changes in v1: - added full-duplex capability drivers/staging/riffa/Kconfig|5 + drivers/staging/riffa/Makefile |1 + drivers/staging/riffa/TODO |7 + drivers/staging/riffa/circ_queue.c | 188 +++ drivers/staging/riffa/circ_queue.h | 96 ++ drivers/staging/riffa/riffa.c| 152 +++ drivers/staging/riffa/riffa.h| 121 ++ drivers/staging/riffa/riffa_driver.c | 1643 ++ drivers/staging/riffa/riffa_driver.h | 131 ++ 9 files changed, 2344 insertions(+) create mode 100644 drivers/staging/riffa/Kconfig create mode 100644 drivers/staging/riffa/Makefile create mode 100644 drivers/staging/riffa/TODO create mode 100644 drivers/staging/riffa/circ_queue.c create mode 100644 drivers/staging/riffa/circ_queue.h create mode 100644 drivers/staging/riffa/riffa.c create mode 100644 drivers/staging/riffa/riffa.h create mode 100644 drivers/staging/riffa/riffa_driver.c create mode 100644 drivers/staging/riffa/riffa_driver.h diff --git a/drivers/staging/riffa/Kconfig b/drivers/staging/riffa/Kconfig new file mode 100644 index ..b8fa2d51fbc0 --- /dev/null +++ b/drivers/staging/riffa/Kconfig @@ -0,0 +1,5 @@ +config RIFFA_PCIE + tristate "a simple framework for communicating data from a host CPU to a FPGA via a PCI Express bus" + depends on PCI + ---help--- + Transfers data with full duplex capability using PCIe protocol diff --git a/drivers/staging/riffa/Makefile b/drivers/staging/riffa/Makefile new file mode 100644 index ..79ef3b9b8c8f --- /dev/null +++ b/drivers/staging/riffa/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_RIFFA) += riffa.o circ_queue.o riffa_driver.o riffa_mod.o diff --git a/drivers/staging/riffa/TODO b/drivers/staging/riffa/TODO new file mode 100644 index ..5f13b32a1f91 --- /dev/null +++ b/drivers/staging/riffa/TODO @@ -0,0 +1,7 @@ +TODO: +- optimize the driver code for further speed improvement although it can now achieve defined PCIe speed grade +- solve all the coding style errors from scripts/checkpatch.pl +- add vendor and device IDs for more supported devices after actual hardware testing + +Please send any patches to Greg Kroah-Hartman +and Cheng Fei Phung diff --git a/drivers/staging/riffa/circ_queue.c b/drivers/staging/riffa/circ_queue.c new file mode 100644 index ..fb43ca22e3c0 --- /dev/null +++ b/drivers/staging/riffa/circ_queue.c @@ -0,0 +1,188 @@ +// -- +// Copyright (c) 2016, The Regents of the University of California 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 The Regents of the University of California +// 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 REGENTS OF THE +// UNIVERSITY OF CALIFORNIA 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. +// -- + +/* + * Filename: circ_queue.c + * Version: 1.0 + * Description: A lock-free single-producer circular queue implementation + * modeled after the more elaborate C++ version from Faustino Frechilla at: + * http://www.codeproject.com/Articles/153898/Yet-another-implementation-of-a-lock-free
Re: [PATCH] v2 Staging : Add RIFFA PCIe staging driver
> For further details, please refer to > https://github.com/KastnerRG/riffa/pull/31 > That is not permanent, please provide the details here. This patch helps to enable bi-directional PCIe communication at PCIe gen2 speed grade Major change in this patch is the enabling of chnl_recv() scatter-gather list first in the case of loopback, as you can see in https://github.com/promach/riffa/blob/full_duplex/driver/linux/riffa_driver.c#L832-L836 Some other changes include splitting TX and RX into two separate FSMs in two always blocks as you can see in chnl_tester.v Also, I need to give credit to @marzoul for maintaining the kernel functions which I have already included in this patch altogether. However, this patch degrades bandwidth measurement result with respect to Xillybus and riffa original driver (slower with an approximate factor of 3 at the same given data batch length) > Please fix this all up and submit a v3, after at least commenting on the > things asked previously. Please allows time to clear up my confusion first regarding the following questions about subvendor ID and subdevice ID before v3 patch submission > Also, you still have this line which prevents me from being able to > accept this patch, as I talked about previously: > + {PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)}, > Do NOT just bind to all PCI devices from a vendor, that will break other > drivers in the system. This line is for subvendor ID and subdevice ID. I do not think lspci helps here. Could you suggest how to get around PCI_ANY_ID for subdevice ID ? Same question for subvendor ID. phung@UbuntuHW15:~/riffa_backup/driver/linux$ sudo locate -b "pci.ids" /usr/share/hwdata/pci.ids /usr/share/misc/pci.ids phung@UbuntuHW15:~/riffa_backup/driver/linux$ cat /usr/share/hwdata/pci.ids | grep pci # the PCI ID Project at http://pci-ids.ucw.cz/. a000 Psycho UPA-PCI Bus Module [pcipsy] a001 Psycho UPA-PCI Bus Module [pcipsy] a801 Schizo Fireplane-PCI bus bridge module [pcisch] 1113 8201 T-Com T-Sinus 154pcicard Wireless PCI Adapter phung@UbuntuHW15:~/riffa_backup/driver/linux$ cat /usr/share/misc/pci.ids | grep pci # the PCI ID Project at http://pci-ids.ucw.cz/. a000 Psycho UPA-PCI Bus Module [pcipsy] a001 Psycho UPA-PCI Bus Module [pcipsy] a801 Schizo Fireplane-PCI bus bridge module [pcisch] 1113 8201 T-Com T-Sinus 154pcicard Wireless PCI Adapter phung@UbuntuHW15:~/riffa_backup/driver/linux$ > Also, do not use a random MAJOR number that you just picked out of no > where, that too will break working systems and needs to be fixed. Use > the dynamic allocation method, or better yet, just use a misc device. What do you exactly mean by misc device ? > How do you plan to proceed ? please keep the driver in the staging state until it can really match Xillybus or Riffa original driver's bandwidth benchmark. I am actually a bit worried with circ_queue structure and its corresponding push() and pull() functions which systemtap complains to have some significant timing overhead, but to be frank, this is not the root cause of why the full duplex version of the driver is slower. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] v2 Staging : Add RIFFA PCIe staging driver
> > Also, do not use a random MAJOR number that you just picked out of no > > where, that too will break working systems and needs to be fixed. Use > > the dynamic allocation method, or better yet, just use a misc device. > > What do you exactly mean by misc device ? > Look at include/linux/miscdevice.h for the details. I will study http://www.embeddedlinux.org.cn/essentiallinuxdevicedrivers/final/ch05lev1sec7.html on my own. I am still working on the hardware verilog side now. > I am actually a bit worried with circ_queue structure and its corresponding > push() and pull() functions which systemtap complains to have some > significant timing overhead, but to be frank, this is not the root cause of > why the full duplex version of the driver is slower. > Yes, that's kind of obvious by looking at that code :) > Again, fix up the driver to use the in-kernel data structures for this > type of thing and you will see a much better improvement in performance. To be frank, the 3x slowdown is actually due to "one extra wake_up() call" in the full-duplex version of riffa_driver.c line 685 if I am not wrong. https://github.com/promach/riffa/blob/full_duplex/driver/linux/riffa_driver.c#L685 If I use https://www.kernel.org/doc/html/v4.19/core-api/circular-buffers.html#the-producer instead of https://github.com/promach/riffa/blob/full_duplex/driver/linux/circ_queue.c , I actually worry that the in-kernel data structure with memory barrier can actually have more timing delay or overhead than atomic functions used in circ_queue.c Please advise regarding wake_up(consumer). ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Add RIFFA PCIe driver to staging tree
Patch changelog content: Add a PCIe linux driver called RIFFA to the linux staging tree. It has full duplex capability compared to the original RIFFA linux driver that you can easily find from https://github.com/KastnerRG/riffa/tree/master/driver/linux For more context, please refer to https://github.com/promach/riffa/tree/full_duplex/driver/linux phung@UbuntuHW15:~/linux$ cat patches/0001-Added-a-full-duplex-riffa-PCIe-linux-staging-driver..patch >From 7c3050c7e86017d85c75c640ea38376f505b2763 Mon Sep 17 00:00:00 2001 From: promach Date: Mon, 15 Oct 2018 18:28:16 +0800 Subject: [PATCH] Added a full duplex riffa PCIe linux staging driver. Signed-off-by: PHUNG CHENG FEI (feiph...@hotmail.com) --- drivers/staging/riffa/Makefile | 157 +++ drivers/staging/riffa/README.txt | 38 + drivers/staging/riffa/circ_queue.c | 188 +++ drivers/staging/riffa/circ_queue.h | 96 ++ drivers/staging/riffa/riffa.c | 152 +++ drivers/staging/riffa/riffa.h | 121 ++ drivers/staging/riffa/riffa_driver.c | 1633 ++ drivers/staging/riffa/riffa_driver.h | 131 +++ 8 files changed, 2516 insertions(+) create mode 100644 drivers/staging/riffa/Makefile create mode 100644 drivers/staging/riffa/README.txt create mode 100644 drivers/staging/riffa/circ_queue.c create mode 100644 drivers/staging/riffa/circ_queue.h create mode 100644 drivers/staging/riffa/riffa.c create mode 100644 drivers/staging/riffa/riffa.h create mode 100644 drivers/staging/riffa/riffa_driver.c create mode 100644 drivers/staging/riffa/riffa_driver.h diff --git a/drivers/staging/riffa/Makefile b/drivers/staging/riffa/Makefile new file mode 100644 index ..3e3cb0c4a387 --- /dev/null +++ b/drivers/staging/riffa/Makefile @@ -0,0 +1,157 @@ +# -- +# Copyright (c) 2016, The Regents of the University of California 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 The Regents of the University of California +# 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 REGENTS OF THE +# UNIVERSITY OF CALIFORNIA 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. +# -- + +# Filename: Makefile +# Version: 2.0 +# Description: Makefile for Linux PCIe device driver for RIFFA. +# Author: Matthew Jacobsen +# History: @mattj: Initial release. Version 2.0. + +# You must specify the following variables. You can leave the defaults if you +# like, but make sure they will work in your system. +# The VENDOR_ID _must_ match what is configured on your FPGA's PCIe endpoint +# header. Xilinx has a VENDOR_ID = 10EE. +NAME := riffa +VENDOR_ID0 := 10EE +VENDOR_ID1 := 1172 +MAJNUM := 100 + +# Build variables +KVER := $(shell uname -r) +KDIR := /lib/modules/`uname -r`/build +RHR := /etc/redhat-release +LIB_SRCS := riffa.c +LIB_OBJS := $(patsubst %.c,%.o,$(LIB_SRCS)) +LIB_HDR := riffa.h +LIB_VER_MAJ := 1 +LIB_VER_MIN := 0 +LIB_VER := $(LIB_VER_MAJ).$(LIB_VER_MIN) +DRVR_HDR := riffa_driver.h +DBUGVAL := DBUG + +obj-m += $(NAME).o +$(NAME)-y := riffa_driver.o circ_queue.o + +# Helper functions +define assert + $(if $1,,$(error Assertion failed: $2)) +endef +define assert-not-null + $(call assert,$($1),The variable "$1" is null, please specify it.) +endef +define assert-variables + $(call assert-not-null,NAME) + $(call assert-not-null,MAJNUM) + $(call assert-not-null,VENDOR_ID0) + $(call assert-not-null,VENDOR_ID1) + @printf "Compiling driver for kernel: %s with the following values\n" $(KVER) + @printf " NAME: '%s'\n"
[PATCH] Staging : Add RIFFA PCIe driver
This patch adds RIFFA PCIe linux driver for https://github.com/promach/riffa/tree/full_duplex/driver/linux This staging driver is modified from this upstream driver at https://github.com/KastnerRG/riffa/tree/master/driver/linux Signed-off-by: PHUNG CHENG FEI --- Changes in v1: - added full-duplex capability drivers/staging/riffa/Kconfig|5 + drivers/staging/riffa/Makefile |1 + drivers/staging/riffa/TODO |6 + drivers/staging/riffa/circ_queue.c | 195 +++ drivers/staging/riffa/circ_queue.h | 96 ++ drivers/staging/riffa/riffa.c| 151 +++ drivers/staging/riffa/riffa.h| 121 ++ drivers/staging/riffa/riffa_driver.c | 1881 ++ drivers/staging/riffa/riffa_driver.h | 125 ++ 9 files changed, 2581 insertions(+) create mode 100644 drivers/staging/riffa/Kconfig create mode 100644 drivers/staging/riffa/Makefile create mode 100644 drivers/staging/riffa/TODO create mode 100644 drivers/staging/riffa/circ_queue.c create mode 100644 drivers/staging/riffa/circ_queue.h create mode 100644 drivers/staging/riffa/riffa.c create mode 100644 drivers/staging/riffa/riffa.h create mode 100644 drivers/staging/riffa/riffa_driver.c create mode 100644 drivers/staging/riffa/riffa_driver.h diff --git a/drivers/staging/riffa/Kconfig b/drivers/staging/riffa/Kconfig new file mode 100644 index ..afe5beee1882 --- /dev/null +++ b/drivers/staging/riffa/Kconfig @@ -0,0 +1,5 @@ +config RIFFA_PCIE +tristate "a simple framework for communicating data from a host CPU to a FPGA via a PCI Express bus" +default n +help +Transfers data with full duplex capability using PCIe protocol diff --git a/drivers/staging/riffa/Makefile b/drivers/staging/riffa/Makefile new file mode 100644 index ..79ef3b9b8c8f --- /dev/null +++ b/drivers/staging/riffa/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_RIFFA) += riffa.o circ_queue.o riffa_driver.o riffa_mod.o diff --git a/drivers/staging/riffa/TODO b/drivers/staging/riffa/TODO new file mode 100644 index ..0088eef3b282 --- /dev/null +++ b/drivers/staging/riffa/TODO @@ -0,0 +1,6 @@ +TODO: +- optimize the driver code for further speed improvement although it can now achieve defined PCIe speed grade +- solve all the coding style errors from scripts/checkpatch.pl + +Please send any patches to Greg Kroah-Hartman +and Phung Cheng Fei diff --git a/drivers/staging/riffa/circ_queue.c b/drivers/staging/riffa/circ_queue.c new file mode 100644 index ..97ac856bab95 --- /dev/null +++ b/drivers/staging/riffa/circ_queue.c @@ -0,0 +1,195 @@ +// -- +// Copyright (c) 2016, The Regents of the University of California 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 The Regents of the University of California +// 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 REGENTS OF THE +// UNIVERSITY OF CALIFORNIA 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. +// -- + +/* + * Filename: circ_queue.c + * Version: 1.0 + * Description: A lock-free single-producer circular queue implementation + * modeled after the more elaborate C++ version from Faustino Frechilla at: + * http://www.codeproject.com/Articles/153898/Yet-another-implementation-of-a-lock-free-circular + * Author: Matthew Jacobsen + * History: @mattj: Initial release. Version 1.0. + */ + +#include +#include "circ_queue.h" + +circ_queue *init_circ_queue(int len) +{ + int i; + circ_queue *q; +
Re: [PATCH] Staging : Add RIFFA PCIe driver
Hi, if I only have one particular hardware (Altera DE4 FPGA) that I could test with (there are a bunch of hardware boards that RIFFA supports as you can see from https://github.com/KastnerRG/riffa/blob/master/fpga/altera/Makefile#L42 and https://github.com/KastnerRG/riffa/blob/master/fpga/xilinx/Makefile#L42-L43 ), what could I do in this case ? I do not understand what you exactly mean by "72 columns" ? Regards, Cheng Fei From: gre...@linuxfoundation.org Sent: Wednesday, November 7, 2018 7:59 PM To: Cheng Fei Phung Cc: de...@driverdev.osuosl.org Subject: Re: [PATCH] Staging : Add RIFFA PCIe driver On Mon, Oct 22, 2018 at 03:41:05AM +0000, Cheng Fei Phung wrote: > This patch adds RIFFA PCIe linux driver for > https://github.com/promach/riffa/tree/full_duplex/driver/linux > This staging driver is modified from this upstream driver at > https://github.com/KastnerRG/riffa/tree/master/driver/linux Please properly line-wrap your changelog text at 72 columns when you can. > > Signed-off-by: PHUNG CHENG FEI No need to put your name in ALL CAPS. It should also match your from: line in the email header, which it does not here. There's lots to fix up in this code, and normally that is fine, but I can't take the driver right now because of these lines: > +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) > +static DEFINE_PCI_DEVICE_TABLE(fpga_ids) = > +#else > +static const struct pci_device_id fpga_ids[] = > +#endif > + { > + { PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID) }, > + { PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID) }, > + { 0 }, > + }; > + > +MODULE_DEVICE_TABLE(pci, fpga_ids); You are grabbing ALL pci devices from these two vendors (Xilinx and Altera). That will instantly break any of the existing kernel drivers for any random device from those vendors by having this driver bind to the device instead. And that's not ok, you can not break working systems, sorry. Please be very specific and only have the driver bind to the correct hardware devices. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel