Network kernel driver modules
Hoping to be not offtopic, I'll try to explain my troubles.
I'm reading some code regarding a network driver kernel module. From
what I see, when I modprobe the module into the kernel, the init
function of the module is called.
Moreover, when I give the command
# ifconfig wlan0 up
where wlan0 is the device name, the "open" function of the module is
triggered and executed.
Similar things happen with
# ifconfig wlan0 down
that triggers the "close" function.
The module uses a net_device structure that is filled with the
pointers to the various functions implemented by the driver. Among
them is "hard_start_xmit" that is responsible of sending packets.
1) How is this function triggered exactly?
2) Can I access it through userspace directly?
3) I know that every network device in linux is accessed through a
socket: *where* and *how* is the glue between the socket and the
hard_start_xmit function implemented?
4) I was told that the hard_start_xmit is triggered through the
dev_queue_xmit function: how? (can you give me a sample regarding
5) If so, how do I get to know the device to fill the sk_buff->dev
pointer with, in order to then specify the dev_queue_xmit function
Probably several of the above questions are repetitions of others, if
there's a single answer that summerize the ones I'm asking for, I'd be
really thankful to know that.
Thanks in advance, cheers,