LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 06-28-2018, 10:42 PM   #1
cwang_sh
LQ Newbie
 
Registered: Aug 2014
Posts: 5

Rep: Reputation: Disabled
Smile Can PCIe device driver support to read a particlualr buffer in the PCIe device with mutiple buffers?


Hello everyone!

My question is about the development of PCIe device driver. I have a special-purpose card that has a fixed number (say, six) of buffers. There are six application processes on the host that need to process the data in their respective buffer. A simple approach is to use a dispatching process to call the driver and dispatch the data from the 6 buffers on the card to the 6 processes' respective memory space on the host, but this will increase the number of memory-copy operation. For example, the data is first read from the card buffers into the driver's kernel space, and then the data in the kernel space is copied to the memory of the dispatching process. The process then copies the data to the respective user memory spaces of the 6 application processes.

My thought is that if the device driver can read a particular buffer which is indicated by a parameter, for example each of the 6 application processes perform read(device handler, buffer ID, target address, number of bytes to read, ...) , in this way, each application process reads data into the memory space of the respective process. This can reduce one memory-copy operation. This is meaningful especially when the data volume is large, as my application requires very low latency.

My question is whether Linux driver can supports additional parameters, such as the buffer ID, this ID determines which buffer the driver wants to read.

Any response will be highly appreciated

Cheng
 
Old 06-29-2018, 12:20 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
The easy part is to add an ioctl call or seek call to specify which buffer to read. The harder part is to allow each process to have its own file descriptor so that overlapping reads from different processes don't interfere with each other. How to do that depends on the characteristics of your device.
 
Old 07-02-2018, 03:56 AM   #3
cwang_sh
LQ Newbie
 
Registered: Aug 2014
Posts: 5

Original Poster
Rep: Reputation: Disabled
Are the easy part and harder part two different methods? or two parts of a method

Quote:
Originally Posted by smallpond View Post
The easy part is to add an ioctl call or seek call to specify which buffer to read. The harder part is to allow each process to have its own file descriptor so that overlapping reads from different processes don't interfere with each other. How to do that depends on the characteristics of your device.
Dear smallpond,

Your reply is very helpful, thank you so much.

You mentioned the easy part and harder part in the post. Are they two different answers for my question, or they are two parts of of your solution?

Thank you!

cwang
 
Old 07-02-2018, 09:17 AM   #4
cwang_sh
LQ Newbie
 
Registered: Aug 2014
Posts: 5

Original Poster
Rep: Reputation: Disabled
Could you please show me some references for using ioctl/seek-call to specify a buffer?

Quote:
Originally Posted by smallpond View Post
The easy part is to add an ioctl call or seek call to specify which buffer to read. The harder part is to allow each process to have its own file descriptor so that overlapping reads from different processes don't interfere with each other. How to do that depends on the characteristics of your device.
Hi smallpond,

I think the harder part in your reply is about creating MINOR number for the device. Could you further say a few words on the easy part or give any reference? as I am not an expert on device driver development.

Thanks a lot.

Cheng
 
  


Reply

Tags
device driver, linux kernels



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PCIe rescan from kernel device driver fdumoulin Linux - Kernel 2 06-27-2017 09:57 AM
Read/Write memory from PCIe Device viterbi Linux - General 4 11-05-2015 02:01 AM
[SOLVED] Device Driver Install PCIe card blackmagic010216 Linux - Newbie 4 06-30-2010 04:30 AM
Writing PCIe device driver pythonarms Linux - Kernel 0 02-23-2009 01:45 PM
Doubts about PCIe device driver rwpa Linux - Newbie 4 12-10-2008 08:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 01:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration