I was reading through the network device driver code.My driver follows the driver-model.REF:kernel/Documentation/driver-model.
Reading through the interface.txt:
{
Device interfaces are the logical interfaces of device classes that correlate
directly to userspace interfaces, like device nodes.
Each interface is given a directory in the directory of the device
class it belongs to.
}
Havent been able to pinpoint the exact interface yet.So after going through the struct net_device and the Programming interface in the interface.txt file (kernel./Documentation/driver-model)
I again come to the conclusion that its the net_device these people are talking about.
Now what I want to know is the TCP/IP stack the physical and the link layer is the network driver.I want to give the interface my network driver provides to my tcp/ip stack.Question is How ? How can I give the net_device struct to the TCP/ip stack. Does anyone know about this.
Regards
Sraddha
.
The hierarchy is as follows
struct inet_protosw (internet protocols) has a pointer to a struct member proto (protocol)
struct sock has a pointer to a struct member proto (protocol)
struct sock has member to a struct member sk_buff_head
struct sk_buff_head has two pointer to struct members to sk_buff (one called next, one called prev)
struct sk_buff has a pointer to struct member net_device.
I don’t believe you register the net_device with inet_protosw directly.
First
inet_initregisters the built in network protocols by callingproto_register, then it callsinet_register_protoswto initialise the protocols, then it initialises the various inet modules (ip,tcp,icmp,etc).The interface responsible with linking the protocols and the device later has the
register_netdeviceandunregister_netdevice, which do what the sound like and register and unregister network devices with kernel. To send a packet from a protocol through a device usedev_queue_xmitandnetif_rxreceives a packet passes from the device layer to the network layer, it then callsnetif_rx_scheduleto schedule the packet for further processing.Resources and documentation on the organisation / workflow include: