From bcd0a8f34943b9e3241e4b95a5fba3e47ed771ce Mon Sep 17 00:00:00 2001 From: hqu Date: Mon, 25 Nov 2019 21:56:35 +0800 Subject: [PATCH] qcacld-3.0: Clear wlan_reg_freq_to_chan Clear wlan_reg_freq_to_chan in is_dfs_unsafe_extra_band_chan, refine unsafe_channel_list for hdd_context to store frequency. Change-Id: I48a75e053228b202122633a32e750f446f839ea3 CRs-Fixed: 2574028 --- core/hdd/src/wlan_hdd_cfg80211.c | 13 ++++++++----- core/hdd/src/wlan_hdd_main.c | 14 ++++++++------ core/hdd/src/wlan_hdd_regulatory.c | 2 +- core/sme/src/csr/csr_api_roam.c | 12 ++++-------- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 8cfdde44fe02..be6b6b962191 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -10468,6 +10468,7 @@ static int hdd_validate_avoid_freq_chanlist( unsigned int range_idx, ch_idx; unsigned int unsafe_channel_index, unsafe_channel_count = 0; bool ch_found = false; + uint32_t ch_idx_freq; unsafe_channel_count = QDF_MIN((uint16_t)hdd_ctx->unsafe_channel_count, (uint16_t)NUM_CHANNELS); @@ -10489,21 +10490,23 @@ static int hdd_validate_avoid_freq_chanlist( ch_idx++) { if (INVALID_CHANNEL == wlan_reg_get_chan_enum(ch_idx)) continue; + ch_idx_freq = wlan_reg_chan_to_freq(hdd_ctx->pdev, + ch_idx); for (unsafe_channel_index = 0; unsafe_channel_index < unsafe_channel_count; unsafe_channel_index++) { - if (ch_idx == + if (ch_idx_freq == hdd_ctx->unsafe_channel_list[ unsafe_channel_index]) { - hdd_info("Duplicate channel %d", - ch_idx); + hdd_info("Duplicate channel freq %d", + ch_idx_freq); ch_found = true; break; } } if (!ch_found) { hdd_ctx->unsafe_channel_list[ - unsafe_channel_count++] = ch_idx; + unsafe_channel_count++] = (uint16_t)ch_idx_freq; } ch_found = false; } @@ -10617,7 +10620,7 @@ process_unsafe_channel: for (unsafe_channel_index = 0; unsafe_channel_index < unsafe_channel_count; unsafe_channel_index++) { - hdd_debug("Channel %d is not safe", + hdd_debug("Channel frequency %d is not safe", hdd_ctx->unsafe_channel_list[unsafe_channel_index]); } if (hdd_local_unsafe_channel_updated(hdd_ctx, local_unsafe_list, diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index fbf0cb68bc49..84c41827080f 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -9316,7 +9316,7 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt) uint8_t restart_chan_store[SAP_MAX_NUM_SESSION] = {0}; uint8_t restart_chan, ap_chan; uint8_t scc_on_lte_coex = 0; - uint32_t restart_freq; + uint32_t restart_freq, ap_chan_freq; bool value; QDF_STATUS status; bool is_acs_support_for_dfs_ltecoex = cfg_default(CFG_USER_ACS_DFS_LTE); @@ -9336,6 +9336,8 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt) ap_chan = wlan_reg_freq_to_chan( hdd_ctxt->pdev, adapter->session.ap.operating_chan_freq); + ap_chan_freq = adapter->session.ap.operating_chan_freq; + found = false; status = ucfg_policy_mgr_get_sta_sap_scc_lte_coex_chnl(hdd_ctxt->psoc, @@ -9356,11 +9358,11 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt) hdd_debug("SAP allowed in unsafe SCC channel"); } else { for (i = 0; i < hdd_ctxt->unsafe_channel_count; i++) { - if (ap_chan == + if (ap_chan_freq == hdd_ctxt->unsafe_channel_list[i]) { found = true; - hdd_debug("operating ch:%d is unsafe", - ap_chan); + hdd_debug("op ch freq:%d is unsafe", + ap_chan_freq); break; } } @@ -9473,8 +9475,8 @@ static void hdd_init_channel_avoidance(struct hdd_context *hdd_ctx) (uint16_t)NUM_CHANNELS); for (index = 0; index < unsafe_channel_count; index++) { - hdd_debug("channel %d is not safe", - hdd_ctx->unsafe_channel_list[index]); + hdd_debug("channel frequency %d is not safe", + hdd_ctx->unsafe_channel_list[index]); } diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index 45065cac673a..632e3392df6d 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -1182,7 +1182,7 @@ void hdd_ch_avoid_ind(struct hdd_context *hdd_ctxt, for (i = 0; i < unsafe_chan_list->chan_cnt; i++) { hdd_ctxt->unsafe_channel_list[i] = - wlan_reg_freq_to_chan(hdd_ctxt->pdev, unsafe_chan_list->chan_freq_list[i]); + unsafe_chan_list->chan_freq_list[i]; } hdd_debug("number of unsafe channels is %d ", hdd_ctxt->unsafe_channel_count); diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 949c71593fd8..d9878d07d736 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -1388,7 +1388,6 @@ QDF_STATUS csr_update_channel_list(struct mac_context *mac) uint16_t unsafe_chan[NUM_CHANNELS]; uint16_t unsafe_chan_cnt = 0; uint16_t cnt = 0; - uint8_t channel; uint32_t channel_freq; bool is_unsafe_chan; bool is_same_band; @@ -1421,8 +1420,6 @@ QDF_STATUS csr_update_channel_list(struct mac_context *mac) csr_emu_chan_req(pScan->base_channels.channel_freq_list[i])) continue; - channel = wlan_reg_freq_to_chan(mac->pdev, - pScan->base_channels.channel_freq_list[i]); channel_freq = pScan->base_channels.channel_freq_list[i]; /* Scan is not performed on DSRC channels*/ if (wlan_reg_is_dsrc_freq(channel_freq)) @@ -1438,8 +1435,8 @@ QDF_STATUS csr_update_channel_list(struct mac_context *mac) (channel_state == CHANNEL_STATE_DFS)) { QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, - FL("skip dfs channel %d"), - channel); + FL("skip dfs channel frequency %d"), + channel_freq); continue; } if (mac->roam.configParam.sta_roam_policy. @@ -1447,7 +1444,7 @@ QDF_STATUS csr_update_channel_list(struct mac_context *mac) unsafe_chan_cnt) { is_unsafe_chan = false; for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) { - if (unsafe_chan[cnt] == channel) { + if (unsafe_chan[cnt] == channel_freq) { is_unsafe_chan = true; break; } @@ -2145,8 +2142,7 @@ is_dfs_unsafe_extra_band_chan(struct mac_context *mac_ctx, uint32_t freq, unsafe_chan_cnt) { is_unsafe_chan = false; for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) { - if (unsafe_chan[cnt] == - wlan_reg_freq_to_chan(mac_ctx->pdev, freq)) { + if (unsafe_chan[cnt] == freq) { is_unsafe_chan = true; QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,