Skip to content
- This section describes the implementation of connection establishment and management for client mode operation. The generic ‘Connection Management’ framework is used for establishing and maintaining connection with the AP in an infrastructure network.
- The connection state machine for the client mode is created from the OS shim layer using the API wlan_connection_sm_create while creating the client interface. A connection event handler must be registered with the connection manager to get connect/disconnect events that are used to indicate link state changes to the OS.
- The connection state machine is started by the OS shim layer while starting the client interface using the API wlan_connection_sm_start. The connection manager starts with a scan operation if there is no valid scanlist already available.
- umac/scan/ieee80211_scan.c implements the scanning task, which is started by the connection manager using the API wlan_scan_start. The client scans to find the infrastructure APs available in all the allowed channels. The list of channels to be scanned is created by ieee80211_scan_ update_channel_list during the initialization of the generic scanner task (ieee80211_scan_attach). This list is actually derived from a list of allowed channels prepared by the HAL module based on the device capabilities (bands of operation supported) and regulatory domain configured. The client scans by switching to each channel and collects the AP information from the beacons received. The available infrastructure networks (APs) are stored in the scan table. From this scan table, a candidate AP list is built (umac/scan/ieee80211_aplist.c) that consists of those APs with SSIDs matching the desired SSIDs chosen by the user.
- The connection manager enters the CONNECTING state once the scan is completed. In this state, the client tries to associate with each of the APs in the candidate list built by scanner module. wlan_assoc_sm_start (umac/sme/ieee80211_assoc_sm.c) starts the association state machine which goes through the join (probe)/authentication/association sequence.
- umac/mlme/ieee80211_mlme_sta.c implements the operations required by association state machine. The join operation involves setting the channel corresponding to the scan entry and sending a probe request and processing a probe response.
- This is following with an authentication and association frame exchange with the selected AP. Processing of an association response includes setting up the rates that can be used for transmitting data frames to the AP. If the association fails and if there are more APs in the candidate AP list, the process is repeated with next AP in the list.
- On successful completion of association to the selected BSS, the hardware is setup with the association ID allocated to the client and the BSSID using ath_hal_setassocid (from ath_vap_up in lmac/ath_dev/ath_main.c). This enables the hardware to receive data frames from the AP and also allows the hardware to wake-up on TIM indications in beacons.
- The connection state machine enters the connected state, whereupon a timer is started to check periodically whether roaming is to be done. If the RSSI of the current AP falls below a threshold (default is 15 dBm), the candidate AP list is rebuilt from the scan list to determine if there is any other AP; if another is found, roaming is initiated by entering the disconnected state and restarting the association state machine with the scan entry corresponding to the new AP. A disconnect is also triggered if beacons are missed for a configurable number of consecutive beacons from the AP (the default is 15 beacons).