Roaming and Background Scan#

Background scanning and roaming can be verified using wpa_supplicant.

Note: Use supplicant version greater than 2.6 for better roaming performance.

To use this feature, ensure that the flag CONFIG_BGSCAN_SIMPLE is enabled in the supplicant build configuration file (.config). See the Roaming section for suppilcant configuration.

This will enable building BGSCAN SIMPLE module, which is responsible for requesting background scans for the purpose of roaming within ESS. If this option is not enabled, rebuild wpa_supplicant binary with this option.

‘bgscan’ parameters use the following format:


This line should be present either inside a network block or outside of all network blocks based on the requirement.

Ex: bgscan=”simple: 30:-45:300”

Note: If you do not require bgscan, disable it in the supplicant config and do not include configurations above in the wpa_supplicant.conf file. This will only work if you are not connected through the network manager.

Configuring Background Scan Parameters through debugfs#

For Bgscan, f/w requires some of the parameters to be configured. The configuration is populated with default values unless you configure them through debugfs. Run the following commands to configure bgscan parameters:

  1. To verify the bgscan and parameters, run the following command:

    # cat /sys/kernel/debug/phy<X>/bgscan 
  2. To enable background scan and configure its parameters from debugfs, run the following commands:

    # echo 1 10 10 20 20 100 1 3 1 6 11 > /sys/kernel/debug/phy<X>/bgscan

The input parameters of the background scan command are explained below.

  • <background_enable>: To enable/disable the background scan.

    • 0 - Disable

    • 1 - Enable

  • <bgscan_threshold>: The Background scan threshold is referred to as the RSSI Upper Threshold. At every background scan interval , the n-Link® module decides whether to initiate or not to initiate a background scan based on the connected Access Point’s RSSI. The module initiates a background scan if the RSSI of the connected Access Point is below this threshold. The input value should be the absolute value in dBm.

  • <rssi_tolerance_threshold>: If the difference between the current RSSI value of the connected Access Point and the RSSI value of the Access Point from the previous background scan is greater than the RSSI Tolerance Threshold, the module performs a background scan. Assigning a large value to this field will eliminate this method of triggering background scans.

  • < periodicity >: This parameter specifies the interval between the background scans. The unit of this field is seconds. Setting the value of this field as 0 will disable background scans.

  • <active_scan_duration>: This parameter determines the duration of the active scan in each channel during the Background scan process. The recommended value for this parameter is 20 ms for quicker background scan operation and uninterrupted throughput. The maximum allowed value for this parameter is 255 ms.

  • <passive_scan_duration>: This parameter determines the duration of the passive scan in each DFS channel. If an active scan is enabled in a DFS channel and a beacon or probe response is received during that period, the module converts the passive scan into an active scan and waits through the duration specified by the <active_scan_duration> parameter. During a passive scan, if any beacon is received in a channel, the recommended value for this parameter is 100 ms. The active scan in DFS channel can be enabled through Background scan probe request. Active scanning will be performed only if channel switch IE (Information Element) is not present in the received beacon or probe response packets. The maximum allowed value for this parameter is 255 ms.

  • <two_probe_enable>: If this feature is enabled, the Client sends two probe requests to the Access Point. This is useful when scanning is carried out in channels with high traffic. The valid values are as follows:

    • 0 – Disable

    • 1 – Enable

  • <num_of_bgscan_channels>: Specifies the number of Background scan channels. The n-Link® module supports up to 24 channels.

  • <channels_to_scan>: The list of channels in which Background scan has to be performed.

  1. To disable background scan , periodicity should be zero.

    # echo 1 10 10 0 20 70 0 3 1 6 11 > /sys/kernel/debug/phy<X>/bgscan 
  2. To check the list of bgscan channels configured to device, run the following command. This will display the list of bgscan channels configured to device with DFS indication also.

    # cat /sys/kernel/debug/phy<X>/bgscan 

Setting Bgscan SSID through debugfs#

If the background scan is running, you can set the bgscan SSID to send two probe requests, one without and one with SSID by following the steps below.

  1. Run the following command to set the bgscan SSID:

    # echo <bgscan_ssid_name> > /sys/kernel/debug/phy<X>/bgscan_ssid 
  2. Run the following command to check whether the bgscan SSID is getting set or not:

    # cat /sys/kernel/debug/phy<X>/bgscan_ssid
  3. After setting bgscan_ssid, run the following command to update bgscan parameters with two probes enabled:

    # echo 1 10 10 30 20 70 1 6 1 2 3 4 5 6 >/sys/kernel/debug/phy<X>/bgscan
  4. Follow the instructions above to update the bgscan parameters.

  5. The sniffer capture will show two probe requests, one with and one without SSID.