On Tue, Nov 27, 2018 at 05:59:48AM +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 > > For further details, please refer to https://github.com/KastnerRG/riffa/pull/31 > > Signed-off-by: Cheng Fei Phung <feiphung@xxxxxxxxxxx> > > --- > 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 000000000000..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 n is always the default, no need to put it :) Also, you have no dependancies at all? Not even PCI? I think PCI is needed here or the build will blow up on non-pci systems, right? And please use tabs in this file. > + 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 000000000000..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 000000000000..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 <gregkh@xxxxxxxxxxxxxxxxxxx> > +and Phung Cheng Fei <feiphung@xxxxxxxxxxx> > diff --git a/drivers/staging/riffa/circ_queue.c b/drivers/staging/riffa/circ_queue.c > new file mode 100644 > index 000000000000..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 > + * Author: Matthew Jacobsen > + * History: @mattj: Initial release. Version 1.0. > + */ > + > +#include <linux/slab.h> > +#include "circ_queue.h" > + > +circ_queue * init_circ_queue(int len) > +{ > + int i; > + circ_queue * q; > + > + q = kzalloc(sizeof(circ_queue), GFP_KERNEL); > + if (q == NULL) { > + printk(KERN_ERR "Not enough memory to allocate circ_queue"); > + return NULL; > + } > + > + atomic_set(&q->writeIndex, 0); > + atomic_set(&q->readIndex, 0); > + q->len = len; > + > + q->vals = (unsigned int**) kzalloc(len*sizeof(unsigned int*), GFP_KERNEL); Did you happen to run scripts/checkpatch.pl on the patch before you sent it in? It should have caught this trailing space (and others in the file.) It's not a big deal, I can take it, but just note that people will start to fix these things up. How do you want to proceed? thanks, greg k-h _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel