drivers: wifi: nxp: set the maximum number of stations

Add support for setting the maximum number of stations.
Add support for setting AP bandwidth.

Signed-off-by: Gang Li <gang.li_1@nxp.com>
This commit is contained in:
Gang Li 2024-12-02 09:14:51 +01:00 committed by Benjamin Cabé
commit 79fdf4a254

View file

@ -569,9 +569,31 @@ static int nxp_wifi_ap_config_params(const struct device *dev, struct wifi_ap_co
ret = wlan_uap_set_sta_ageout_timer(params->max_inactivity * 10); ret = wlan_uap_set_sta_ageout_timer(params->max_inactivity * 10);
if (ret != WM_SUCCESS) { if (ret != WM_SUCCESS) {
status = NXP_WIFI_RET_FAIL; status = NXP_WIFI_RET_FAIL;
LOG_ERR("Failed to set maximum inactivity duration for stations");
} else {
LOG_INF("Set maximum inactivity duration for stations: %d (s)",
params->max_inactivity);
}
}
if (params->type & WIFI_AP_CONFIG_PARAM_MAX_NUM_STA) {
ret = wlan_set_uap_max_clients(params->max_num_sta);
if (ret != WM_SUCCESS) {
status = NXP_WIFI_RET_FAIL;
LOG_ERR("Failed to set maximum number of stations");
} else {
LOG_INF("Set maximum number of stations: %d", params->max_num_sta);
}
}
if (params->type & WIFI_AP_CONFIG_PARAM_BANDWIDTH) {
ret = wlan_uap_set_bandwidth(params->bandwidth);
if (ret != WM_SUCCESS) {
status = NXP_WIFI_RET_FAIL;
LOG_ERR("Failed to set Wi-Fi AP bandwidth");
} else {
LOG_INF("Set Wi-Fi AP bandwidth: %d", params->bandwidth);
} }
} else {
return -EINVAL;
} }
} }
@ -853,6 +875,17 @@ static int nxp_wifi_connect(const struct device *dev, struct wifi_connect_req_pa
return -EAGAIN; return -EAGAIN;
} }
switch (params->bandwidth) {
case WIFI_FREQ_BANDWIDTH_20MHZ:
case WIFI_FREQ_BANDWIDTH_40MHZ:
case WIFI_FREQ_BANDWIDTH_80MHZ:
wlan_uap_set_bandwidth(params->bandwidth);
break;
default:
LOG_ERR("Invalid bandwidth");
return -EAGAIN;
}
ret = wlan_add_network(&nxp_wlan_network); ret = wlan_add_network(&nxp_wlan_network);
if (ret != WM_SUCCESS) { if (ret != WM_SUCCESS) {
status = NXP_WIFI_RET_FAIL; status = NXP_WIFI_RET_FAIL;