From d2f37fb5718d48d72ea0398902f328d4e7173454 Mon Sep 17 00:00:00 2001 From: Will Huang Date: Mon, 15 Jul 2019 17:49:10 +0800 Subject: [PATCH] qcacld-3.0: Replace channel ID with frequency (bss_description 2) Prepare to replace channel id with channel frequency of struct bss_description, first cleanup reference of channel id of struct bss_description in lim_api.c csr_api_scan.c csr_host_scan_roam.c csr_roam_preauth.c csr_util.c, use channel frequency instead. Change-Id: I86864c73c429c52399819532cd9b957f66ed94f0 CRs-Fixed: 2491406 --- core/mac/src/pe/lim/lim_api.c | 12 +++++++---- core/sme/src/csr/csr_api_scan.c | 31 +++++++++------------------ core/sme/src/csr/csr_host_scan_roam.c | 24 ++++++++++++--------- core/sme/src/csr/csr_roam_preauth.c | 22 +++++++++++-------- core/sme/src/csr/csr_util.c | 19 +++++++++------- 5 files changed, 56 insertions(+), 52 deletions(-) diff --git a/core/mac/src/pe/lim/lim_api.c b/core/mac/src/pe/lim/lim_api.c index 9e6dedfccce85..46e8fc2785fad 100644 --- a/core/mac/src/pe/lim/lim_api.c +++ b/core/mac/src/pe/lim/lim_api.c @@ -2197,9 +2197,12 @@ lim_roam_fill_bss_descr(struct mac_context *mac, } bss_desc_ptr->freq_self = bss_desc_ptr->chan_freq; - bss_desc_ptr->nwType = lim_get_nw_type(mac, bss_desc_ptr->channelId, - SIR_MAC_MGMT_FRAME, - parsed_frm_ptr); + bss_desc_ptr->nwType = lim_get_nw_type( + mac, + wlan_reg_freq_to_chan(mac->pdev, + bss_desc_ptr->chan_freq), + SIR_MAC_MGMT_FRAME, + parsed_frm_ptr); bss_desc_ptr->sinr = 0; bss_desc_ptr->beaconInterval = parsed_frm_ptr->beaconInterval; @@ -2222,7 +2225,8 @@ lim_roam_fill_bss_descr(struct mac_context *mac, pe_debug("LFR3: BssDescr Info:"); QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, bss_desc_ptr->bssId, sizeof(tSirMacAddr)); - pe_debug("chan: %d rssi: %d ie_len %d", bss_desc_ptr->channelId, + pe_debug("chan: %d rssi: %d ie_len %d", + bss_desc_ptr->chan_freq, bss_desc_ptr->rssi, ie_len); if (ie_len) { qdf_mem_copy(&bss_desc_ptr->ieFields, diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c index 8fa239392d335..3f2bbba7536ee 100644 --- a/core/sme/src/csr/csr_api_scan.c +++ b/core/sme/src/csr/csr_api_scan.c @@ -387,7 +387,8 @@ static void csr_scan_add_result(struct mac_context *mac_ctx, frm_type = MGMT_PROBE_RESP; rx_param.pdev_id = 0; - rx_param.channel = bss_desc->channelId; + rx_param.channel = wlan_reg_freq_to_chan(mac_ctx->pdev, + bss_desc->chan_freq); rx_param.rssi = bss_desc->rssi; rx_param.tsf_delta = bss_desc->tsf_delta; @@ -1975,35 +1976,23 @@ csr_get_channel_for_hw_mode_change(struct mac_context *mac_ctx, scan_result = GET_BASE_ADDR(next_element, struct tag_csrscan_result, Link); + channel_id = wlan_reg_freq_to_chan( + mac_ctx->pdev, + scan_result->Result.BssDescriptor.chan_freq); if (policy_mgr_is_hw_dbs_2x2_capable(mac_ctx->psoc)) { - if (WLAN_REG_IS_24GHZ_CH - (scan_result->Result.BssDescriptor.channelId)) { - channel_id = - scan_result-> - Result.BssDescriptor.channelId; + if (WLAN_REG_IS_24GHZ_CH(channel_id)) break; - } } else { - if (WLAN_REG_IS_24GHZ_CH - (scan_result->Result.BssDescriptor.channelId) && + if (WLAN_REG_IS_24GHZ_CH(channel_id) && policy_mgr_is_any_mode_active_on_band_along_with_session (mac_ctx->psoc, - session_id, POLICY_MGR_BAND_5)) { - channel_id = - scan_result-> - Result.BssDescriptor.channelId; + session_id, POLICY_MGR_BAND_5)) break; - } - if (WLAN_REG_IS_5GHZ_CH - (scan_result->Result.BssDescriptor.channelId) && + if (WLAN_REG_IS_5GHZ_CH(channel_id) && policy_mgr_is_any_mode_active_on_band_along_with_session (mac_ctx->psoc, - session_id, POLICY_MGR_BAND_24)) { - channel_id = - scan_result-> - Result.BssDescriptor.channelId; + session_id, POLICY_MGR_BAND_24)) break; - } } next_element = csr_ll_next(&bss_list->List, next_element, LL_ACCESS_NOLOCK); diff --git a/core/sme/src/csr/csr_host_scan_roam.c b/core/sme/src/csr/csr_host_scan_roam.c index 846809469b80f..d6862838fc68f 100644 --- a/core/sme/src/csr/csr_host_scan_roam.c +++ b/core/sme/src/csr/csr_host_scan_roam.c @@ -133,6 +133,7 @@ void csr_neighbor_roam_process_scan_results(struct mac_context *mac_ctx, &mac_ctx->roam.neighborRoamInfo[sessionid]; tpCsrNeighborRoamBSSInfo bss_info; uint64_t age = 0; + uint8_t bss_chan_id; uint8_t num_candidates = 0; uint8_t num_dropped = 0; /* @@ -166,11 +167,13 @@ void csr_neighbor_roam_process_scan_results(struct mac_context *mac_ctx, if (!scan_result) break; descr = &scan_result->BssDescriptor; + bss_chan_id = wlan_reg_freq_to_chan(mac_ctx->pdev, + descr->chan_freq); QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, FL("Scan result: BSSID " QDF_MAC_ADDR_STR " (Rssi %d, Ch:%d)"), QDF_MAC_ADDR_ARRAY(descr->bssId), - (int)abs(descr->rssi), descr->channelId); + (int)abs(descr->rssi), descr->chan_freq); if (!qdf_mem_cmp(descr->bssId, n_roam_info->currAPbssid.bytes, @@ -197,10 +200,9 @@ void csr_neighbor_roam_process_scan_results(struct mac_context *mac_ctx, conc_channel = csr_get_concurrent_operation_channel(mac_ctx); if (conc_channel && - (conc_channel != - scan_result->BssDescriptor.channelId)) { + (conc_channel != bss_chan_id)) { sme_debug("MCC not supported so Ignore AP on channel %d", - scan_result->BssDescriptor.channelId); + descr->chan_freq); continue; } } @@ -210,11 +212,12 @@ void csr_neighbor_roam_process_scan_results(struct mac_context *mac_ctx, * have duplicates */ if ((n_roam_info->uOsRequestedHandoff) && - ((qdf_mem_cmp(descr->bssId, - n_roam_info->handoffReqInfo.bssid.bytes, - sizeof(tSirMacAddr))) - || (descr->channelId != - n_roam_info->handoffReqInfo.channel))) { + ((qdf_mem_cmp( + descr->bssId, + n_roam_info->handoffReqInfo.bssid.bytes, + sizeof(tSirMacAddr))) || + (bss_chan_id != + n_roam_info->handoffReqInfo.channel))) { QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, "SKIP-not a candidate AP for OS requested roam"); @@ -564,7 +567,8 @@ void csr_neighbor_roam_request_handoff(struct mac_context *mac_ctx, qdf_mem_copy(neighbor_roam_info->csrNeighborRoamProfile.BSSIDs.bssid, handoff_node.pBssDescription->bssId, sizeof(tSirMacAddr)); neighbor_roam_info->csrNeighborRoamProfile.ChannelInfo.ChannelList[0] = - handoff_node.pBssDescription->channelId; + wlan_reg_freq_to_chan(mac_ctx->pdev, + handoff_node.pBssDescription->chan_freq); sme_debug("csr_roamHandoffRequested: disassociating with current AP"); diff --git a/core/sme/src/csr/csr_roam_preauth.c b/core/sme/src/csr/csr_roam_preauth.c index c18bdf2b421eb..981308bbd6499 100644 --- a/core/sme/src/csr/csr_roam_preauth.c +++ b/core/sme/src/csr/csr_roam_preauth.c @@ -244,7 +244,8 @@ QDF_STATUS csr_neighbor_roam_preauth_rsp_handler(struct mac_context *mac_ctx, sme_debug("After Pre-Auth: BSSID " QDF_MAC_ADDR_STR ", Ch:%d", QDF_MAC_ADDR_ARRAY( preauth_rsp_node->pBssDescription->bssId), - (int)preauth_rsp_node->pBssDescription->channelId); + (int)wlan_reg_freq_to_chan(mac_ctx->pdev, + preauth_rsp_node->pBssDescription->chan_freq)); csr_neighbor_roam_send_lfr_metric_event(mac_ctx, session_id, preauth_rsp_node->pBssDescription->bssId, @@ -454,6 +455,7 @@ static uint32_t csr_get_dot11_mode(struct mac_context *mac_ctx, session_id); enum csr_cfgdot11mode ucfg_dot11_mode, cfg_dot11_mode; QDF_STATUS status; + uint8_t bss_chan_id; tDot11fBeaconIEs *ies_local = NULL; uint32_t dot11mode = 0; @@ -476,6 +478,8 @@ static uint32_t csr_get_dot11_mode(struct mac_context *mac_ctx, return 0; } + bss_chan_id = wlan_reg_freq_to_chan(mac_ctx->pdev, + bss_desc->chan_freq); if (csr_is_phy_mode_match(mac_ctx, csr_session->pCurRoamProfile->phyMode, bss_desc, csr_session->pCurRoamProfile, @@ -483,7 +487,7 @@ static uint32_t csr_get_dot11_mode(struct mac_context *mac_ctx, ucfg_dot11_mode = cfg_dot11_mode; else { sme_err("Can not find match phy mode"); - if (WLAN_REG_IS_5GHZ_CH(bss_desc->channelId)) + if (WLAN_REG_IS_5GHZ_CH(bss_chan_id)) ucfg_dot11_mode = eCSR_CFG_DOT11_MODE_11A; else ucfg_dot11_mode = eCSR_CFG_DOT11_MODE_11G; @@ -495,9 +499,9 @@ static uint32_t csr_get_dot11_mode(struct mac_context *mac_ctx, sme_debug("dot11mode %d ucfg_dot11_mode %d", dot11mode, ucfg_dot11_mode); - if (bss_desc->channelId <= 14 && - !mac_ctx->mlme_cfg->vht_caps.vht_cap_info.b24ghz_band && - MLME_DOT11_MODE_11AC == dot11mode) { + if (bss_chan_id <= 14 && + !mac_ctx->mlme_cfg->vht_caps.vht_cap_info.b24ghz_band && + MLME_DOT11_MODE_11AC == dot11mode) { /* Need to disable VHT operation in 2.4 GHz band */ dot11mode = MLME_DOT11_MODE_11N; } @@ -544,7 +548,8 @@ QDF_STATUS csr_roam_issue_ft_preauth_req(struct mac_context *mac_ctx, /* Save the SME Session ID. We need it while processing preauth resp */ csr_session->ftSmeContext.smeSessionId = session_id; preauth_req->messageType = eWNI_SME_FT_PRE_AUTH_REQ; - preauth_req->preAuthchannelNum = bss_desc->channelId; + preauth_req->preAuthchannelNum = + wlan_reg_freq_to_chan(mac_ctx->pdev, bss_desc->chan_freq); preauth_req->dot11mode = dot11mode; qdf_mem_copy((void *)&preauth_req->currbssId, @@ -762,9 +767,8 @@ QDF_STATUS csr_neighbor_roam_issue_preauth_req(struct mac_context *mac_ctx, eCsrPerformPreauth, true); sme_debug("Before Pre-Auth: BSSID " QDF_MAC_ADDR_STR ", Ch:%d", - QDF_MAC_ADDR_ARRAY( - neighbor_bss_node->pBssDescription->bssId), - (int)neighbor_bss_node->pBssDescription->channelId); + QDF_MAC_ADDR_ARRAY(neighbor_bss_node->pBssDescription->bssId), + neighbor_bss_node->pBssDescription->chan_freq); if (QDF_STATUS_SUCCESS != status) { sme_err("Return failed preauth request status %d", diff --git a/core/sme/src/csr/csr_util.c b/core/sme/src/csr/csr_util.c index 125723ccac0f7..938fbcc0694ec 100644 --- a/core/sme/src/csr/csr_util.c +++ b/core/sme/src/csr/csr_util.c @@ -1227,10 +1227,12 @@ bool csr_is_valid_mc_concurrent_session(struct mac_context *mac_ctx, pSession = CSR_GET_SESSION(mac_ctx, session_id); if (!pSession->pCurRoamProfile) return false; - if (QDF_STATUS_SUCCESS == csr_validate_mcc_beacon_interval(mac_ctx, - bss_descr->channelId, - &bss_descr->beaconInterval, session_id, - pSession->pCurRoamProfile->csrPersona)) + if (QDF_STATUS_SUCCESS == csr_validate_mcc_beacon_interval( + mac_ctx, + wlan_reg_freq_to_chan(mac_ctx->pdev, + bss_descr->chan_freq), + &bss_descr->beaconInterval, session_id, + pSession->pCurRoamProfile->csrPersona)) return true; return false; } @@ -1908,6 +1910,7 @@ bool csr_is_phy_mode_match(struct mac_context *mac, uint32_t phyMode, eCsrPhyMode phyModeInBssDesc = eCSR_DOT11_MODE_AUTO, phyMode2; enum csr_cfgdot11mode cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_AUTO; uint32_t bitMask, loopCount; + uint8_t bss_chan_id; if (!QDF_IS_STATUS_SUCCESS(csr_get_phy_mode_from_bss(mac, pSirBssDesc, &phyModeInBssDesc, pIes))) @@ -1931,6 +1934,7 @@ bool csr_is_phy_mode_match(struct mac_context *mac, uint32_t phyMode, } } + bss_chan_id = wlan_reg_freq_to_chan(mac->pdev, pSirBssDesc->chan_freq); if ((0 == phyMode) || (eCSR_DOT11_MODE_AUTO & phyMode)) { if (0 != phyMode) { if (eCSR_DOT11_MODE_AUTO & phyMode) { @@ -1943,7 +1947,7 @@ bool csr_is_phy_mode_match(struct mac_context *mac, uint32_t phyMode, fMatch = csr_get_phy_mode_in_use(mac, phyMode2, phyModeInBssDesc, WLAN_REG_IS_5GHZ_CH( - pSirBssDesc->channelId), + bss_chan_id), &cfgDot11ModeToUse); } else { bitMask = 1; @@ -1953,7 +1957,7 @@ bool csr_is_phy_mode_match(struct mac_context *mac, uint32_t phyMode, if (0 != phyMode2 && csr_get_phy_mode_in_use(mac, phyMode2, phyModeInBssDesc, - WLAN_REG_IS_5GHZ_CH(pSirBssDesc->channelId), + WLAN_REG_IS_5GHZ_CH(bss_chan_id), &cfgDot11ModeToUse)) { fMatch = true; break; @@ -1978,8 +1982,7 @@ bool csr_is_phy_mode_match(struct mac_context *mac, uint32_t phyMode, (eCSR_CFG_DOT11_MODE_11AX == cfgDot11ModeToUse))) { /* We cannot do 11n here */ - if (!WLAN_REG_IS_5GHZ_CH - (pSirBssDesc->channelId)) { + if (!WLAN_REG_IS_5GHZ_CH(bss_chan_id)) { cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11G; } else {