The csmngr utility daemon is used for Wi-Fi Auto Channel Planning and Dynamic
Channel selection.
When started, it reads the "wireless" UCI config file to know the list of Wi-Fi radio interfaces that have option "channel" set to either "auto" or 0. Accordingly, it proceeds to collect channel characteristics such as channel-time, tx-time, rx-time, busy-time, noise etc. for all channels supported by the radio interfaces. It then uses the collected data to compute 'Optimal' channels for all possible channel-and-bandwidth combinations supported by the radios.
Finally, csmngr can set the newly found optimal channel into the wireless driver if certain conditions are fulfilled or instructed to do so via the CLI.
Build and build config
Run 'make' from within the "src" directory to build the 'csmngr' utility daemon. See Dependencies section for the prerequisites.
For install, run 'make install'. This will install 'csmngr' to the default install path at '/usr/sbin'.
Configuration
'csmngr' uses '/etc/config/wireless', which is also the 'wireless' UCI file.
The following config options are read from the 'wifi-device' sections and used in the channel selection configuration and algo -
| Section | Name | Type | Required | Default | Description |
|---|---|---|---|---|---|
| wifi-device | - | - | - | - | - |
| " | disabled | boolean | no | 0 | When set to 1, disables the wifi radio interface. |
| " | channel | integer or "auto" | yes | "auto" | When set to "auto", WiFi Auto Channel Selection decides what channel the AP interface on this radio will come up with. If 'csmngr' is present and running, then it will run on the radio interface in "enabled+acs" mode. |
| " | channels | list | no | When channel is "auto", ACS will select channel from the 'channels' list. Channels are provided as range using hyphen ('-') or individual channels can be specified by space (' ') separated values. | |
| " | acs_mode | String | no | "auto" | Set the mode of operation. Valid values are "auto" and "disabled". Default value: When 'channel' = 'auto', 'acs_mode' gets set to 'auto'. When 'channel' = fixed integer value, 'acs_mode' is set to 'disabled'. See NOTE below how to set 'acs_mode' at run-time. |
| " | acs_refresh_int | integer | no | 43200 | Specifies the ACS refresh time in seconds. |
| " | acs_collect_int | integer | no | 5 | Specifies the interval in seconds between channels survey data collection. |
| " | acs_exclude_dfs | boolean | no | 0 | Whether to exclude or not the DFS channels during ACS. |
| " | acs_exclude_non_psc | boolean | no | 1 | Whether to exclude or not the PSC in 6GHz radio band. |
| " | acs_intf_factor_wt | integer | no | 60 | Weightage in % for ACS criteria - Channel Interference Factor. |
| " | acs_num_obss_wt | integer | no | 30 | Weightage in % for ACS criteria - Number of Scanned OBSS. |
| " | acs_reg_txpower_wt | integer | no | 10 | Weightage in % for ACS criteria - Regulatory allowed Txpower. |
| " | acs_preclear_channels | list | no | List of channels separated by ('-') or (',') or (' ') for CAC preclear. The order specified is the order in which the pre-clearing happens. For example, if acs_preclear_channels: "100-112 116-128 132-144 52-64", then pre-clearing of 100-112 channel block will be attempted before 52-64. Default order: "52-64, 100-112, 116-128, 132-144". |
NOTE: The
setcommand can be used to change the 'acs_mode' at run-time -
ubus call wifi.acs set '{"radio": "<radio-name>", "config" : {"acs_mode": "auto"}}'In the wireless config file, if 'channel' option for a WiFi radio is set to a fixed value instead of 'auto', then auto-channel selection will be disabled by default. This means, csmngr will set 'acs_mode' to 'disabled'. This is because, user may have explicitly configured the channel to a fixed value, and csmngr does not want to interfere with that setting. However, if needed, user can change the 'acs_mode' using the
setcommand. Any subsequentrefreshcommand over the radio, or at the expiry of 'acs_refresh_int' (refresh interval), csmngr will start the channel selection procedure for the radio.
config wifi-device 'wl0'
option type 'mac80211'
option band '5g'
:
.
option acs_intf_factor_wt '70'
option acs_num_obss_wt '30'
option acs_refresh_int '1800'
option acs_collect_int '180'
option acs_exclude_dfs '0'
CLI (through UBUS)
When running, 'csmngr' provides the following UBUS methods -
root@iopsys:~# ubus -v list wifi.acs
'wifi.acs' @78290a1f
"status":{}
"results":{}
"refresh":{"radio":"String","band":"Integer"}
"scan":{"radio":"String","band":"Integer","freq":"Integer","channel":"Integer","duration":"Integer"}
"dump_survey":{"radio":"String","band":"Integer","freq":"Integer","channel":"Integer"}
"channel_switch":{"radio":"String","band":"Integer","freq":"Integer","channel":"Integer","bandwidth":"Integer","sco":"Integer"}
"add":{"radio":"String","mode":"String"}
"del":{"radio":"String"}
"set":{"radio":"String","config":"Table"}
Example usage:
# For "radio0_band1", set "acs_mode" to "auto" (i.e. 'auto channel select') and "acs_refresh_int" (refresh interval) to 86400s.
ubus call wifi.acs set '{"radio": "radio0_band1", "config": {"acs_mode":"auto", "acs_refresh_int": "86400"}}'
# For "radio0_band1", trigger ACS refresh.
ubus call wifi.acs refresh '{"radio": "radio0_band1"}'
An example output of the ubus call wifi.acs results call showing the predicted optimal channels for each supported bandwidth combinations by the Wi-Fi radios -
root@iopsys:~# ubus call wifi.acs results
{
"radios": [
{
"name": "radio0_band0",
"band": "2g",
"verdict": [
{
"channel": 11,
"bandwidth": 20,
"interference-factor": 0.471150
},
{
"channel": 6,
"bandwidth": 40,
"interference-factor": 0.650304
}
]
},
{
"name": "radio0_band1",
"band": "5g",
"verdict": [
{
"channel": 149,
"bandwidth": 20,
"interference-factor": 0.000000
},
{
"channel": 149,
"bandwidth": 40,
"interference-factor": 0.000000
},
{
"channel": 149,
"bandwidth": 80,
"interference-factor": 0.000000
},
{
"channel": 36,
"bandwidth": 160,
"interference-factor": 0.061599
}
]
},
{
"name": "radio0_band2",
"band": "6g",
"verdict": [
{
"channel": 81,
"bandwidth": 20,
"interference-factor": 0.000000
},
{
"channel": 81,
"bandwidth": 40,
"interference-factor": 0.000000
},
{
"channel": 49,
"bandwidth": 80,
"interference-factor": 0.003160
}
]
}
]
}
Dependencies
'csmngr' requires the following libraries and software components for build and run-time dependencies:
| Dependency | Link | License |
|---|---|---|
| libeasy | https://dev.iopsys.eu/hal/libeasy.git | LGPL 2.1 |
| libwifi | https://dev.iopsys.eu/hal/libwifi.git | LGPL 2.1 |
| libuci | https://git.openwrt.org/project/uci.git | LGPL 2.1 |
| libubox | https://git.openwrt.org/project/libubox.git | ISC |
| libblobmsg_json | https://git.openwrt.org/project/libubox.git | ISC |
| libubus | https://git.openwrt.org/project/ubus.git | LGPL 2.1 |
| libjson-c | https://s3.amazonaws.com/json-c_releases | MIT |
| libnl-3 | https://github.com/thom311/libnl.git | LGPLv2.1 |
| libnl-genl-3 | https://github.com/thom311/libnl.git | LGPLv2.1 |
| libnl-route-3 | https://github.com/thom311/libnl.git | LGPLv2.1 |
| libmnl | https://git.netfilter.org/libmnl | LGPLv2.1 |