After reading the code for a few days, some relationships have finally become a bit eye-catching.
Because the wireless device is a PCI device, the. probe function is called after the insmod driver.
. Probe = xxx_probe.
There are several notable points in the implementation of xxx_probe.
Void xxx_probe ()
{
// Ieee80211_alloc_hw allocates data related to the driver and hardware. If there is no time, attach the allocated figure.
Struct ieee80211_hw * ieee80211_alloc_hw (size_t priv_data_len, const struct ieee80211_ops * OPS)
Then there will be applications for IRQ Io, memory, and other resources.
DMA, etc.
...
// This function is called to register with the kernel after hardware resources are allocated.
Int ieee80211_register_hw (struct ieee80211_hw * HW)
{
...
// This function is particularly worth noting. It creates a net _ DEVICE data structure named wlanx and inserts the data structure into the global network device linked list.
Result = ieee80211_if_add (local, "WLAN % d", null,
Nl80211_iftype_station, null );
Int ieee80211_if_add (struct ieee80211_local * local, const char * Name,
Struct net_device ** new_dev, Enum nl80211_iftype type,
Struct vif_params * Params)
{Ndev = alloc_netdev_mq (sizeof (* sdata) + local-> HW. vif_data_size,
Name, ieee80211_if_setup, local-> HW. Queues );
}
...
}
}
Net_device is the most important data structure in the network. This is described in Linux driver and understanding Linux Network internals.
Now, the ifconfig wlan0 up command is used.
On the Linux Device Driver 508 page, we will not describe it here.
These relationships should be understood in this way and can be serialized. If you think there is any misunderstanding in the future, add it.