diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index e7132d18d631..725552c495d3 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -5859,6 +5859,7 @@ void hdd_roam_profile_init(struct hdd_adapter *adapter) /* Set the numOfChannels to zero to scan all the channels */ roam_profile->ChannelInfo.numOfChannels = 0; roam_profile->ChannelInfo.ChannelList = NULL; + roam_profile->ChannelInfo.freq_list = NULL; roam_profile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 97116a517d3e..a49fd63bcca6 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -16329,6 +16329,7 @@ static int wlan_hdd_cfg80211_connect_start(struct hdd_adapter *adapter, uint8_t value = 0; struct wlan_objmgr_vdev *vdev; uint32_t channel_bonding_mode; + uint32_t oper_freq; hdd_enter(); @@ -16505,11 +16506,15 @@ static int wlan_hdd_cfg80211_connect_start(struct hdd_adapter *adapter, roam_profile->csrPersona = adapter->device_mode; if (operatingChannel) { + oper_freq = wlan_reg_chan_to_freq(hdd_ctx->pdev, + operatingChannel); roam_profile->ChannelInfo.ChannelList = &operatingChannel; + roam_profile->ChannelInfo.freq_list = &oper_freq; roam_profile->ChannelInfo.numOfChannels = 1; } else { roam_profile->ChannelInfo.ChannelList = NULL; + roam_profile->ChannelInfo.freq_list = NULL; roam_profile->ChannelInfo.numOfChannels = 0; } if ((QDF_IBSS_MODE == adapter->device_mode) @@ -16653,6 +16658,7 @@ static int wlan_hdd_cfg80211_connect_start(struct hdd_adapter *adapter, hdd_set_connection_in_progress(false); roam_profile->ChannelInfo.ChannelList = NULL; + roam_profile->ChannelInfo.freq_list = NULL; roam_profile->ChannelInfo.numOfChannels = 0; if ((QDF_STA_MODE == adapter->device_mode) @@ -19112,6 +19118,8 @@ static int __wlan_hdd_cfg80211_join_ibss(struct wiphy *wiphy, channelNum); roam_profile->ChannelInfo.ChannelList = &sta_ctx->conn_info.channel; + roam_profile->ChannelInfo.freq_list = + &sta_ctx->conn_info.freq; } /* Initialize security parameters */ @@ -21238,6 +21246,7 @@ static int __wlan_hdd_cfg80211_set_mon_ch(struct wiphy *wiphy, sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); ch_info = &sta_ctx->ch_info; roam_profile.ChannelInfo.ChannelList = &ch_info->channel; + roam_profile.ChannelInfo.freq_list = &ch_info->freq; roam_profile.ChannelInfo.numOfChannels = 1; roam_profile.phyMode = ch_info->phy_mode; roam_profile.ch_params.ch_width = hdd_map_nl_chan_width(chandef->width); diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 5fbf0d4aa588..a99905098d45 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -3702,6 +3702,8 @@ int wlan_hdd_set_channel(struct wiphy *wiphy, channel); roam_profile->ChannelInfo.ChannelList = &sta_ctx->conn_info.channel; + roam_profile->ChannelInfo.freq_list = + &sta_ctx->conn_info.freq; } else if ((adapter->device_mode == QDF_SAP_MODE) || (adapter->device_mode == QDF_P2P_GO_MODE) ) { diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index c311c131d4ac..f8bc0d71308f 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -6818,6 +6818,7 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan, hdd_debug("Set monitor mode Channel %d", chan); qdf_mem_zero(&roam_profile, sizeof(roam_profile)); roam_profile.ChannelInfo.ChannelList = &ch_info->channel; + roam_profile.ChannelInfo.freq_list = &ch_info->freq; roam_profile.ChannelInfo.numOfChannels = 1; roam_profile.phyMode = ch_info->phy_mode; roam_profile.ch_params.ch_width = bandwidth; diff --git a/core/hdd/src/wlan_hdd_nan_datapath.c b/core/hdd/src/wlan_hdd_nan_datapath.c index dc53fa15b483..5c365c17ad51 100644 --- a/core/hdd/src/wlan_hdd_nan_datapath.c +++ b/core/hdd/src/wlan_hdd_nan_datapath.c @@ -162,6 +162,7 @@ static int hdd_ndi_start_bss(struct hdd_adapter *adapter, uint8_t wmm_mode = 0; struct hdd_context *hdd_ctx; uint8_t value = 0; + uint32_t oper_freq; hdd_enter(); @@ -191,9 +192,11 @@ static int hdd_ndi_start_bss(struct hdd_adapter *adapter, if (!operating_channel) operating_channel = NAN_SOCIAL_CHANNEL_2_4GHZ; + oper_freq = wlan_reg_chan_to_freq(hdd_ctx->pdev, operating_channel); roam_profile->ChannelInfo.numOfChannels = 1; roam_profile->ChannelInfo.ChannelList = &operating_channel; + roam_profile->ChannelInfo.freq_list = &oper_freq; roam_profile->SSIDs.numOfSSIDs = 1; roam_profile->SSIDs.SSIDList->SSID.length = 0; @@ -224,6 +227,7 @@ static int hdd_ndi_start_bss(struct hdd_adapter *adapter, } roam_profile->ChannelInfo.ChannelList = NULL; + roam_profile->ChannelInfo.freq_list = NULL; roam_profile->ChannelInfo.numOfChannels = 0; hdd_exit(); diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index d6ce794e3e54..5b37ba164387 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -2295,6 +2295,8 @@ static QDF_STATUS sap_goto_starting(struct sap_context *sap_ctx, 1; sap_ctx->csr_roamProfile.ChannelInfo.ChannelList = &sap_ctx->csr_roamProfile.operationChannel; + sap_ctx->csr_roamProfile.ChannelInfo.freq_list = + &sap_ctx->csr_roamProfile.op_freq; sap_ctx->csr_roamProfile.operationChannel = (uint8_t)sap_ctx->channel; sap_ctx->csr_roamProfile.op_freq = diff --git a/core/sme/inc/sme_inside.h b/core/sme/inc/sme_inside.h index d0cb9ad10f91..989302af358f 100644 --- a/core/sme/inc/sme_inside.h +++ b/core/sme/inc/sme_inside.h @@ -170,7 +170,7 @@ QDF_STATUS csr_flush_cfg_bg_scan_roam_channel_list(struct mac_context *mac, uint8_t sessionId); QDF_STATUS csr_create_bg_scan_roam_channel_list(struct mac_context *mac, uint8_t sessionId, const uint8_t *pChannelList, - const uint8_t numChannels); + const uint8_t num_chan); #ifdef FEATURE_WLAN_ESE QDF_STATUS csr_create_roam_scan_channel_list(struct mac_context *mac, diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index f6d46381ad2c..a997aac7c244 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -1604,6 +1604,9 @@ QDF_STATUS csr_flush_cfg_bg_scan_roam_channel_list(struct mac_context *mac, qdf_mem_free(pNeighborRoamInfo->cfgParams.channelInfo. ChannelList); pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; + qdf_mem_free(pNeighborRoamInfo->cfgParams.channelInfo. + freq_list); + pNeighborRoamInfo->cfgParams.channelInfo.freq_list = NULL; pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = 0; } return status; @@ -1615,14 +1618,14 @@ QDF_STATUS csr_flush_cfg_bg_scan_roam_channel_list(struct mac_context *mac, */ QDF_STATUS csr_create_bg_scan_roam_channel_list(struct mac_context *mac, uint8_t sessionId, - const uint8_t *pChannelList, - const uint8_t numChannels) + const uint8_t *chan_list, + const uint8_t num_chan) { QDF_STATUS status = QDF_STATUS_SUCCESS; tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &mac->roam.neighborRoamInfo[sessionId]; - pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = numChannels; + pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = num_chan; pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = qdf_mem_malloc(pNeighborRoamInfo->cfgParams.channelInfo. @@ -1633,10 +1636,23 @@ QDF_STATUS csr_create_bg_scan_roam_channel_list(struct mac_context *mac, return QDF_STATUS_E_NOMEM; } + pNeighborRoamInfo->cfgParams.channelInfo.freq_list = + qdf_mem_malloc(sizeof(uint32_t) * num_chan); + if (!pNeighborRoamInfo->cfgParams.channelInfo.freq_list) { + qdf_mem_free(pNeighborRoamInfo->cfgParams.channelInfo. + ChannelList); + pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; + pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = 0; + return QDF_STATUS_E_NOMEM; + } + /* Update the roam global structure */ qdf_mem_copy(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList, - pChannelList, + chan_list, pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels); + sme_chan_to_freq_list(mac->pdev, + pNeighborRoamInfo->cfgParams.channelInfo. + freq_list, chan_list, num_chan); return status; } @@ -1646,7 +1662,7 @@ QDF_STATUS csr_create_bg_scan_roam_channel_list(struct mac_context *mac, * csr_create_roam_scan_channel_list() - create roam scan channel list * @mac: Global mac pointer * @sessionId: session id - * @pChannelList: pointer to channel list + * @chan_list: pointer to channel list * @numChannels: number of channels * @band: band enumeration * @@ -1662,7 +1678,7 @@ QDF_STATUS csr_create_bg_scan_roam_channel_list(struct mac_context *mac, */ QDF_STATUS csr_create_roam_scan_channel_list(struct mac_context *mac, uint8_t sessionId, - uint8_t *pChannelList, + uint8_t *chan_list, uint8_t numChannels, const enum band_info band) { @@ -1670,12 +1686,12 @@ QDF_STATUS csr_create_roam_scan_channel_list(struct mac_context *mac, tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &mac->roam.neighborRoamInfo[sessionId]; - uint8_t outNumChannels = 0; + uint8_t out_num_chan = 0; uint8_t inNumChannels = numChannels; - uint8_t *inPtr = pChannelList; + uint8_t *in_ptr = chan_list; uint8_t i = 0; uint8_t ChannelList[CFG_VALID_CHANNEL_LIST_LEN] = { 0 }; - uint8_t tmpChannelList[CFG_VALID_CHANNEL_LIST_LEN] = { 0 }; + uint8_t tmp_chan_list[CFG_VALID_CHANNEL_LIST_LEN] = { 0 }; uint8_t mergedOutputNumOfChannels = 0; tpCsrChannelInfo currChannelListInfo @@ -1691,32 +1707,32 @@ QDF_STATUS csr_create_roam_scan_channel_list(struct mac_context *mac, occupiedChannels[sessionId]. channelList[0], mac->scan. occupiedChannels[sessionId]. - numChannels, inPtr, + numChannels, in_ptr, inNumChannels, &mergedOutputNumOfChannels); inNumChannels = mergedOutputNumOfChannels; } if (BAND_2G == band) { for (i = 0; i < inNumChannels; i++) { - if (WLAN_REG_IS_24GHZ_CH(inPtr[i]) - && csr_roam_is_channel_valid(mac, inPtr[i])) { - ChannelList[outNumChannels++] = inPtr[i]; + if (WLAN_REG_IS_24GHZ_CH(in_ptr[i]) + && csr_roam_is_channel_valid(mac, in_ptr[i])) { + ChannelList[out_num_chan++] = in_ptr[i]; } } } else if (BAND_5G == band) { for (i = 0; i < inNumChannels; i++) { /* Add 5G Non-DFS channel */ - if (WLAN_REG_IS_5GHZ_CH(inPtr[i]) && - csr_roam_is_channel_valid(mac, inPtr[i]) && - !wlan_reg_is_dfs_ch(mac->pdev, inPtr[i])) { - ChannelList[outNumChannels++] = inPtr[i]; + if (WLAN_REG_IS_5GHZ_CH(in_ptr[i]) && + csr_roam_is_channel_valid(mac, in_ptr[i]) && + !wlan_reg_is_dfs_ch(mac->pdev, in_ptr[i])) { + ChannelList[out_num_chan++] = in_ptr[i]; } } } else if (BAND_ALL == band) { for (i = 0; i < inNumChannels; i++) { - if (csr_roam_is_channel_valid(mac, inPtr[i]) && - !wlan_reg_is_dfs_ch(mac->pdev, inPtr[i])) { - ChannelList[outNumChannels++] = inPtr[i]; + if (csr_roam_is_channel_valid(mac, in_ptr[i]) && + !wlan_reg_is_dfs_ch(mac->pdev, in_ptr[i])) { + ChannelList[out_num_chan++] = in_ptr[i]; } } } else { @@ -1734,29 +1750,46 @@ QDF_STATUS csr_create_roam_scan_channel_list(struct mac_context *mac, */ if ((BAND_ALL == band) && CSR_IS_ROAM_INTRA_BAND_ENABLED(mac)) { csr_neighbor_roam_channels_filter_by_current_band(mac, - sessionId, - ChannelList, - outNumChannels, - tmpChannelList, - &outNumChannels); - qdf_mem_copy(ChannelList, tmpChannelList, outNumChannels); + sessionId, + ChannelList, + out_num_chan, + tmp_chan_list, + &out_num_chan + ); + qdf_mem_copy(ChannelList, tmp_chan_list, out_num_chan); } /* Prepare final roam scan channel list */ - if (outNumChannels) { + if (out_num_chan) { /* Clear the channel list first */ if (currChannelListInfo->ChannelList) { qdf_mem_free(currChannelListInfo->ChannelList); currChannelListInfo->ChannelList = NULL; currChannelListInfo->numOfChannels = 0; } + if (currChannelListInfo->freq_list) { + qdf_mem_free(currChannelListInfo->freq_list); + currChannelListInfo->freq_list = NULL; + currChannelListInfo->numOfChannels = 0; + } currChannelListInfo->ChannelList - = qdf_mem_malloc(outNumChannels * sizeof(uint8_t)); + = qdf_mem_malloc(out_num_chan * sizeof(uint8_t)); if (!currChannelListInfo->ChannelList) { currChannelListInfo->numOfChannels = 0; return QDF_STATUS_E_NOMEM; } + currChannelListInfo->freq_list = + qdf_mem_malloc(out_num_chan * sizeof(uint32_t)); + if (!currChannelListInfo->freq_list) { + qdf_mem_free(currChannelListInfo->ChannelList); + currChannelListInfo->ChannelList = NULL; + currChannelListInfo->numOfChannels = 0; + return QDF_STATUS_E_NOMEM; + } qdf_mem_copy(currChannelListInfo->ChannelList, - ChannelList, outNumChannels); + ChannelList, out_num_chan); + sme_chan_to_freq_list(mac->pdev, + currChannelListInfo->freq_list, + ChannelList, out_num_chan); } return status; } @@ -7590,6 +7623,22 @@ QDF_STATUS csr_roam_copy_profile(struct mac_context *mac, pSrcProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.numOfChannels); } + if (pSrcProfile->ChannelInfo.freq_list) { + pDstProfile->ChannelInfo.freq_list = + qdf_mem_malloc(pSrcProfile->ChannelInfo.numOfChannels); + if (!pDstProfile->ChannelInfo.freq_list) { + qdf_mem_free(pDstProfile->ChannelInfo.ChannelList); + pDstProfile->ChannelInfo.ChannelList = NULL; + pDstProfile->ChannelInfo.numOfChannels = 0; + status = QDF_STATUS_E_NOMEM; + goto end; + } + pDstProfile->ChannelInfo.numOfChannels = + pSrcProfile->ChannelInfo.numOfChannels; + qdf_mem_copy(pDstProfile->ChannelInfo.freq_list, + pSrcProfile->ChannelInfo.freq_list, + pSrcProfile->ChannelInfo.numOfChannels); + } pDstProfile->AuthType = pSrcProfile->AuthType; pDstProfile->akm_list = pSrcProfile->akm_list; pDstProfile->EncryptionType = pSrcProfile->EncryptionType; @@ -7731,9 +7780,17 @@ QDF_STATUS csr_roam_copy_connected_profile(struct mac_context *mac, status = QDF_STATUS_E_NOMEM; goto end; } + pDstProfile->ChannelInfo.freq_list = qdf_mem_malloc(sizeof(uint32_t)); + if (!pDstProfile->ChannelInfo.freq_list) { + qdf_mem_free(pDstProfile->ChannelInfo.ChannelList); + pDstProfile->ChannelInfo.ChannelList = NULL; + status = QDF_STATUS_E_NOMEM; + goto end; + } pDstProfile->ChannelInfo.numOfChannels = 1; pDstProfile->ChannelInfo.ChannelList[0] = wlan_reg_freq_to_chan(mac->pdev, pSrcProfile->op_freq); + pDstProfile->ChannelInfo.freq_list[0] = pSrcProfile->op_freq; pDstProfile->AuthType.numEntries = 1; pDstProfile->AuthType.authType[0] = pSrcProfile->AuthType; pDstProfile->negotiatedAuthType = pSrcProfile->AuthType; @@ -10754,6 +10811,7 @@ csr_roam_prepare_filter_from_profile(struct mac_context *mac_ctx, || (profile_ch_info->ChannelList[0] == 0)) { fltr_ch_info->numOfChannels = 0; fltr_ch_info->ChannelList = NULL; + fltr_ch_info->freq_list = NULL; } else if (profile_ch_info->numOfChannels) { fltr_ch_info->numOfChannels = 0; fltr_ch_info->ChannelList = @@ -10763,6 +10821,15 @@ csr_roam_prepare_filter_from_profile(struct mac_context *mac_ctx, status = QDF_STATUS_E_NOMEM; goto free_filter; } + fltr_ch_info->freq_list = + qdf_mem_malloc(sizeof(*fltr_ch_info->freq_list) * + profile_ch_info->numOfChannels); + if (!fltr_ch_info->freq_list) { + qdf_mem_free(fltr_ch_info->ChannelList); + fltr_ch_info->ChannelList = NULL; + status = QDF_STATUS_E_NOMEM; + goto free_filter; + } for (idx = 0; idx < profile_ch_info->numOfChannels; idx++) { if (csr_roam_is_channel_valid(mac_ctx, diff --git a/core/sme/src/csr/csr_neighbor_roam.c b/core/sme/src/csr/csr_neighbor_roam.c index 6b020496b22e..4214c2d7758f 100644 --- a/core/sme/src/csr/csr_neighbor_roam.c +++ b/core/sme/src/csr/csr_neighbor_roam.c @@ -243,6 +243,9 @@ static void csr_neighbor_roam_reset_channel_info(tpCsrNeighborRoamChannelInfo ChannelList); rChInfo->currentChannelListInfo.ChannelList = NULL; + if (rChInfo->currentChannelListInfo.freq_list) + qdf_mem_free(rChInfo->currentChannelListInfo.freq_list); + rChInfo->currentChannelListInfo.freq_list = NULL; } else { rChInfo->currentChanIndex = 0; } @@ -454,14 +457,30 @@ csr_neighbor_roam_prepare_scan_profile_filter(struct mac_context *mac, pScanFilter->SSIDs.SSIDList = NULL; return QDF_STATUS_E_NOMEM; } + pScanFilter->ChannelInfo.freq_list = + qdf_mem_malloc(num_ch * sizeof(uint32_t)); + if (!pScanFilter->ChannelInfo.freq_list) { + qdf_mem_free(pScanFilter->ChannelInfo.ChannelList); + pScanFilter->ChannelInfo.ChannelList = NULL; + pScanFilter->ChannelInfo.numOfChannels = 0; + qdf_mem_free(pScanFilter->BSSIDs.bssid); + pScanFilter->BSSIDs.bssid = NULL; + qdf_mem_free(pScanFilter->SSIDs.SSIDList); + pScanFilter->SSIDs.SSIDList = NULL; + return QDF_STATUS_E_NOMEM; + } for (i = 0; i < pScanFilter->ChannelInfo.numOfChannels; i++) { pScanFilter->ChannelInfo.ChannelList[i] = nbr_roam_info->roamChannelInfo.currentChannelListInfo. ChannelList[i]; + pScanFilter->ChannelInfo.freq_list[i] = + nbr_roam_info->roamChannelInfo. + currentChannelListInfo.freq_list[i]; } } else { pScanFilter->ChannelInfo.numOfChannels = 0; pScanFilter->ChannelInfo.ChannelList = NULL; + pScanFilter->ChannelInfo.freq_list = NULL; } if (nbr_roam_info->is11rAssoc) @@ -1260,15 +1279,36 @@ QDF_STATUS csr_neighbor_roam_init(struct mac_context *mac, uint8_t sessionId) if (!pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) return QDF_STATUS_E_NOMEM; + pNeighborRoamInfo->cfgParams.channelInfo.freq_list = + qdf_mem_malloc(sizeof(uint32_t) * + mac->mlme_cfg->lfr. + neighbor_scan_channel_list_num); + if (!pNeighborRoamInfo->cfgParams.channelInfo.freq_list) { + qdf_mem_free(pNeighborRoamInfo->cfgParams.channelInfo. + ChannelList); + pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = + NULL; + pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = + 0; + return QDF_STATUS_E_NOMEM; + } } else { pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; + pNeighborRoamInfo->cfgParams.channelInfo.freq_list = NULL; } /* Update the roam global structure from CFG */ qdf_mem_copy(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList, mac->mlme_cfg->lfr.neighbor_scan_channel_list, mac->mlme_cfg->lfr.neighbor_scan_channel_list_num); + sme_chan_to_freq_list(mac->pdev, + pNeighborRoamInfo->cfgParams.channelInfo. + freq_list, + mac->mlme_cfg->lfr.neighbor_scan_channel_list, + mac->mlme_cfg->lfr. + neighbor_scan_channel_list_num); + pNeighborRoamInfo->cfgParams.hi_rssi_scan_max_count = mac->mlme_cfg->lfr.roam_scan_hi_rssi_maxcount; pNeighborRoamInfo->cfgParams.hi_rssi_scan_rssi_delta = @@ -1300,6 +1340,10 @@ QDF_STATUS csr_neighbor_roam_init(struct mac_context *mac, uint8_t sessionId) qdf_mem_free(pNeighborRoamInfo->cfgParams.channelInfo. ChannelList); pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; + qdf_mem_free(pNeighborRoamInfo->cfgParams.channelInfo. + freq_list); + pNeighborRoamInfo->cfgParams.channelInfo.freq_list = NULL; + pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = 0; return QDF_STATUS_E_RESOURCES; } @@ -1309,6 +1353,8 @@ QDF_STATUS csr_neighbor_roam_init(struct mac_context *mac, uint8_t sessionId) numOfChannels = 0; pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; + pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.freq_list = + NULL; pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = false; status = csr_neighbor_roam_init11r_assoc_info(mac); @@ -1317,6 +1363,7 @@ QDF_STATUS csr_neighbor_roam_init(struct mac_context *mac, uint8_t sessionId) qdf_mem_free(pNeighborRoamInfo->cfgParams.channelInfo. ChannelList); pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; + pNeighborRoamInfo->cfgParams.channelInfo.freq_list = NULL; csr_ll_close(&pNeighborRoamInfo->roamableAPList); return QDF_STATUS_E_RESOURCES; } @@ -1355,6 +1402,7 @@ void csr_neighbor_roam_close(struct mac_context *mac, uint8_t sessionId) ChannelList); pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; + pNeighborRoamInfo->cfgParams.channelInfo.freq_list = NULL; /* Should free up the nodes in the list before closing the * double Linked list @@ -1371,6 +1419,8 @@ void csr_neighbor_roam_close(struct mac_context *mac, uint8_t sessionId) pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; + pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.freq_list = + NULL; pNeighborRoamInfo->roamChannelInfo.currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX; pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo. @@ -1502,6 +1552,22 @@ static QDF_STATUS csr_neighbor_roam_process_handoff_req( profile->ChannelInfo.ChannelList[0] = roam_ctrl_info->handoffReqInfo.channel; + if (!profile->ChannelInfo.freq_list) { + profile->ChannelInfo.freq_list = + qdf_mem_malloc(sizeof(*profile->ChannelInfo.freq_list) * + profile->ChannelInfo.numOfChannels); + if (!profile->ChannelInfo.freq_list) { + qdf_mem_free(profile->ChannelInfo.ChannelList); + profile->ChannelInfo.ChannelList = NULL; + profile->ChannelInfo.numOfChannels = 0; + status = QDF_STATUS_E_NOMEM; + goto end; + } + } + profile->ChannelInfo.freq_list[0] = + wlan_reg_chan_to_freq(mac_ctx->pdev, + roam_ctrl_info->handoffReqInfo.channel); + /* * For User space connect requests, the scan has already been done. * So, check if the BSS descriptor exists in the scan cache and diff --git a/core/sme/src/csr/csr_util.c b/core/sme/src/csr/csr_util.c index 21de1e8fd43a..2667e5a9c756 100644 --- a/core/sme/src/csr/csr_util.c +++ b/core/sme/src/csr/csr_util.c @@ -5940,6 +5940,10 @@ void csr_release_profile(struct mac_context *mac, struct csr_roam_profile *pProf qdf_mem_free(pProfile->ChannelInfo.ChannelList); pProfile->ChannelInfo.ChannelList = NULL; } + if (pProfile->ChannelInfo.freq_list) { + qdf_mem_free(pProfile->ChannelInfo.freq_list); + pProfile->ChannelInfo.freq_list = NULL; + } csr_free_fils_profile_info(pProfile); qdf_mem_zero(pProfile, sizeof(struct csr_roam_profile)); } @@ -5956,6 +5960,10 @@ void csr_free_scan_filter(struct mac_context *mac, tCsrScanResultFilter qdf_mem_free(pScanFilter->ChannelInfo.ChannelList); pScanFilter->ChannelInfo.ChannelList = NULL; } + if (pScanFilter->ChannelInfo.freq_list) { + qdf_mem_free(pScanFilter->ChannelInfo.freq_list); + pScanFilter->ChannelInfo.freq_list = NULL; + } if (pScanFilter->SSIDs.SSIDList) { qdf_mem_free(pScanFilter->SSIDs.SSIDList); pScanFilter->SSIDs.SSIDList = NULL; diff --git a/core/sme/src/rrm/sme_rrm.c b/core/sme/src/rrm/sme_rrm.c index f4e64e6c2d21..aff662d60830 100644 --- a/core/sme/src/rrm/sme_rrm.c +++ b/core/sme/src/rrm/sme_rrm.c @@ -420,6 +420,7 @@ void sme_reset_ese_bcn_req_in_progress(tpRrmSMEContext sme_rrm_ctx) * @mac_ctx: pointer to mac context * @num_chan: number of channels * @chan_list: list of channels to fetch the result from + * @freq_list: list of channel frequencies to fetch the result from * @measurementdone: Flag to indicate measurement done or no * * This function is called to get the scan result from CSR and send the beacon @@ -430,6 +431,7 @@ void sme_reset_ese_bcn_req_in_progress(tpRrmSMEContext sme_rrm_ctx) static QDF_STATUS sme_rrm_send_scan_result(struct mac_context *mac_ctx, uint8_t num_chan, uint8_t *chan_list, + uint32_t *freq_list, uint8_t measurementdone) { mac_handle_t mac_handle = MAC_HANDLE(mac_ctx); @@ -466,6 +468,7 @@ static QDF_STATUS sme_rrm_send_scan_result(struct mac_context *mac_ctx, filter.ChannelInfo.numOfChannels = num_chan; filter.ChannelInfo.ChannelList = chan_list; + filter.ChannelInfo.freq_list = freq_list; filter.fMeasurement = true; /* @@ -659,6 +662,8 @@ static QDF_STATUS sme_rrm_scan_request_callback(mac_handle_t mac_handle, QDF_STATUS qdf_status; uint32_t session_id; bool valid_result = true; + uint8_t *chan_list, ch_idx, num_chan; + uint32_t *freq_list; /* * RRM scan response received after roaming to different AP. @@ -675,13 +680,12 @@ static QDF_STATUS sme_rrm_scan_request_callback(mac_handle_t mac_handle, /* if any more channels are pending, start a timer of a random value * within randomization interval. */ - if (((pSmeRrmContext->currentIndex + 1) < - pSmeRrmContext->channelList.numOfChannels) && valid_result) { - sme_rrm_send_scan_result(mac, 1, - &pSmeRrmContext->channelList. - ChannelList[pSmeRrmContext - ->currentIndex], - false); + chan_list = pSmeRrmContext->channelList.ChannelList; + freq_list = pSmeRrmContext->channelList.freq_list; + ch_idx = pSmeRrmContext->currentIndex; + num_chan = pSmeRrmContext->channelList.numOfChannels; + if (((ch_idx + 1) < num_chan) && valid_result) { + sme_rrm_send_scan_result(mac, 1, chan_list, freq_list, false); /* Advance the current index. */ pSmeRrmContext->currentIndex++; /* start the timer to issue next request. */ @@ -698,6 +702,8 @@ static QDF_STATUS sme_rrm_scan_request_callback(mac_handle_t mac_handle, if (QDF_IS_STATUS_ERROR(qdf_status)) { qdf_mem_free(pSmeRrmContext->channelList.ChannelList); pSmeRrmContext->channelList.ChannelList = NULL; + qdf_mem_free(pSmeRrmContext->channelList.freq_list); + pSmeRrmContext->channelList.freq_list = NULL; sme_reset_ese_bcn_req_in_progress(pSmeRrmContext); } @@ -705,13 +711,11 @@ static QDF_STATUS sme_rrm_scan_request_callback(mac_handle_t mac_handle, /* Done with the measurement. Clean up all context and send a * message to PE with measurement done flag set. */ - sme_rrm_send_scan_result(mac, 1, - &pSmeRrmContext->channelList. - ChannelList[pSmeRrmContext - ->currentIndex], - true); + sme_rrm_send_scan_result(mac, 1, chan_list, freq_list, true); qdf_mem_free(pSmeRrmContext->channelList.ChannelList); pSmeRrmContext->channelList.ChannelList = NULL; + qdf_mem_free(pSmeRrmContext->channelList.freq_list); + pSmeRrmContext->channelList.freq_list = NULL; sme_reset_ese_bcn_req_in_progress(pSmeRrmContext); } @@ -764,6 +768,8 @@ static QDF_STATUS sme_rrm_issue_scan_req(struct mac_context *mac_ctx) tpRrmSMEContext sme_rrm_ctx = &mac_ctx->rrm.rrmSmeContext; uint32_t session_id; tSirScanType scan_type; + uint8_t *chan_list, ch_idx; + uint32_t *freq_list; status = csr_roam_get_session_id_from_bssid(mac_ctx, &sme_rrm_ctx->sessionBssId, &session_id); @@ -917,11 +923,12 @@ static QDF_STATUS sme_rrm_issue_scan_req(struct mac_context *mac_ctx) * pScanResult->timer >= rrm_scan_timer */ rrm_scan_timer = 0; - if ((sme_rrm_ctx->currentIndex + 1) < - sme_rrm_ctx->channelList.numOfChannels) { - sme_rrm_send_scan_result(mac_ctx, 1, - &sme_rrm_ctx->channelList.ChannelList[ - sme_rrm_ctx->currentIndex], false); + chan_list = sme_rrm_ctx->channelList.ChannelList; + freq_list = sme_rrm_ctx->channelList.freq_list; + ch_idx = sme_rrm_ctx->currentIndex; + if ((ch_idx + 1) < sme_rrm_ctx->channelList.numOfChannels) { + sme_rrm_send_scan_result(mac_ctx, 1, chan_list, + freq_list, false); /* Advance the current index. */ sme_rrm_ctx->currentIndex++; sme_rrm_issue_scan_req(mac_ctx); @@ -934,9 +941,8 @@ static QDF_STATUS sme_rrm_issue_scan_req(struct mac_context *mac_ctx) * Done with the measurement. Clean up all context and * send a message to PE with measurement done flag set. */ - sme_rrm_send_scan_result(mac_ctx, 1, - &sme_rrm_ctx->channelList.ChannelList[ - sme_rrm_ctx->currentIndex], true); + sme_rrm_send_scan_result(mac_ctx, 1, chan_list, + freq_list, true); goto free_ch_lst; } } @@ -952,6 +958,8 @@ send_ind: free_ch_lst: qdf_mem_free(sme_rrm_ctx->channelList.ChannelList); sme_rrm_ctx->channelList.ChannelList = NULL; + qdf_mem_free(sme_rrm_ctx->channelList.freq_list); + sme_rrm_ctx->channelList.freq_list = NULL; return status; } @@ -981,6 +989,8 @@ static QDF_STATUS sme_rrm_fill_scan_channels(uint8_t *country, if (sme_rrm_context->channelList.numOfChannels == 0) { qdf_mem_free(sme_rrm_context->channelList.ChannelList); sme_rrm_context->channelList.ChannelList = NULL; + qdf_mem_free(sme_rrm_context->channelList.freq_list); + sme_rrm_context->channelList.freq_list = NULL; sme_err("No channels populated with requested operation class and current country, Hence abort the rrm operation"); return QDF_STATUS_E_FAILURE; } @@ -1064,6 +1074,19 @@ QDF_STATUS sme_rrm_process_beacon_report_req_ind(struct mac_context *mac, goto cleanup; } + if (pSmeRrmContext->channelList.freq_list) { + qdf_mem_free(pSmeRrmContext->channelList.freq_list); + pSmeRrmContext->channelList.freq_list = NULL; + } + pSmeRrmContext->channelList.freq_list = + qdf_mem_malloc(sizeof(uint32_t) * len); + if (!pSmeRrmContext->channelList.freq_list) { + qdf_mem_free(pSmeRrmContext->channelList.ChannelList); + pSmeRrmContext->channelList.ChannelList = NULL; + status = QDF_STATUS_E_NOMEM; + goto cleanup; + } + csr_get_cfg_valid_channels(mac, pSmeRrmContext->channelList. ChannelList, &len); @@ -1099,6 +1122,19 @@ QDF_STATUS sme_rrm_process_beacon_report_req_ind(struct mac_context *mac, goto cleanup; } + if (pSmeRrmContext->channelList.freq_list) { + qdf_mem_free(pSmeRrmContext->channelList.freq_list); + pSmeRrmContext->channelList.freq_list = NULL; + } + pSmeRrmContext->channelList.freq_list = + qdf_mem_malloc(sizeof(uint32_t) * len); + if (!pSmeRrmContext->channelList.ChannelList) { + qdf_mem_free(pSmeRrmContext->channelList.ChannelList); + pSmeRrmContext->channelList.ChannelList = NULL; + status = QDF_STATUS_E_NOMEM; + goto cleanup; + } + if (pBeaconReq->channelInfo.channelNum != 255) { if (csr_roam_is_channel_valid (mac, pBeaconReq->channelInfo.channelNum)) @@ -1645,6 +1681,10 @@ QDF_STATUS rrm_close(struct mac_context *mac) qdf_mem_free(pSmeRrmContext->channelList.ChannelList); pSmeRrmContext->channelList.ChannelList = NULL; } + if (pSmeRrmContext->channelList.freq_list) { + qdf_mem_free(pSmeRrmContext->channelList.freq_list); + pSmeRrmContext->channelList.freq_list = NULL; + } qdf_status = qdf_mc_timer_destroy(&pSmeRrmContext->IterMeasTimer); if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {