Showing results for 
Show  only  | Search instead for 
Did you mean: 
Registered: ‎07-31-2018

Xilinx PCI Express DMA Drivers and Software Guide 65444 nonblocking functionality


The Xilinx PCI Express DMA Drivers provided here work pretty well but there appears to be some missing functionality for nonblocking reads.  I'm using with Linux Centos 7 and have enable_credit_mp=1.  I have PCIe streaming setup from the FPGA, this works when there is data, but falls apart when reading and 0 bytes are returned.

In the driver there is no implementation of file_operations .poll   which would be used by sys/select or sys/poll.  So the file descriptor is always set in currentReadFdSet  for the following select() call in software.  A timeout was expected here when no data was available as currentReadFdSet only contains one fd for the /dev/xdma0.

 select ((nsfd + 1) , &currentReadFdSet, NULL, NULL, &timeoutPeriod)

Secondly nowhere in the code are the file->f_flags evaluated.  There should be checks for O_NONBLOCK in the read functionality and the driver should return -EAGAIN when there is no data on a nonblocking read.

Is the driver setup for nonblocking operations?  because it appears not to be the case.

I ran an experiment using this website (files are attached)

If I comment out the testdriver_poll from file_operations like this, then select always returns true and it tries to read the data when none is available.

static struct file_operations testdriver_fops =
.owner = THIS_MODULE,
.open = testdriver_open,
.release = testdriver_close,
.read = testdriver_read,
.write = testdriver_write,
// .poll = testdriver_poll

If it is in place I only read data when it is available, the check for NONBLOCK in the read code when bytes=0 is not seen.  So this seems confirms my hypothesis with the Xilinx driver.

Thanking you in advance,


0 Kudos
0 Replies