diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index d8d227468933..c5901a1b8387 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -17607,7 +17607,8 @@ csr_fetch_ch_lst_from_occupied_lst(tpAniSirGlobal mac_ctx, */ static QDF_STATUS csr_fetch_valid_ch_lst(tpAniSirGlobal mac_ctx, - tSirRoamOffloadScanReq *req_buf) + tSirRoamOffloadScanReq *req_buf, + uint8_t session_id) { QDF_STATUS status; uint32_t host_channels = 0; @@ -17618,6 +17619,7 @@ csr_fetch_valid_ch_lst(tpAniSirGlobal mac_ctx, uint16_t cnt = 0; bool is_unsafe_chan; qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); + eCsrBand band = eCSR_BAND_ALL; if (!qdf_ctx) { cds_err("qdf_ctx is NULL"); @@ -17637,10 +17639,27 @@ csr_fetch_valid_ch_lst(tpAniSirGlobal mac_ctx, "Failed to get the valid channel list"); return status; } + + if (CSR_IS_ROAM_INTRA_BAND_ENABLED(mac_ctx)) { + band = csr_get_rf_band(mac_ctx->roam.roamSession[session_id]. + connectedProfile.operationChannel); + sme_debug("updated band %d operational ch %d", band, + mac_ctx->roam.roamSession[session_id]. + connectedProfile.operationChannel); + } + ch_lst = mac_ctx->roam.validChannelList; mac_ctx->roam.numValidChannels = host_channels; + for (i = 0; i < mac_ctx->roam.numValidChannels; i++) { - ch_lst++; + if (!csr_check_band_channel_match(band, *ch_lst)) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, + ("ignoring non-intra band channel %d"), + *ch_lst); + ch_lst++; + continue; + } + if ((!mac_ctx->roam.configParam.allowDFSChannelRoam || (mac_ctx->roam.configParam.sta_roam_policy.dfs_mode == CSR_STA_ROAM_POLICY_DFS_DISABLED)) && @@ -17675,6 +17694,12 @@ csr_fetch_valid_ch_lst(tpAniSirGlobal mac_ctx, ch_lst++; } req_buf->ValidChannelCount = num_channels; + + if (CSR_IS_ROAM_INTRA_BAND_ENABLED(mac_ctx)) { + req_buf->ChannelCacheType = CHANNEL_LIST_STATIC; + req_buf->ConnectedNetwork.ChannelCount = num_channels; + } + return status; } @@ -17815,41 +17840,48 @@ csr_create_roam_scan_offload_request(tpAniSirGlobal mac_ctx, ese_neighbor_list_recvd, curr_ch_lst_info->numOfChannels); #endif - if (ese_neighbor_list_recvd || curr_ch_lst_info->numOfChannels == 0) { - /* - * Retrieve the Channel Cache either from ini or from the - * occupied channels list. Give Preference to INI Channels - */ - if (roam_info->cfgParams.channelInfo.numOfChannels) { - status = csr_fetch_ch_lst_from_ini(mac_ctx, roam_info, - req_buf); - if (!QDF_IS_STATUS_SUCCESS(status)) { - QDF_TRACE(QDF_MODULE_ID_SME, - QDF_TRACE_LEVEL_DEBUG, - "Fetch channel list from ini failed"); - qdf_mem_free(req_buf); - return NULL; - } - } else { - csr_fetch_ch_lst_from_occupied_lst(mac_ctx, session_id, - reason, req_buf, roam_info); - } - } -#ifdef FEATURE_WLAN_ESE - else { - /* - * If ESE is enabled, and a neighbor Report is received,then - * Ignore the INI Channels or the Occupied Channel List. - * Consider the channels in the neighbor list sent by the ESE AP - */ - csr_fetch_ch_lst_from_received_list(mac_ctx, roam_info, - curr_ch_lst_info, req_buf); - } -#endif + if (!CSR_IS_ROAM_INTRA_BAND_ENABLED(mac_ctx)) { + if (ese_neighbor_list_recvd || + curr_ch_lst_info->numOfChannels == 0) { + /* + * Retrieve the Channel Cache either from ini or from + * the occupied channels list. + * Give Preference to INI Channels + */ + if (roam_info->cfgParams.channelInfo.numOfChannels) { + status = csr_fetch_ch_lst_from_ini(mac_ctx, + roam_info, + req_buf); + if (!QDF_IS_STATUS_SUCCESS(status)) { + QDF_TRACE(QDF_MODULE_ID_SME, + QDF_TRACE_LEVEL_DEBUG, + "Fetch channel list from ini failed"); + qdf_mem_free(req_buf); + return NULL; + } + } else { + csr_fetch_ch_lst_from_occupied_lst(mac_ctx, + session_id, reason, req_buf, + roam_info); + } + } +#ifdef FEATURE_WLAN_ESE + else { + /* + * If ESE is enabled, and a neighbor Report is received, + * then Ignore the INI Channels or the Occupied Channel + * List. Consider the channels in the neighbor list sent + * by the ESE AP + */ + csr_fetch_ch_lst_from_received_list(mac_ctx, roam_info, + curr_ch_lst_info, req_buf); + } +#endif + } if (req_buf->ConnectedNetwork.ChannelCount == 0) { /* Maintain the Valid Channels List */ - status = csr_fetch_valid_ch_lst(mac_ctx, req_buf); + status = csr_fetch_valid_ch_lst(mac_ctx, req_buf, session_id); if (!QDF_IS_STATUS_SUCCESS(status)) { QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, "Fetch channel list fail"); diff --git a/core/sme/src/csr/csr_inside_api.h b/core/sme/src/csr/csr_inside_api.h index 7614c04125b3..a5dc0a16b379 100644 --- a/core/sme/src/csr/csr_inside_api.h +++ b/core/sme/src/csr/csr_inside_api.h @@ -1174,4 +1174,16 @@ static inline bool csr_is_mfpc_capable(struct sDot11fIERSN *rsn) } #endif +/** + * csr_get_rf_band() + * + * @channel: channel number + * + * This function is used to translate channel number to band + * + * Return: SIR_BAND_2_4_GHZ - if 2.4GHZ channel + * SIR_BAND_5_GHZ - if 5GHZ channel + */ +tSirRFBand csr_get_rf_band(uint8_t channel); + #endif /* CSR_INSIDE_API_H__ */ diff --git a/core/sme/src/csr/csr_neighbor_roam.c b/core/sme/src/csr/csr_neighbor_roam.c index d0b10331f90a..13d5b2b324c9 100644 --- a/core/sme/src/csr/csr_neighbor_roam.c +++ b/core/sme/src/csr/csr_neighbor_roam.c @@ -490,17 +490,7 @@ csr_neighbor_roam_prepare_scan_profile_filter(tpAniSirGlobal pMac, return QDF_STATUS_SUCCESS; } -/** - * get_rf_band() - * - * @channel: channel number - * - * This function is used to translate channel number to band - * - * Return: SIR_BAND_2_4_GHZ - if 2.4GHZ channel - * SIR_BAND_5_GHZ - if 5GHZ channel - */ -static tSirRFBand get_rf_band(uint8_t channel) +tSirRFBand csr_get_rf_band(uint8_t channel) { if ((channel >= SIR_11A_CHANNEL_BEGIN) && (channel <= SIR_11A_CHANNEL_END)) @@ -558,8 +548,8 @@ QDF_STATUS csr_neighbor_roam_channels_filter_by_current_band(tpAniSirGlobal return QDF_STATUS_E_INVAL; } for (i = 0; i < inputNumOfChannels; i++) { - if (get_rf_band(currAPoperationChannel) == - get_rf_band(pInputChannelList[i])) { + if (csr_get_rf_band(currAPoperationChannel) == + csr_get_rf_band(pInputChannelList[i])) { pOutputChannelList[numChannels] = pInputChannelList[i]; numChannels++; } diff --git a/core/sme/src/p2p/p2p_api.c b/core/sme/src/p2p/p2p_api.c index e98dfb01b3e4..be9afdefcf21 100644 --- a/core/sme/src/p2p/p2p_api.c +++ b/core/sme/src/p2p/p2p_api.c @@ -199,19 +199,6 @@ QDF_STATUS sme_p2p_close(tHalHandle hHal) return QDF_STATUS_SUCCESS; } -tSirRFBand get_rf_band(uint8_t channel) -{ - if ((channel >= SIR_11A_CHANNEL_BEGIN) && - (channel <= SIR_11A_CHANNEL_END)) - return SIR_BAND_5_GHZ; - - if ((channel >= SIR_11B_CHANNEL_BEGIN) && - (channel <= SIR_11B_CHANNEL_END)) - return SIR_BAND_2_4_GHZ; - - return SIR_BAND_UNKNOWN; -} - /* * p2p_remain_on_channel() - * API to post the remain on channel command. @@ -239,7 +226,7 @@ QDF_STATUS p2p_remain_on_channel(tHalHandle hHal, uint8_t sessionId, if (pRemainChlCmd == NULL) return QDF_STATUS_E_FAILURE; - if (SIR_BAND_5_GHZ == get_rf_band(channel)) + if (SIR_BAND_5_GHZ == csr_get_rf_band(channel)) phyMode = WNI_CFG_PHY_MODE_11A; else phyMode = WNI_CFG_PHY_MODE_11G;