I've got a hardware client1 who's line of data acquisition cards I've written a Linux PCI kernel driver for.
The card can only communicate 1-4 bytes at a time depending on how the user specifies to utilize it, given this, I utilize ioctl for some of the functionality, but also make use of the file_operations structure to treat the card as a basic character device to give the user of the card the ability to just use read or write if they just want simple 1-byte communication with the card.
After discussing the driver with the client, one of their developers is in the understanding that treating the card as a character device by using open/read/write will introduce latency on the PCI bus, versus using open/ioctl.
Given that the driver makes no distinction how it's opened and the ioctl and read/write functions call the same code, is there any validity to this concern?
If so, how would I test the bus latency from my driver code? Are there kernel functions I can call to test this?
Lastly, wouldn't my test of the bus only be valid for my specific setup (kernel settings, platform, memory timing, CPU, etc.)?
1: they only have 2 other developers, neither of which have ever used Linux
ioctlandread/writeare the same code, so any bus latency is due to the card or PCI bus itself, not the driver (or necessarily even the kernel). I've tried to explain this to the client's hardware guys and the developer who thinks this, but the developer wants me to give proof, and I'm just the contractor .. so I'm trying to find out how I can test the timing of the bus through my driver based on the function I utilize, or provide other proofs to this fact. - txtechhelpreadandwriteimplementations indeed operate only a single byte at a time, but the hardware supports four at a time, then they will indeed suffer from more latency than is necessary. Whether you provide anioctlthat could do better is unclear. - John Bollingerreadandwrite. Of course, theioctlinterface is very generic and can support that, but it normally is used for providing access to device parameters, not for performing I/O. - John Bollingerioctlcall is the same is a 1-byteread(at least that's the question) ... as an aside, theioctlto communicate is something they wanted in the driver :/ - txtechhelp