diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index 2a444756f044..f38fd4820f50 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -1226,6 +1226,8 @@ hdd_send_new_ap_channel_info(struct net_device *dev, { union iwreq_data wrqu; struct bss_description *descriptor = roam_info->bss_desc; + mac_handle_t mac_hdl; + struct wlan_objmgr_pdev *pdev; if (!descriptor) { hdd_err("bss descriptor is null"); @@ -1235,10 +1237,20 @@ hdd_send_new_ap_channel_info(struct net_device *dev, * Send the Channel event, the supplicant needs this to generate * the Adjacent AP report. */ - hdd_debug("Sending up an SIOCGIWFREQ, channelId: %d", - descriptor->channelId); + hdd_debug("Sending up an SIOCGIWFREQ, channel freq: %d", + descriptor->chan_freq); memset(&wrqu, '\0', sizeof(wrqu)); - wrqu.freq.m = descriptor->channelId; + mac_hdl = hdd_adapter_get_mac_handle(adapter); + if (!mac_hdl) { + hdd_err("MAC handle invalid, falling back!"); + return; + } + pdev = MAC_CONTEXT(mac_hdl)->pdev; + if (!pdev) { + hdd_err("pdev invalid in MAC context, falling back!"); + return; + } + wrqu.freq.m = wlan_reg_freq_to_chan(pdev, descriptor->chan_freq); wrqu.freq.e = 0; wrqu.freq.i = 0; wireless_send_event(adapter->dev, SIOCGIWFREQ, &wrqu, NULL); diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index ec5980a8f19c..18a011845180 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -660,6 +660,7 @@ struct bss_description { int8_t sinr; /* channelId what peer sent in beacon/probersp. */ uint8_t channelId; + uint32_t chan_freq; /* channelId on which we are parked at. */ /* used only in scan case. */ uint8_t channelIdSelf; diff --git a/core/mac/src/pe/lim/lim_api.c b/core/mac/src/pe/lim/lim_api.c index 7d615c7aae7d..8d5132649d9a 100644 --- a/core/mac/src/pe/lim/lim_api.c +++ b/core/mac/src/pe/lim/lim_api.c @@ -2170,8 +2170,15 @@ lim_roam_fill_bss_descr(struct mac_context *mac, bss_desc_ptr->scansystimensec = qdf_get_monotonic_boottime_ns(); if (parsed_frm_ptr->dsParamsPresent) { bss_desc_ptr->channelId = parsed_frm_ptr->channelNumber; + bss_desc_ptr->chan_freq = + wlan_reg_chan_to_freq(mac->pdev, + parsed_frm_ptr->channelNumber); } else if (parsed_frm_ptr->HTInfo.present) { bss_desc_ptr->channelId = parsed_frm_ptr->HTInfo.primaryChannel; + bss_desc_ptr->chan_freq = + wlan_reg_chan_to_freq(mac->pdev, + parsed_frm_ptr->HTInfo. + primaryChannel); } else { /* * If DS Params or HTIE is not present in the probe resp or @@ -2179,6 +2186,7 @@ lim_roam_fill_bss_descr(struct mac_context *mac, * to fill the channel in the BSS descriptor.*/ bss_desc_ptr->channelId = cds_freq_to_chan(roam_synch_ind_ptr->chan_freq); + bss_desc_ptr->chan_freq = roam_synch_ind_ptr->chan_freq; } bss_desc_ptr->channelIdSelf = bss_desc_ptr->channelId; diff --git a/core/mac/src/pe/lim/lim_scan_result_utils.c b/core/mac/src/pe/lim/lim_scan_result_utils.c index 8b6480c14f27..ac7e7689ef34 100644 --- a/core/mac/src/pe/lim/lim_scan_result_utils.c +++ b/core/mac/src/pe/lim/lim_scan_result_utils.c @@ -69,7 +69,7 @@ lim_collect_bss_description(struct mac_context *mac, uint8_t *pBody; uint32_t ieLen = 0; tpSirMacMgmtHdr pHdr; - uint8_t channelNum; + uint8_t channel_num; uint8_t rxChannel; uint8_t rfBand = 0; @@ -132,15 +132,16 @@ lim_collect_bss_description(struct mac_context *mac, * This fix will work for 5Ghz 11n devices, but for 11a devices, we have to rely on RXP routing flag to get the correct channel. * So The problem of incorrect channel reporting in 5Ghz will still remain for 11a devices. */ - pBssDescr->channelId = lim_get_channel_from_beacon(mac, pBPR); + channel_num = lim_get_channel_from_beacon(mac, pBPR); + pBssDescr->channelId = channel_num; + pBssDescr->chan_freq = wlan_reg_chan_to_freq(mac->pdev, channel_num); pBssDescr->channelIdSelf = pBssDescr->channelId; pBssDescr->rx_channel = rxChannel; /* set the network type in bss description */ - channelNum = pBssDescr->channelId; pBssDescr->nwType = - lim_get_nw_type(mac, channelNum, SIR_MAC_MGMT_FRAME, pBPR); + lim_get_nw_type(mac, channel_num, SIR_MAC_MGMT_FRAME, pBPR); /* Copy RSSI & SINR from BD */ pBssDescr->rssi = (int8_t) WMA_GET_RX_RSSI_NORMALIZED(pRxPacketInfo); diff --git a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c index 453e539efea8..ef9167f67a1a 100644 --- a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c +++ b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c @@ -549,6 +549,10 @@ void lim_send_sme_start_bss_rsp(struct mac_context *mac, pSirSmeRsp->bssDescription.channelId = pe_session->currentOperChannel; + pSirSmeRsp->bssDescription.chan_freq = + wlan_reg_chan_to_freq(mac->pdev, + pe_session-> + currentOperChannel); if (!LIM_IS_NDI_ROLE(pe_session)) { curLen = pe_session->schBeaconOffsetBegin - ieOffset; diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index a7934cd229e0..eee56e7fbddc 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -11579,6 +11579,7 @@ csr_roam_chk_lnk_swt_ch_ind(struct mac_context *mac_ctx, tSirSmeRsp *msg_ptr) session->pConnectBssDesc->channelId = wlan_reg_freq_to_chan(mac_ctx->pdev, pSwitchChnInd->freq); + session->pConnectBssDesc->chan_freq = pSwitchChnInd->freq; ie_len = csr_get_ielen_from_bss_description( session->pConnectBssDesc); diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c index f455f7ed0110..f793be4377cf 100644 --- a/core/sme/src/csr/csr_api_scan.c +++ b/core/sme/src/csr/csr_api_scan.c @@ -1784,6 +1784,8 @@ QDF_STATUS csr_scan_create_entry_in_scan_cache(struct mac_context *mac, qdf_mem_copy(pNewBssDescriptor->bssId, bssid.bytes, sizeof(tSirMacAddr)); pNewBssDescriptor->channelId = channel; + pNewBssDescriptor->chan_freq = wlan_reg_chan_to_freq(mac->pdev, + channel); if (!csr_scan_append_bss_description(mac, pNewBssDescriptor)) { sme_err("csr_scan_append_bss_description failed"); status = QDF_STATUS_E_FAILURE; @@ -2640,6 +2642,9 @@ static QDF_STATUS csr_fill_bss_from_scan_entry(struct mac_context *mac_ctx, /* channelId what peer sent in beacon/probersp. */ bss_desc->channelId = scan_entry->channel.chan_idx; + bss_desc->chan_freq = + wlan_reg_chan_to_freq(mac_ctx->pdev, + scan_entry->channel.chan_idx); /* channelId on which we are parked at. */ /* used only in scan case. */ bss_desc->channelIdSelf =