1. Overview
mac80211: is a Linux kernel subsystem that drives developers to write driver-driven frameworks for Softmac wireless devices. MAC80211 implements STA mode in kernel space and implements AP mode (HOSTAPD) in user space.
cfg80211: Used for configuration management of wireless devices, working with fullmac,mac80211 and nl80211.
NL80211: For configuration management of wireless devices, it is a basic NetLink user-State protocol.
Mlme: Mac (Media Access Control) layer Management Entity, which manages the physical layer Mac state machine.
Softmac: Its mlme is implemented by software, and MAC80211 provides an API for SOFTMAC implementations. That is: The SOFTMAC device allows for better control of hardware execution, allowing software to achieve 802.11 frame management, including parsing and generating 802.11 wireless frames. Currently, most 802.11 devices are softmac, while FULLMAC devices are less.
Fullmac: Its mlme is hardware-managed and does not require the use of mac80211 when writing Fullmac wireless drivers.
Wpa_supplicant: is a user-space application that primarily initiates the Mlme command and then processes the related results.
Hostpad: is a user space application, the main implementation station access authentication management.
CFG80211 is the Linux802.11 configuration API. cfg80211 is used for code wext (wireless-extensions), nl80211 is used to configure a cfg80211 device and is used for communication between kernel and userspace. Wext is now processing the maintenance state, no new functions have been added, just modify the bug. If you need to operate through wext, you need to define Onfig_cfg80211_wext.
Cfg80211and nl80211: Based on message mechanism, using NetLink interface
Wext: Based on the IOCTL mechanism (Madwifi wext, etc. have been removed from the Linxu kernel Linux 2.6.26)
STRUCTIEEE80211_HW: Indicates hardware information and status
IEEE80211_ALLOC_HW: Each driver call IEEE80211_ALLOC_HW assigns IEEE80211_HW, and Ieee80211_ops is the parameter
IEEE80211_REGISTER_HW: Each driver call IEEE80211_REGISTER_HW create Wlan0 and Wmaster0, and perform various initializations.
Structieee80211_ops: Each driver implements its member function, and its member function takes STRUCTIEEE80211_HW as the first argument. There are 24 methods defined in Structieee80211_ops, and the following 7 methods must be implemented: Tx,start,stop,add_interface,remove_interface,config and Configure_filter. 2. Architecture
Figure 2-1 System Framework
3. Code Structure
IEEE80211_I.H (main data structure)
MAIN.C (main function entry)
IFACE.C (Virtual interface Processing)
Key.c,key.h (Key Management)
Sta_info.c,sta_info.h (User management)
PM.C (Power Management)
Rate.c,rate.h (Rate control function)
RC80211* (Rate control algorithm)
RX.C (frame receive path code)
TX.C (frame send path code)
SCAN.C (software Scan code)
MLME.C (station/managed mode Mlme)
IBSS.C (Ibssmlme)
CFG.C,CFG.H,WEXT.C (Configure entry code)
aes*,tkip*,wep*,michael*,wpa* (WPA/RSN/WEP code)
Wme.c,wme.h (QoS code)
UTIL.C (Public Function) 4, data structure
IEEE80211_LOCAL/IEEE80211_HW
Each data structure represents a wireless device (IEEE80211_HW embedded in ieee80211_local)
IEEE80211_HW is the visible part of ieee80211_local in the drive
Contains all operational information for wireless devices
Sta_info/ieee80211_sta
On behalf of each station
It could be mesh,ibss,ap,wds.
Ieee80211_sta is the visible part of the drive
ieee80211_conf
Hardware configuration
The current channel is the most important field
Hardware Special parameters
ieee80211_bss_conf
BSS configuration
Multi-bsses type (ibss/ap/managed)
Include, for example, the base rate bitmap
PERBSS parameters in case hardware supports creating/associating withmultiple bsses
ieee80211_key/ieee80211_key_conf
Represents the encryption/decryption key
IEEE80211_KEY_CONF supply driver for hardware acceleration
Ieee80211_key contains book-keeping and software decryption status
Ieee80211_tx_info
Most complex data structures
SKB Internal Control buffer (CB)
Experience three stages: 1, initialized by mac80211, 2, used by drive, 3, used by Send status advertisement
Ieee80211_rx_status
Contains the receive frame state
The drive is transmitted to mac80211 via the receive frame
ieee80211_sub_if_data/ieee80211_vif
Contains information for each virtual interface
Ieee80211_vifis passed to driver for those virtual interfaces The driver Knowsabout (no Monitor,vlan)
The included sub-structures depends on the pattern 5, the main process
Configuration
All originating from user space (Wext or nl80211)
Managed and IBSS modes: Trigger state machine (based on Workqueue)
Some operations are more or less directly transmitted via the driver (e.g. channel settings)
Receive Path
Through functions