diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index ae1170e3fde6..90bf969cbb8b 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -2751,15 +2751,21 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy, tb[QCA_WLAN_VENDOR_ATTR_ACS_CH_LIST]); if (sap_config->acs_cfg.ch_list_count) { sap_config->acs_cfg.ch_list = qdf_mem_malloc( - sizeof(uint8_t) * sap_config->acs_cfg.ch_list_count); - if (!sap_config->acs_cfg.ch_list) { + sap_config->acs_cfg.master_ch_list = qdf_mem_malloc( + sap_config->acs_cfg.ch_list_count); + if (!sap_config->acs_cfg.ch_list || + !sap_config->acs_cfg.master_ch_list) { ret = -ENOMEM; goto out; } qdf_mem_copy(sap_config->acs_cfg.ch_list, tmp, - sap_config->acs_cfg.ch_list_count); + sap_config->acs_cfg.ch_list_count); + qdf_mem_copy(sap_config->acs_cfg.master_ch_list, tmp, + sap_config->acs_cfg.ch_list_count); + sap_config->acs_cfg.master_ch_list_count = + sap_config->acs_cfg.ch_list_count; } } else if (tb[QCA_WLAN_VENDOR_ATTR_ACS_FREQ_LIST]) { uint32_t *freq = @@ -2770,7 +2776,10 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy, if (sap_config->acs_cfg.ch_list_count) { sap_config->acs_cfg.ch_list = qdf_mem_malloc( sap_config->acs_cfg.ch_list_count); - if (!sap_config->acs_cfg.ch_list) { + sap_config->acs_cfg.master_ch_list = qdf_mem_malloc( + sap_config->acs_cfg.ch_list_count); + if (!sap_config->acs_cfg.ch_list || + !sap_config->acs_cfg.master_ch_list) { ret = -ENOMEM; goto out; } @@ -2779,6 +2788,11 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy, for (i = 0; i < sap_config->acs_cfg.ch_list_count; i++) sap_config->acs_cfg.ch_list[i] = ieee80211_frequency_to_channel(freq[i]); + qdf_mem_copy(sap_config->acs_cfg.master_ch_list, + sap_config->acs_cfg.ch_list, + sap_config->acs_cfg.ch_list_count); + sap_config->acs_cfg.master_ch_list_count = + sap_config->acs_cfg.ch_list_count; } } @@ -3024,7 +3038,13 @@ void wlan_hdd_undo_acs(struct hdd_adapter *adapter) qdf_mem_free(sap_cfg->acs_cfg.ch_list); sap_cfg->acs_cfg.ch_list = NULL; } + if (sap_cfg->acs_cfg.master_ch_list) { + hdd_debug("Clearing master ACS cfg channel list"); + qdf_mem_free(sap_cfg->acs_cfg.master_ch_list); + sap_cfg->acs_cfg.master_ch_list = NULL; + } sap_cfg->acs_cfg.ch_list_count = 0; + sap_cfg->acs_cfg.master_ch_list_count = 0; sap_cfg->acs_cfg.acs_mode = false; } diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h index 807bb47e8c37..89b22c3426d2 100644 --- a/core/sap/inc/sap_api.h +++ b/core/sap/inc/sap_api.h @@ -430,6 +430,8 @@ struct sap_acs_cfg { uint8_t end_ch; uint8_t *ch_list; uint8_t ch_list_count; + uint8_t *master_ch_list; + uint8_t master_ch_list_count; #ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE uint8_t skip_scan_status; uint8_t skip_scan_range1_stch; diff --git a/core/sap/src/sap_ch_select.c b/core/sap/src/sap_ch_select.c index 3d169654e0f3..00d84e178565 100644 --- a/core/sap/src/sap_ch_select.c +++ b/core/sap/src/sap_ch_select.c @@ -503,13 +503,14 @@ uint8_t sap_channel_in_acs_channel_list(uint8_t channel_num, { uint8_t i = 0; - if ((!sap_ctx->acs_cfg->ch_list) || + if ((!sap_ctx->acs_cfg->master_ch_list) || (!spect_info_params)) return channel_num; if (channel_num > 0 && channel_num <= 252) { - for (i = 0; i < sap_ctx->acs_cfg->ch_list_count; i++) { - if ((sap_ctx->acs_cfg->ch_list[i]) == channel_num) + for (i = 0; i < sap_ctx->acs_cfg->master_ch_list_count; i++) { + if ((sap_ctx->acs_cfg->master_ch_list[i]) == + channel_num) return channel_num; } return SAP_CHANNEL_NOT_SELECTED; diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index 8dc34f24fcf4..5f76f08b6fde 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -222,8 +222,9 @@ static uint8_t sap_random_channel_sel(struct sap_context *sap_ctx) ch_params->ch_width = ch_wd; if (sap_ctx->acs_cfg) { acs_info.acs_mode = sap_ctx->acs_cfg->acs_mode; - acs_info.channel_list = sap_ctx->acs_cfg->ch_list; - acs_info.num_of_channel = sap_ctx->acs_cfg->ch_list_count; + acs_info.channel_list = sap_ctx->acs_cfg->master_ch_list; + acs_info.num_of_channel = + sap_ctx->acs_cfg->master_ch_list_count; } else { acs_info.acs_mode = false; } diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index 6fc0b0ac67c4..9d8c9a64f591 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -2806,9 +2806,8 @@ QDF_STATUS wlansap_update_owe_info(struct sap_context *sap_ctx, return status; } -static bool wlansap_is_channel_present_in_acs_list(uint8_t ch, - uint8_t *ch_list, - uint8_t ch_count) +static bool wlansap_is_channel_present_in_acs_list(uint8_t ch, uint8_t *ch_list, + uint8_t ch_count) { uint8_t i; @@ -2833,15 +2832,17 @@ QDF_STATUS wlansap_filter_ch_based_acs(struct sap_context *sap_ctx, size_t ch_index; size_t target_ch_cnt = 0; - if (!sap_ctx || !ch_list || !ch_cnt || !sap_ctx->acs_cfg->ch_list) { + if (!sap_ctx || !ch_list || !ch_cnt || + !sap_ctx->acs_cfg->master_ch_list || + !sap_ctx->acs_cfg->master_ch_list_count) { sap_err("NULL parameters"); return QDF_STATUS_E_FAULT; } for (ch_index = 0; ch_index < *ch_cnt; ch_index++) { if (wlansap_is_channel_present_in_acs_list(ch_list[ch_index], - sap_ctx->acs_cfg->ch_list, - sap_ctx->acs_cfg->ch_list_count)) + sap_ctx->acs_cfg->master_ch_list, + sap_ctx->acs_cfg->master_ch_list_count)) ch_list[target_ch_cnt++] = ch_list[ch_index]; }