Results 1 to 1 of 1
Hi, I am trying to send/receive a packet to/from an ethernet device ( eth0 for example ), from a kernel module. The question is: can I do that without writing ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-29-2010 #1
- Join Date
- Apr 2010
Communication between kernel module and driver
I am trying to send/receive a packet to/from an ethernet device ( eth0 for example ), from a kernel module. The question is: can I do that without writing my own network device driver and use an existent one ( lets say e1000 - I noticed that I have an e1000 module already loaded on my system ). If that is possible, how can I access this e1000 module from my kernel module - send a packet to it, or receive a packet from it, rather, how can I use e1000 so that it will transmit/receive packets for my module ( I will then send these received packets to a user application ) - there have to be some functions to do that I just cant find them. Obviously I have been asking Google the wrong questions, as I didn't get useful results ( I am a complete newbie at this ). Thanks for any help.
I'm also wondering how to list all registered network devices from my kernel module ( i'm guessing it is possible )
OK, so I've successfully assigned eth device to struct net_device *dev by using dev_get_by_name(&init_net, "eth0"). Also successfully printed out device's state when I loaded the module. So right now I'm searching for some sort of a callback function that would print out a message whenever a packet arrives to eth0 - very much like a structure file_operations that has write, read,... callbacks. I've taken a look at net_device_ops but it seems that nothing useful is there. Are there any such callbacks ? (I hope you don't mind me posting every little thing I learn, but maybe someone else has the same problems )