diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index cfed2a2e36be..70319000c20b 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1787,7 +1787,7 @@ struct hdd_context { #ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE qdf_mc_timer_t skip_acs_scan_timer; uint8_t skip_acs_scan_status; - uint8_t *last_acs_channel_list; + uint32_t *last_acs_freq_list; uint8_t num_of_channels; qdf_spinlock_t acs_skip_lock; #endif diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index fe96bcc1296b..5fbf0d4aa588 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -1192,7 +1192,7 @@ static QDF_STATUS hdd_handle_acs_scan_event(struct sap_event *sap_event, struct hdd_context *hdd_ctx; struct sap_acs_scan_complete_event *comp_evt; QDF_STATUS qdf_status; - int chan_list_size; + int freq_list_size; hdd_ctx = WLAN_HDD_GET_CTX(adapter); if (!hdd_ctx) { @@ -1202,22 +1202,22 @@ static QDF_STATUS hdd_handle_acs_scan_event(struct sap_event *sap_event, comp_evt = &sap_event->sapevt.sap_acs_scan_comp; hdd_ctx->skip_acs_scan_status = eSAP_SKIP_ACS_SCAN; qdf_spin_lock(&hdd_ctx->acs_skip_lock); - qdf_mem_free(hdd_ctx->last_acs_channel_list); - hdd_ctx->last_acs_channel_list = NULL; + qdf_mem_free(hdd_ctx->last_acs_freq_list); + hdd_ctx->last_acs_freq_list = NULL; hdd_ctx->num_of_channels = 0; /* cache the previous ACS scan channel list . * If the following OBSS scan chan list is covered by ACS chan list, * we can skip OBSS Scan to save SAP starting total time. */ - if (comp_evt->num_of_channels && comp_evt->channellist) { - chan_list_size = comp_evt->num_of_channels * - sizeof(comp_evt->channellist[0]); - hdd_ctx->last_acs_channel_list = qdf_mem_malloc( - chan_list_size); - if (hdd_ctx->last_acs_channel_list) { - qdf_mem_copy(hdd_ctx->last_acs_channel_list, - comp_evt->channellist, - chan_list_size); + if (comp_evt->num_of_channels && comp_evt->freq_list) { + freq_list_size = comp_evt->num_of_channels * + sizeof(comp_evt->freq_list[0]); + hdd_ctx->last_acs_freq_list = qdf_mem_malloc( + freq_list_size); + if (hdd_ctx->last_acs_freq_list) { + qdf_mem_copy(hdd_ctx->last_acs_freq_list, + comp_evt->freq_list, + freq_list_size); hdd_ctx->num_of_channels = comp_evt->num_of_channels; } } diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index cb3be839db74..08e02a28844a 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -7684,8 +7684,8 @@ void hdd_wlan_exit(struct hdd_context *hdd_ctx) hdd_err("Cannot deallocate ACS Skip timer"); } qdf_spin_lock(&hdd_ctx->acs_skip_lock); - qdf_mem_free(hdd_ctx->last_acs_channel_list); - hdd_ctx->last_acs_channel_list = NULL; + qdf_mem_free(hdd_ctx->last_acs_freq_list); + hdd_ctx->last_acs_freq_list = NULL; hdd_ctx->num_of_channels = 0; qdf_spin_unlock(&hdd_ctx->acs_skip_lock); #endif @@ -7785,8 +7785,8 @@ static void hdd_skip_acs_scan_timer_handler(void *data) hdd_debug("ACS Scan result expired. Reset ACS scan skip"); hdd_ctx->skip_acs_scan_status = eSAP_DO_NEW_ACS_SCAN; qdf_spin_lock(&hdd_ctx->acs_skip_lock); - qdf_mem_free(hdd_ctx->last_acs_channel_list); - hdd_ctx->last_acs_channel_list = NULL; + qdf_mem_free(hdd_ctx->last_acs_freq_list); + hdd_ctx->last_acs_freq_list = NULL; hdd_ctx->num_of_channels = 0; qdf_spin_unlock(&hdd_ctx->acs_skip_lock); diff --git a/core/hdd/src/wlan_hdd_scan.c b/core/hdd/src/wlan_hdd_scan.c index f183e38b7c91..12a05e991757 100644 --- a/core/hdd/src/wlan_hdd_scan.c +++ b/core/hdd/src/wlan_hdd_scan.c @@ -231,9 +231,9 @@ static bool wlan_hdd_sap_skip_scan_check(struct hdd_context *hdd_ctx, if (hdd_ctx->skip_acs_scan_status != eSAP_SKIP_ACS_SCAN) return false; qdf_spin_lock(&hdd_ctx->acs_skip_lock); - if (!hdd_ctx->last_acs_channel_list || - hdd_ctx->num_of_channels == 0 || - request->n_channels == 0) { + if (!hdd_ctx->last_acs_freq_list || + hdd_ctx->num_of_channels == 0 || + request->n_channels == 0) { qdf_spin_unlock(&hdd_ctx->acs_skip_lock); return false; } @@ -242,16 +242,16 @@ static bool wlan_hdd_sap_skip_scan_check(struct hdd_context *hdd_ctx, bool find = false; for (j = 0; j < hdd_ctx->num_of_channels; j++) { - if (hdd_ctx->last_acs_channel_list[j] == - request->channels[i]->hw_value) { + if (hdd_ctx->last_acs_freq_list[j] == + request->channels[i]->center_freq) { find = true; break; } } if (!find) { skip = false; - hdd_debug("Chan %d isn't in ACS chan list", - request->channels[i]->hw_value); + hdd_debug("Freq %d isn't in ACS freq list", + request->channels[i]->center_freq); break; } } diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h index 58d6094068d0..807bb47e8c37 100644 --- a/core/sap/inc/sap_api.h +++ b/core/sap/inc/sap_api.h @@ -355,12 +355,12 @@ struct sap_ch_selected_s { /** * struct sap_acs_scan_complete_event - acs scan complete event * @status: status of acs scan - * @channellist: acs scan channels + * @freq_list: acs scan channel frequency list * @num_of_channels: number of channels */ struct sap_acs_scan_complete_event { uint8_t status; - uint8_t *channellist; + uint32_t *freq_list; uint8_t num_of_channels; }; diff --git a/core/sap/src/sap_api_link_cntl.c b/core/sap/src/sap_api_link_cntl.c index ed0fb64f5b76..5f28397ca706 100644 --- a/core/sap/src/sap_api_link_cntl.c +++ b/core/sap/src/sap_api_link_cntl.c @@ -282,14 +282,14 @@ QDF_STATUS wlansap_pre_start_bss_acs_scan_callback(mac_handle_t mac_handle, sap_ctx->sap_status = eSAP_STATUS_SUCCESS; close_session: #ifdef SOFTAP_CHANNEL_RANGE - if (sap_ctx->channelList) { + if (sap_ctx->freq_list) { /* * Always free up the memory for * channel selection whatever * the result */ - qdf_mem_free(sap_ctx->channelList); - sap_ctx->channelList = NULL; + qdf_mem_free(sap_ctx->freq_list); + sap_ctx->freq_list = NULL; sap_ctx->num_of_channel = 0; } #endif diff --git a/core/sap/src/sap_ch_select.c b/core/sap/src/sap_ch_select.c index e02b76cb10f0..e84944dd6bfb 100644 --- a/core/sap/src/sap_ch_select.c +++ b/core/sap/src/sap_ch_select.c @@ -695,7 +695,8 @@ static bool sap_chan_sel_init(mac_handle_t mac_handle, for (chan_num = 0; chan_num < sap_ctx->num_of_channel; chan_num++) { if (pSpectCh->chNum != - sap_ctx->channelList[chan_num]) + wlan_reg_freq_to_chan(mac->pdev, + sap_ctx->freq_list[chan_num])) continue; /* @@ -1698,7 +1699,8 @@ static void sap_compute_spect_weight(tSapChSelSpectInfo *pSpectInfoParams, */ found = false; for (i = 0; i < sap_ctx->num_of_channel; i++) { - if (pSpectCh->chNum == sap_ctx->channelList[i]) { + if (pSpectCh->chNum == wlan_reg_freq_to_chan(mac->pdev, + sap_ctx->freq_list[i])) { /* Scan channel was included in ACS scan list */ found = true; break; diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index 7a8ba54bfc2f..d6ce794e3e54 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -85,9 +85,9 @@ extern sapSafeChannelType safe_channels[]; * Static Function Declarations and Definitions * -------------------------------------------------------------------------*/ #ifdef SOFTAP_CHANNEL_RANGE -static QDF_STATUS sap_get_channel_list(struct sap_context *sap_ctx, - uint8_t **ch_list, - uint8_t *num_ch); +static QDF_STATUS sap_get_freq_list(struct sap_context *sap_ctx, + uint32_t **freq_list, + uint8_t *num_ch); #endif /*========================================================================== @@ -935,7 +935,7 @@ QDF_STATUS sap_channel_sel(struct sap_context *sap_context) uint8_t pdev_id; #ifdef SOFTAP_CHANNEL_RANGE - uint8_t *channel_list = NULL; + uint32_t *freq_list = NULL; uint8_t num_of_channels = 0; #endif mac_handle_t mac_handle; @@ -1022,7 +1022,7 @@ QDF_STATUS sap_channel_sel(struct sap_context *sap_context) req->scan_req.scan_req_id = sap_context->req_id; req->scan_req.scan_priority = SCAN_PRIORITY_HIGH; req->scan_req.scan_f_bcast_probe = true; - sap_get_channel_list(sap_context, &channel_list, &num_of_channels); + sap_get_freq_list(sap_context, &freq_list, &num_of_channels); #ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE if (num_of_channels != 0) { @@ -1030,14 +1030,13 @@ QDF_STATUS sap_channel_sel(struct sap_context *sap_context) req->scan_req.chan_list.num_chan = num_of_channels; for (i = 0; i < num_of_channels; i++) - req->scan_req.chan_list.chan[i].freq = - wlan_chan_to_freq(channel_list[i]); - if (sap_context->channelList) { - qdf_mem_free(sap_context->channelList); - sap_context->channelList = NULL; + req->scan_req.chan_list.chan[i].freq = freq_list[i]; + if (sap_context->freq_list) { + qdf_mem_free(sap_context->freq_list); + sap_context->freq_list = NULL; sap_context->num_of_channel = 0; } - sap_context->channelList = channel_list; + sap_context->freq_list = freq_list; sap_context->num_of_channel = num_of_channels; /* Set requestType to Full scan */ QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, @@ -1056,12 +1055,12 @@ QDF_STATUS sap_channel_sel(struct sap_context *sap_context) sap_context->acs_cfg); #ifdef SOFTAP_CHANNEL_RANGE - if (sap_context->channelList) { + if (sap_context->freq_list) { sap_context->channel = - sap_context->channelList[0]; - qdf_mem_free(sap_context-> - channelList); - sap_context->channelList = NULL; + wlan_reg_freq_to_chan(mac_ctx->pdev, + sap_context->freq_list[0]); + qdf_mem_free(sap_context->freq_list); + sap_context->freq_list = NULL; sap_context->num_of_channel = 0; } #endif @@ -1344,8 +1343,8 @@ static void sap_handle_acs_scan_event(struct sap_context *sap_context, sap_event->sapevt.sap_acs_scan_comp.status = status; sap_event->sapevt.sap_acs_scan_comp.num_of_channels = sap_context->num_of_channel; - sap_event->sapevt.sap_acs_scan_comp.channellist = - sap_context->channelList; + sap_event->sapevt.sap_acs_scan_comp.freq_list = + sap_context->freq_list; } #else static void sap_handle_acs_scan_event(struct sap_context *sap_context, @@ -3311,21 +3310,21 @@ QDF_STATUS sap_is_peer_mac_allowed(struct sap_context *sap_ctx, #ifdef SOFTAP_CHANNEL_RANGE /** - * sap_get_channel_list() - get the list of channels + * sap_get_freq_list() - get the list of channel frequency * @sap_ctx: sap context - * @ch_list: pointer to channel list array + * @freq_list: pointer to channel list array * @num_ch: pointer to number of channels. * - * This function populates the list of channels for scanning. + * This function populates the list of channel frequency for scanning. * * Return: QDF_STATUS */ -static QDF_STATUS sap_get_channel_list(struct sap_context *sap_ctx, - uint8_t **ch_list, - uint8_t *num_ch) +static QDF_STATUS sap_get_freq_list(struct sap_context *sap_ctx, + uint32_t **freq_list, + uint8_t *num_ch) { uint8_t loop_count; - uint8_t *list; + uint32_t *list; uint8_t ch_count; uint8_t dfs_master_enable; uint8_t start_ch_num, band_start_ch; @@ -3342,7 +3341,7 @@ static QDF_STATUS sap_get_channel_list(struct sap_context *sap_ctx, if (!mac_ctx) { QDF_TRACE_ERROR(QDF_MODULE_ID_SAP, "Invalid MAC context"); *num_ch = 0; - *ch_list = NULL; + *freq_list = NULL; return QDF_STATUS_E_FAULT; } @@ -3377,10 +3376,11 @@ static QDF_STATUS sap_get_channel_list(struct sap_context *sap_ctx, } /* Allocate the max number of channel supported */ - list = qdf_mem_malloc(NUM_5GHZ_CHANNELS + NUM_24GHZ_CHANNELS); + list = qdf_mem_malloc((NUM_5GHZ_CHANNELS + NUM_24GHZ_CHANNELS) * + sizeof(uint32_t)); if (!list) { *num_ch = 0; - *ch_list = NULL; + *freq_list = NULL; return QDF_STATUS_E_NOMEM; } @@ -3473,8 +3473,8 @@ static QDF_STATUS sap_get_channel_list(struct sap_context *sap_ctx, ch <= sap_ctx->acs_cfg->skip_scan_range1_endch) || (ch >= sap_ctx->acs_cfg->skip_scan_range2_stch && ch <= sap_ctx->acs_cfg->skip_scan_range2_endch)) { - list[ch_count] = - WLAN_REG_CH_NUM(loop_count); + list[ch_count] = wlan_reg_chan_to_freq(mac_ctx->pdev, + WLAN_REG_CH_NUM(loop_count)); ch_count++; QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, @@ -3487,8 +3487,8 @@ static QDF_STATUS sap_get_channel_list(struct sap_context *sap_ctx, ch_count, ch); } } else { - list[ch_count] = - WLAN_REG_CH_NUM(loop_count); + list[ch_count] = wlan_reg_chan_to_freq(mac_ctx->pdev, + WLAN_REG_CH_NUM(loop_count)); ch_count++; QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, @@ -3496,7 +3496,8 @@ static QDF_STATUS sap_get_channel_list(struct sap_context *sap_ctx, ch_count, ch); } #else - list[ch_count] = WLAN_REG_CH_NUM(loop_count); + list[ch_count] = wlan_reg_chan_to_freq(mac_ctx->pdev, + WLAN_REG_CH_NUM(loop_count)); ch_count++; #endif #ifdef FEATURE_WLAN_CH_AVOID @@ -3521,15 +3522,15 @@ static QDF_STATUS sap_get_channel_list(struct sap_context *sap_ctx, /* return the channel list and number of channels to scan */ *num_ch = ch_count; if (ch_count != 0) { - *ch_list = list; + *freq_list = list; } else { - *ch_list = NULL; + *freq_list = NULL; qdf_mem_free(list); } for (loop_count = 0; loop_count < ch_count; loop_count++) { QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_DEBUG, - FL("channel number: %d"), list[loop_count]); + FL("channel frequency: %d"), list[loop_count]); } return QDF_STATUS_SUCCESS; } diff --git a/core/sap/src/sap_internal.h b/core/sap/src/sap_internal.h index cc4a25dfba48..51153d4c2807 100644 --- a/core/sap/src/sap_internal.h +++ b/core/sap/src/sap_internal.h @@ -166,7 +166,7 @@ struct sap_context { uint32_t nStaWPARSnReqIeLength; uint8_t pStaWpaRsnReqIE[MAX_ASSOC_IND_IE_LEN]; - uint8_t *channelList; + uint32_t *freq_list; uint8_t num_of_channel; uint16_t ch_width_orig; struct ch_params ch_params; diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index 2167e5e3fad1..047dd90dd09a 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -200,9 +200,9 @@ void wlansap_context_put(struct sap_context *ctx) for (i = 0; i < SAP_MAX_NUM_SESSION; i++) { if (gp_sap_ctx[i] == ctx) { if (qdf_atomic_dec_and_test(&sap_ctx_ref_count[i])) { - if (ctx->channelList) { - qdf_mem_free(ctx->channelList); - ctx->channelList = NULL; + if (ctx->freq_list) { + qdf_mem_free(ctx->freq_list); + ctx->freq_list = NULL; ctx->num_of_channel = 0; } qdf_mem_free(ctx); @@ -398,9 +398,9 @@ QDF_STATUS sap_deinit_ctx(struct sap_context *sap_ctx) } ucfg_scan_unregister_requester(mac->psoc, sap_ctx->req_id); - if (sap_ctx->channelList) { - qdf_mem_free(sap_ctx->channelList); - sap_ctx->channelList = NULL; + if (sap_ctx->freq_list) { + qdf_mem_free(sap_ctx->freq_list); + sap_ctx->freq_list = NULL; sap_ctx->num_of_channel = 0; } sap_free_roam_profile(&sap_ctx->csr_roamProfile);