Interfacing socket code with a Linux PCI driver -


I have two devices that have interfaces with PCI. I have code for both devices which use normal socket code Does. (The device was originally connected by MII / Ethernet.)

Now, I have to write a PCI device driver to move the packet forward and back between the two devices.

How do I use file descriptors opened by socket code? Is it similar to accessing a character device file?

Thank you!

The answers to your questions are as follows: (1) You do not, and (2) No.

File descriptors are a user-space concept, and kernel drivers do not interact with user-space concepts. (Yes, they are implementing by the kernel, but other device drivers can not play with them directly, and should not play indirectly with them too.)

Which methods do you implement Will obtain the data that is buffer in the kernel-accessible memory space, and sends it to your hardware, and then receives data from your hardware and it is called kernel-accessible memor In the buffer writes (when asked) in buffer.

You will do this character by applying the PCI device driver API along with the device driver API and then registering your driver as a PCI device, and then through a character device. Although some of these methods can refer to file structures, they will not be user-ground structure, which you know and love.

For devices that implement the ethernet protocol, life is easy because you have to type the interface on the net device instead, in this way your hardware has the necessary parts to get the data.

You will need specifications for device hardware, how you control hardware using PCI registers and fields.

The good news is, you do not have to do this alone - there is a large community of kernel developers, and there are many good (and current) books for the development of the Linux kernel (see below).

Context


Comments