From 65d64256374a0bf5238101d89d3722efb3f911fc Mon Sep 17 00:00:00 2001 From: Will Huang Date: Tue, 16 Jul 2019 17:57:42 +0800 Subject: [PATCH] qcacld-3.0: Replace channel ID with frequency (bss_description 3) Prepare to replace channel id with channel frequency of struct bss_description, first cleanup reference of channel id of struct bss_description in wlan_hdd_assoc.c wlan_hdd_cfg80211.c wlan_hdd_main.c lim_assoc_utils.c lim_ft.c lim_process_sme_req_messages.c lim_sme_req_utils.c rrm_api.c sme_api.c nan_datapath_api.c sme_rrm.c, use channel frequency instead. Change-Id: I980f74d77af97df2b2ade61250d44a606c76a7ef CRs-Fixed: 2491488 --- core/hdd/src/wlan_hdd_assoc.c | 41 +--- core/hdd/src/wlan_hdd_cfg80211.c | 24 +-- core/hdd/src/wlan_hdd_main.c | 12 +- core/mac/src/pe/lim/lim_assoc_utils.c | 193 ++++++++---------- core/mac/src/pe/lim/lim_assoc_utils.h | 17 ++ core/mac/src/pe/lim/lim_ft.c | 72 +++---- .../src/pe/lim/lim_process_sme_req_messages.c | 10 +- core/mac/src/pe/lim/lim_sme_req_utils.c | 5 +- core/mac/src/pe/rrm/rrm_api.c | 5 +- core/sme/src/common/sme_api.c | 37 ++-- core/sme/src/nan/nan_datapath_api.c | 4 +- core/sme/src/rrm/sme_rrm.c | 21 +- 12 files changed, 191 insertions(+), 250 deletions(-) diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index aa67a4e3ba9d..c2a98935ac53 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -2328,8 +2328,6 @@ static void hdd_send_re_assoc_event(struct net_device *dev, uint8_t *final_req_ie = NULL; tCsrRoamConnectedProfile roam_profile; struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); - int chan_no; - int freq; qdf_mem_zero(&roam_profile, sizeof(roam_profile)); @@ -2384,14 +2382,8 @@ static void hdd_send_re_assoc_event(struct net_device *dev, qdf_mem_copy(rsp_rsn_ie, assoc_rsp, len); qdf_mem_zero(rsp_rsn_ie + len, IW_GENERIC_IE_MAX - len); - chan_no = roam_info->bss_desc->channelId; - if (chan_no <= 14) - freq = ieee80211_channel_to_frequency(chan_no, - NL80211_BAND_2GHZ); - else - freq = ieee80211_channel_to_frequency(chan_no, - NL80211_BAND_5GHZ); - chan = ieee80211_get_channel(adapter->wdev.wiphy, freq); + chan = ieee80211_get_channel(adapter->wdev.wiphy, + roam_info->bss_desc->chan_freq); sme_roam_get_connect_profile(hdd_ctx->mac_handle, adapter->vdev_id, &roam_profile); @@ -3127,11 +3119,9 @@ hdd_association_completion_handler(struct hdd_adapter *adapter, } hdd_debug("ft_carrier_on is %d, sending roamed indication", ft_carrier_on); - chan = - ieee80211_get_channel - (adapter->wdev.wiphy, - (int)roam_info->bss_desc-> - channelId); + chan = ieee80211_get_channel( + adapter->wdev.wiphy, + roam_info->bss_desc->chan_freq); roam_bss = wlan_cfg80211_get_bss( @@ -3620,8 +3610,6 @@ static void hdd_roam_ibss_indication_handler(struct hdd_adapter *adapter, struct cfg80211_bss *bss; #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) struct ieee80211_channel *chan; - int chan_no; - unsigned int freq; #endif /* we created the IBSS, notify supplicant */ hdd_debug("%s: created ibss " QDF_MAC_ADDR_STR, @@ -3643,25 +3631,18 @@ static void hdd_roam_ibss_indication_handler(struct hdd_adapter *adapter, WLAN_CONTROL_PATH); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) - chan_no = roam_info->bss_desc->channelId; - - if (chan_no <= 14) - freq = ieee80211_channel_to_frequency(chan_no, - HDD_NL80211_BAND_2GHZ); - else - freq = ieee80211_channel_to_frequency(chan_no, - HDD_NL80211_BAND_5GHZ); - - chan = ieee80211_get_channel(adapter->wdev.wiphy, freq); + chan = ieee80211_get_channel( + adapter->wdev.wiphy, + roam_info->bss_desc->chan_freq); if (chan) cfg80211_ibss_joined(adapter->dev, bss->bssid, chan, GFP_KERNEL); else - hdd_warn("%s: chanId: %d, can't find channel", - adapter->dev->name, - (int)roam_info->bss_desc->channelId); + hdd_warn("%s: freq: %d, can't find channel", + adapter->dev->name, + roam_info->bss_desc->chan_freq); #else cfg80211_ibss_joined(adapter->dev, bss->bssid, GFP_KERNEL); diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 8fadcc774c3d..3ac0eac5c4d1 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -15731,7 +15731,7 @@ wlan_hdd_inform_bss_frame(struct hdd_adapter *adapter, uint32_t ie_length = wlan_hdd_get_frame_len(bss_desc); const char *ie = ((ie_length != 0) ? (const char *)&bss_desc->ieFields : NULL); - uint32_t freq, i; + uint32_t i; struct cfg80211_bss *bss_status = NULL; struct hdd_context *hdd_ctx; struct timespec ts; @@ -15790,26 +15790,10 @@ wlan_hdd_inform_bss_frame(struct hdd_adapter *adapter, (u16) (IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); } - if (bss_desc->channelId <= ARRAY_SIZE(hdd_channels_2_4_ghz) && - (wiphy->bands[HDD_NL80211_BAND_2GHZ])) { - freq = - ieee80211_channel_to_frequency(bss_desc->channelId, - HDD_NL80211_BAND_2GHZ); - } else if ((bss_desc->channelId > ARRAY_SIZE(hdd_channels_2_4_ghz)) - && (wiphy->bands[HDD_NL80211_BAND_5GHZ])) { - freq = - ieee80211_channel_to_frequency(bss_desc->channelId, - HDD_NL80211_BAND_5GHZ); - } else { - hdd_err("Invalid channel: %d", bss_desc->channelId); - qdf_mem_free(bss_data.mgmt); - return NULL; - } - - bss_data.chan = ieee80211_get_channel(wiphy, freq); + bss_data.chan = ieee80211_get_channel(wiphy, bss_desc->chan_freq); if (!bss_data.chan) { - hdd_err("chan pointer is NULL, chan_no: %d freq: %d", - bss_desc->channelId, freq); + hdd_err("chan pointer is NULL, chan freq: %d", + bss_desc->chan_freq); qdf_mem_free(bss_data.mgmt); return NULL; } diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 7b4b92ceae8e..219dd415862a 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -6706,17 +6706,9 @@ void hdd_connect_result(struct net_device *dev, const u8 *bssid, if (WLAN_STATUS_SUCCESS == status) { struct ieee80211_channel *chan; - int freq; - int chan_no = roam_info->bss_desc->channelId; - if (chan_no <= 14) - freq = ieee80211_channel_to_frequency(chan_no, - HDD_NL80211_BAND_2GHZ); - else - freq = ieee80211_channel_to_frequency(chan_no, - HDD_NL80211_BAND_5GHZ); - - chan = ieee80211_get_channel(adapter->wdev.wiphy, freq); + chan = ieee80211_get_channel(adapter->wdev.wiphy, + roam_info->bss_desc->chan_freq); bss = wlan_cfg80211_get_bss(adapter->wdev.wiphy, chan, bssid, roam_info->u.pConnectedProfile->SSID.ssId, roam_info->u.pConnectedProfile->SSID.length); diff --git a/core/mac/src/pe/lim/lim_assoc_utils.c b/core/mac/src/pe/lim/lim_assoc_utils.c index 43e8e63e0214..82fd87f81a5e 100644 --- a/core/mac/src/pe/lim/lim_assoc_utils.c +++ b/core/mac/src/pe/lim/lim_assoc_utils.c @@ -3523,6 +3523,51 @@ static inline void lim_set_sta_ctx_twt(tAddStaParams *sta_ctx, } #endif +void lim_sta_add_bss_update_ht_parameter(uint8_t bss_chan_id, + tDot11fIEHTCaps* ht_cap, + tDot11fIEHTInfo* ht_inf, + bool chan_width_support, + tpAddBssParams add_bss) +{ + if (!ht_cap->present) + return; + + add_bss->htCapable = ht_cap->present; + pe_debug("htCapable: %d", add_bss->htCapable); + + if (!ht_inf->present) + return; + + add_bss->htOperMode = ht_inf->opMode; + add_bss->dualCTSProtection = ht_inf->dualCTSProtection; + if (chan_width_support && ht_cap->supportedChannelWidthSet) { + add_bss->ch_width = ht_inf->recommendedTxWidthSet; + if (ht_inf->secondaryChannelOffset == + PHY_DOUBLE_CHANNEL_LOW_PRIMARY) + add_bss->ch_center_freq_seg0 = bss_chan_id + 2; + else if (ht_inf->secondaryChannelOffset == + PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) + add_bss->ch_center_freq_seg0 = bss_chan_id - 2; + } else { + add_bss->ch_width = CH_WIDTH_20MHZ; + add_bss->ch_center_freq_seg0 = 0; + } + add_bss->llnNonGFCoexist = ht_inf->nonGFDevicesPresent; + add_bss->fLsigTXOPProtectionFullSupport = + ht_inf->lsigTXOPProtectionFullSupport; + add_bss->fRIFSMode = ht_inf->rifsMode; + pe_debug("htOperMode: %d dualCTSProtection: %d txChannelWidth: %d", + add_bss->htOperMode, + add_bss->dualCTSProtection, + add_bss->ch_width); + pe_debug("center_freq_0: %d llnNonGFCoexist: %d", + add_bss->ch_center_freq_seg0, + add_bss->llnNonGFCoexist); + pe_debug("fLsigTXOPProtectionFullSupport: %d fRIFSMode: %d", + add_bss->fLsigTXOPProtectionFullSupport, + add_bss->fRIFSMode); +} + /** * limSendAddBss() * @@ -3559,7 +3604,8 @@ QDF_STATUS lim_sta_send_add_bss(struct mac_context *mac, tpSirAssocRsp pAssocRsp tpAddBssParams pAddBssParams = NULL; uint32_t retCode; tpDphHashNode sta = NULL; - uint8_t chanWidthSupp = 0; + bool chan_width_support = false; + uint8_t bss_chan_id; bool is_vht_cap_in_vendor_ie = false; tDot11fIEVHTCaps *vht_caps = NULL; tDot11fIEVHTOperation *vht_oper = NULL; @@ -3652,60 +3698,22 @@ QDF_STATUS lim_sta_send_add_bss(struct mac_context *mac, tpSirAssocRsp pAssocRsp pAddBssParams->dot11_mode = pe_session->dot11mode; pe_debug("dot11_mode: %d", pAddBssParams->dot11_mode); - if (IS_DOT11_MODE_HT(pe_session->dot11mode)) - chanWidthSupp = lim_get_ht_capability(mac, - eHT_SUPPORTED_CHANNEL_WIDTH_SET, - pe_session); - + bss_chan_id = wlan_reg_freq_to_chan(mac->pdev, + bssDescription->chan_freq); /* Use the advertised capabilities from the received beacon/PR */ - if (IS_DOT11_MODE_HT(pe_session->dot11mode) - && (pAssocRsp->HTCaps.present)) { - pAddBssParams->htCapable = pAssocRsp->HTCaps.present; - pe_debug("htCapable: %d", pAddBssParams->htCapable); - if (pBeaconStruct->HTInfo.present) { - pAddBssParams->htOperMode = - (tSirMacHTOperatingMode) pAssocRsp->HTInfo.opMode; - pAddBssParams->dualCTSProtection = - (uint8_t) pAssocRsp->HTInfo.dualCTSProtection; - - if ((pAssocRsp->HTCaps.supportedChannelWidthSet) - && (chanWidthSupp)) { - pAddBssParams->ch_width = (uint8_t) - pAssocRsp->HTInfo.recommendedTxWidthSet; - if (pAssocRsp->HTInfo.secondaryChannelOffset == - PHY_DOUBLE_CHANNEL_LOW_PRIMARY) - pAddBssParams->ch_center_freq_seg0 = - bssDescription->channelId + 2; - else if (pAssocRsp->HTInfo.secondaryChannelOffset == - PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) - pAddBssParams->ch_center_freq_seg0 = - bssDescription->channelId - 2; - } else { - pAddBssParams->ch_width = CH_WIDTH_20MHZ; - pAddBssParams->ch_center_freq_seg0 = 0; - } - pAddBssParams->llnNonGFCoexist = - (uint8_t) pAssocRsp->HTInfo.nonGFDevicesPresent; - pAddBssParams->fLsigTXOPProtectionFullSupport = - (uint8_t) pAssocRsp->HTInfo. - lsigTXOPProtectionFullSupport; - pAddBssParams->fRIFSMode = pAssocRsp->HTInfo.rifsMode; - - pe_debug("htOperMode: %d dualCTSProtection: %d txChannelWidth: %d center_freq_0: %d", - pAddBssParams->htOperMode, - pAddBssParams->dualCTSProtection, - pAddBssParams->ch_width, - pAddBssParams->ch_center_freq_seg0); - - pe_debug("llnNonGFCoexist: %d " - "fLsigTXOPProtectionFullSupport: %d fRIFSMode %d", - pAddBssParams->llnNonGFCoexist, - pAddBssParams->fLsigTXOPProtectionFullSupport, - pAddBssParams->fRIFSMode); - } + if (IS_DOT11_MODE_HT(pe_session->dot11mode)) { + chan_width_support = + lim_get_ht_capability(mac, + eHT_SUPPORTED_CHANNEL_WIDTH_SET, + pe_session); + lim_sta_add_bss_update_ht_parameter(bss_chan_id, + &pAssocRsp->HTCaps, + &pAssocRsp->HTInfo, + chan_width_support, + pAddBssParams); } - pAddBssParams->currentOperChannel = bssDescription->channelId; + pAddBssParams->currentOperChannel = bss_chan_id; pe_debug("currentOperChannel %d", pAddBssParams->currentOperChannel); if (pe_session->vhtCapability && (pAssocRsp->VHTCaps.present)) { pAddBssParams->vhtCapable = pAssocRsp->VHTCaps.present; @@ -3843,7 +3851,7 @@ QDF_STATUS lim_sta_send_add_bss(struct mac_context *mac, tpSirAssocRsp pAssocRsp * width has been taken into account for calculating * pe_session->ch_width */ - if (chanWidthSupp && + if (chan_width_support && ((pAssocRsp->HTCaps.supportedChannelWidthSet) || (pBeaconStruct->HTCaps.supportedChannelWidthSet))) { pAddBssParams->staContext.ch_width = @@ -4095,7 +4103,8 @@ QDF_STATUS lim_sta_send_add_bss_pre_assoc(struct mac_context *mac, uint8_t updat tpAddBssParams pAddBssParams = NULL; uint32_t retCode; tSchBeaconStruct *pBeaconStruct; - uint8_t chanWidthSupp = 0; + bool chan_width_support = false; + uint8_t bss_chan_id; tDot11fIEVHTOperation *vht_oper = NULL; tDot11fIEVHTCaps *vht_caps = NULL; uint32_t listen_interval = MLME_CFG_LISTEN_INTERVAL; @@ -4192,63 +4201,23 @@ QDF_STATUS lim_sta_send_add_bss_pre_assoc(struct mac_context *mac, uint8_t updat pAddBssParams->nwType, pAddBssParams->shortSlotTimeSupported, pAddBssParams->llaCoexist, pAddBssParams->llbCoexist, pAddBssParams->llgCoexist, pAddBssParams->ht20Coexist); + + bss_chan_id = wlan_reg_freq_to_chan(mac->pdev, + bssDescription->chan_freq); /* Use the advertised capabilities from the received beacon/PR */ - if (IS_DOT11_MODE_HT(pe_session->dot11mode) - && (pBeaconStruct->HTCaps.present)) { - pAddBssParams->htCapable = pBeaconStruct->HTCaps.present; - pe_debug("htCapable: %d", pAddBssParams->htCapable); - if (pBeaconStruct->HTInfo.present) { - pAddBssParams->htOperMode = - (tSirMacHTOperatingMode) pBeaconStruct->HTInfo. - opMode; - pAddBssParams->dualCTSProtection = - (uint8_t) pBeaconStruct->HTInfo.dualCTSProtection; - - chanWidthSupp = - lim_get_ht_capability(mac, - eHT_SUPPORTED_CHANNEL_WIDTH_SET, - pe_session); - if ((pBeaconStruct->HTCaps.supportedChannelWidthSet) - && (chanWidthSupp)) { - pAddBssParams->ch_width = - (uint8_t) pBeaconStruct->HTInfo. - recommendedTxWidthSet; - if (pBeaconStruct->HTInfo.secondaryChannelOffset == - PHY_DOUBLE_CHANNEL_LOW_PRIMARY) - pAddBssParams->ch_center_freq_seg0 = - bssDescription->channelId + 2; - - if (pBeaconStruct->HTInfo.secondaryChannelOffset == - PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) - pAddBssParams->ch_center_freq_seg0 = - bssDescription->channelId - 2; - } else { - pAddBssParams->ch_width = CH_WIDTH_20MHZ; - pAddBssParams->ch_center_freq_seg0 = 0; - } - pAddBssParams->llnNonGFCoexist = - (uint8_t) pBeaconStruct->HTInfo.nonGFDevicesPresent; - pAddBssParams->fLsigTXOPProtectionFullSupport = - (uint8_t) pBeaconStruct->HTInfo. - lsigTXOPProtectionFullSupport; - pAddBssParams->fRIFSMode = - pBeaconStruct->HTInfo.rifsMode; - - pe_debug("htOperMode: %d dualCTSProtection: %d txChannelWidthSet: %d center_freq_seg0: %d", - pAddBssParams->htOperMode, - pAddBssParams->dualCTSProtection, - pAddBssParams->txChannelWidthSet, - pAddBssParams->ch_center_freq_seg0); - - pe_debug("llnNonGFCoexist: %d " - "fLsigTXOPProtectionFullSupport: %d fRIFSMode %d", - pAddBssParams->llnNonGFCoexist, - pAddBssParams->fLsigTXOPProtectionFullSupport, - pAddBssParams->fRIFSMode); - } + if (IS_DOT11_MODE_HT(pe_session->dot11mode)) { + chan_width_support = + lim_get_ht_capability(mac, + eHT_SUPPORTED_CHANNEL_WIDTH_SET, + pe_session); + lim_sta_add_bss_update_ht_parameter(bss_chan_id, + &pBeaconStruct->HTCaps, + &pBeaconStruct->HTInfo, + chan_width_support, + pAddBssParams); } - pAddBssParams->currentOperChannel = bssDescription->channelId; + pAddBssParams->currentOperChannel = bss_chan_id; pe_debug("currentOperChannel %d", pAddBssParams->currentOperChannel); @@ -4265,9 +4234,7 @@ QDF_STATUS lim_sta_send_add_bss_pre_assoc(struct mac_context *mac, uint8_t updat } - if ((vht_oper) && - vht_oper->chanWidth && - chanWidthSupp) { + if (vht_oper && vht_oper->chanWidth && chan_width_support) { pAddBssParams->ch_center_freq_seg0 = vht_oper->chanCenterFreqSeg1; pAddBssParams->ch_center_freq_seg1 = @@ -4369,8 +4336,8 @@ QDF_STATUS lim_sta_send_add_bss_pre_assoc(struct mac_context *mac, uint8_t updat lim_intersect_ap_he_caps(pe_session, pAddBssParams, pBeaconStruct, NULL); - if ((pBeaconStruct->HTCaps.supportedChannelWidthSet) && - (chanWidthSupp)) { + if (pBeaconStruct->HTCaps.supportedChannelWidthSet && + chan_width_support) { pAddBssParams->staContext.ch_width = (uint8_t) pBeaconStruct->HTInfo. recommendedTxWidthSet; diff --git a/core/mac/src/pe/lim/lim_assoc_utils.h b/core/mac/src/pe/lim/lim_assoc_utils.h index 226306f8ec75..da452b2b95b0 100644 --- a/core/mac/src/pe/lim/lim_assoc_utils.h +++ b/core/mac/src/pe/lim/lim_assoc_utils.h @@ -185,6 +185,23 @@ void lim_update_assoc_sta_datas(struct mac_context *mac, tpDphHashNode sta, tpSirAssocRsp pAssocRsp, struct pe_session *pe_session); +/** + * lim_sta_add_bss_update_ht_parameter() - function to update ht related + * parameters when add bss request + * @bss_chan_id: channel number of bss + * @ht_cap: ht capability extract from beacon/assoc response + * @ht_inf: ht information extract from beacon/assoc response + * @chan_width_support: local wide bandwith support capability + * @add_bss: add bss request struct to be updated + * + * Return: none + */ +void lim_sta_add_bss_update_ht_parameter(uint8_t bss_chan_id, + tDot11fIEHTCaps* ht_cap, + tDot11fIEHTInfo* ht_inf, + bool chan_width_support, + tpAddBssParams add_bss); + QDF_STATUS lim_sta_send_add_bss(struct mac_context *mac, tpSirAssocRsp pAssocRsp, tpSchBeaconStruct pBeaconStruct, struct bss_description *bssDescription, diff --git a/core/mac/src/pe/lim/lim_ft.c b/core/mac/src/pe/lim/lim_ft.c index 811a619692a0..8906dff26345 100644 --- a/core/mac/src/pe/lim/lim_ft.c +++ b/core/mac/src/pe/lim/lim_ft.c @@ -118,7 +118,8 @@ void lim_ft_prepare_add_bss_req(struct mac_context *mac, { tpAddBssParams pAddBssParams = NULL; tAddStaParams *sta_ctx; - uint8_t chanWidthSupp = 0; + bool chan_width_support = false; + uint8_t bss_chan_id; tSchBeaconStruct *pBeaconStruct; /* Nothing to be done if the session is not in STA mode */ @@ -194,10 +195,20 @@ void lim_ft_prepare_add_bss_req(struct mac_context *mac, pAddBssParams->rmfEnabled = ft_session->limRmfEnabled; #endif + bss_chan_id = wlan_reg_freq_to_chan(mac->pdev, + bssDescription->chan_freq); /* Use the advertised capabilities from the received beacon/PR */ if (IS_DOT11_MODE_HT(ft_session->dot11mode) && (pBeaconStruct->HTCaps.present)) { - pAddBssParams->htCapable = pBeaconStruct->HTCaps.present; + chan_width_support = + lim_get_ht_capability(mac, + eHT_SUPPORTED_CHANNEL_WIDTH_SET, + ft_session); + lim_sta_add_bss_update_ht_parameter(bss_chan_id, + &pBeaconStruct->HTCaps, + &pBeaconStruct->HTInfo, + chan_width_support, + pAddBssParams); qdf_mem_copy(&pAddBssParams->staContext.capab_info, &pBeaconStruct->capabilityInfo, sizeof(pAddBssParams->staContext.capab_info)); @@ -205,44 +216,9 @@ void lim_ft_prepare_add_bss_req(struct mac_context *mac, (uint8_t *) &pBeaconStruct->HTCaps + sizeof(uint8_t), sizeof(pAddBssParams->staContext.ht_caps)); - - if (pBeaconStruct->HTInfo.present) { - pAddBssParams->htOperMode = - (tSirMacHTOperatingMode) pBeaconStruct->HTInfo. - opMode; - pAddBssParams->dualCTSProtection = - (uint8_t) pBeaconStruct->HTInfo.dualCTSProtection; - - chanWidthSupp = lim_get_ht_capability(mac, - eHT_SUPPORTED_CHANNEL_WIDTH_SET, - ft_session); - if ((pBeaconStruct->HTCaps.supportedChannelWidthSet) && - (chanWidthSupp)) { - pAddBssParams->ch_width = (uint8_t) - pBeaconStruct->HTInfo.recommendedTxWidthSet; - if (pBeaconStruct->HTInfo.secondaryChannelOffset == - PHY_DOUBLE_CHANNEL_LOW_PRIMARY) - pAddBssParams->ch_center_freq_seg0 = - bssDescription->channelId + 2; - else if (pBeaconStruct->HTInfo.secondaryChannelOffset == - PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) - pAddBssParams->ch_center_freq_seg0 = - bssDescription->channelId - 2; - } else { - pAddBssParams->ch_width = CH_WIDTH_20MHZ; - pAddBssParams->ch_center_freq_seg0 = 0; - } - pAddBssParams->llnNonGFCoexist = - (uint8_t) pBeaconStruct->HTInfo.nonGFDevicesPresent; - pAddBssParams->fLsigTXOPProtectionFullSupport = - (uint8_t) pBeaconStruct->HTInfo. - lsigTXOPProtectionFullSupport; - pAddBssParams->fRIFSMode = - pBeaconStruct->HTInfo.rifsMode; - } } - pAddBssParams->currentOperChannel = bssDescription->channelId; + pAddBssParams->currentOperChannel = bss_chan_id; ft_session->htSecondaryChannelOffset = pBeaconStruct->HTInfo.secondaryChannelOffset; sta_ctx = &pAddBssParams->staContext; @@ -250,7 +226,8 @@ void lim_ft_prepare_add_bss_req(struct mac_context *mac, if (ft_session->vhtCapability && ft_session->vhtCapabilityPresentInBeacon) { pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present; - if (pBeaconStruct->VHTOperation.chanWidth && chanWidthSupp) { + if (pBeaconStruct->VHTOperation.chanWidth && + chan_width_support) { pAddBssParams->ch_width = pBeaconStruct->VHTOperation.chanWidth + 1; pAddBssParams->ch_center_freq_seg0 = @@ -337,8 +314,8 @@ void lim_ft_prepare_add_bss_req(struct mac_context *mac, (uint8_t) pBeaconStruct->HTCaps.greenField; pAddBssParams->staContext.lsigTxopProtection = (uint8_t) pBeaconStruct->HTCaps.lsigTXOPProtection; - if ((pBeaconStruct->HTCaps.supportedChannelWidthSet) && - (chanWidthSupp)) { + if (pBeaconStruct->HTCaps.supportedChannelWidthSet && + chan_width_support) { pAddBssParams->staContext.ch_width = (uint8_t) pBeaconStruct->HTInfo.recommendedTxWidthSet; } else { @@ -362,8 +339,8 @@ void lim_ft_prepare_add_bss_req(struct mac_context *mac, lim_intersect_ap_he_caps(ft_session, pAddBssParams, pBeaconStruct, NULL); - if ((pBeaconStruct->HTCaps.supportedChannelWidthSet) && - (chanWidthSupp)) { + if (pBeaconStruct->HTCaps.supportedChannelWidthSet && + chan_width_support) { sta_ctx->ch_width = (uint8_t) pBeaconStruct->HTInfo.recommendedTxWidthSet; if (pAddBssParams->staContext.vhtCapable && @@ -554,6 +531,7 @@ void lim_fill_ft_session(struct mac_context *mac, struct pe_session *ft_session, struct pe_session *pe_session) { uint8_t currentBssUapsd; + uint8_t bss_chan_id; int8_t localPowerConstraint; int8_t regMax; tSchBeaconStruct *pBeaconStruct; @@ -596,7 +574,9 @@ void lim_fill_ft_session(struct mac_context *mac, qdf_mem_copy(ft_session->ssId.ssId, pBeaconStruct->ssId.ssId, ft_session->ssId.length); /* Copy The channel Id to the session Table */ - ft_session->limReassocChannelId = pbssDescription->channelId; + bss_chan_id = + wlan_reg_freq_to_chan(mac->pdev, pbssDescription->chan_freq); + ft_session->limReassocChannelId = bss_chan_id; ft_session->curr_op_freq = pbssDescription->chan_freq; ft_session->limRFBand = lim_get_rf_band(wlan_reg_freq_to_chan( mac->pdev, ft_session->curr_op_freq)); @@ -651,11 +631,11 @@ void lim_fill_ft_session(struct mac_context *mac, if (pBeaconStruct->HTInfo.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ft_session->ch_center_freq_seg0 = - pbssDescription->channelId + 2; + bss_chan_id + 2; else if (pBeaconStruct->HTInfo.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) ft_session->ch_center_freq_seg0 = - pbssDescription->channelId - 2; + bss_chan_id - 2; else pe_warn("Invalid sec ch offset"); } diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c index 6f953d80e2f8..f6cd60489bb0 100644 --- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c @@ -1236,6 +1236,7 @@ __lim_process_sme_join_req(struct mac_context *mac_ctx, void *msg_buf) tSirResultCodes ret_code = eSIR_SME_SUCCESS; uint32_t val = 0; uint8_t session_id; + uint8_t bss_chan_id; struct pe_session *session = NULL; uint8_t sme_session_id = 0; int8_t local_power_constraint = 0, reg_max = 0; @@ -1295,6 +1296,8 @@ __lim_process_sme_join_req(struct mac_context *mac_ctx, void *msg_buf) /* check for the existence of start BSS session */ session = pe_find_session_by_bssid(mac_ctx, bss_desc->bssId, &session_id); + bss_chan_id = wlan_reg_freq_to_chan(mac_ctx->pdev, + bss_desc->chan_freq); if (session) { pe_err("Session(%d) Already exists for BSSID: " @@ -1343,7 +1346,7 @@ __lim_process_sme_join_req(struct mac_context *mac_ctx, void *msg_buf) /* Update the beacon/probe filter in mac_ctx */ lim_set_bcn_probe_filter(mac_ctx, session, &sme_join_req->ssId, - bss_desc->channelId); + bss_chan_id); } session->max_amsdu_num = sme_join_req->max_amsdu_num; session->enable_session_twt_support = @@ -1908,8 +1911,9 @@ static void __lim_process_sme_reassoc_req(struct mac_context *mac_ctx, session_entry->pLimReAssocReq->bssDescription.bssId, sizeof(tSirMacAddr)); - session_entry->limReassocChannelId = - session_entry->pLimReAssocReq->bssDescription.channelId; + session_entry->limReassocChannelId = wlan_reg_freq_to_chan( + mac_ctx->pdev, + session_entry->pLimReAssocReq->bssDescription.chan_freq); session_entry->reAssocHtSupportedChannelWidthSet = (session_entry->pLimReAssocReq->cbMode) ? 1 : 0; diff --git a/core/mac/src/pe/lim/lim_sme_req_utils.c b/core/mac/src/pe/lim/lim_sme_req_utils.c index 9f0c07c86440..b40e51e7b85d 100644 --- a/core/mac/src/pe/lim/lim_sme_req_utils.c +++ b/core/mac/src/pe/lim/lim_sme_req_utils.c @@ -346,12 +346,9 @@ lim_is_bss_descr_valid_in_sme_req_message(struct mac_context *mac, { uint8_t valid = true; - if (QDF_IS_ADDR_BROADCAST(pBssDescr->bssId) || !pBssDescr->channelId) { + if (QDF_IS_ADDR_BROADCAST(pBssDescr->bssId) || !pBssDescr->chan_freq) valid = false; - goto end; - } -end: return valid; } /*** end lim_is_bss_descr_valid_in_sme_req_message() ***/ diff --git a/core/mac/src/pe/rrm/rrm_api.c b/core/mac/src/pe/rrm/rrm_api.c index 8fb8ff0b2213..f1045b129914 100644 --- a/core/mac/src/pe/rrm/rrm_api.c +++ b/core/mac/src/pe/rrm/rrm_api.c @@ -863,7 +863,10 @@ rrm_process_beacon_report_xmit(struct mac_context *mac_ctx, continue; beacon_report->regClass = beacon_xmit_ind->regClass; if (bss_desc) { - beacon_report->channel = bss_desc->channelId; + beacon_report->channel = + wlan_reg_freq_to_chan( + mac_ctx->pdev, + bss_desc->chan_freq); qdf_mem_copy(beacon_report->measStartTime, bss_desc->startTSF, sizeof(bss_desc->startTSF)); diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 7819f29806af..bc58a821b416 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -2570,6 +2570,7 @@ QDF_STATUS sme_get_ap_channel_from_scan_cache( tCsrScanResultFilter *scan_filter = NULL; tScanResultHandle filtered_scan_result = NULL; struct bss_description first_ap_profile; + uint8_t bss_chan_id; if (!mac_ctx) { QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, @@ -2617,12 +2618,15 @@ QDF_STATUS sme_get_ap_channel_from_scan_cache( csr_get_bssdescr_from_scan_handle(filtered_scan_result, &first_ap_profile); *scan_cache = filtered_scan_result; - if (0 != first_ap_profile.channelId) { - *ap_chnl_id = first_ap_profile.channelId; + bss_chan_id = wlan_reg_freq_to_chan( + mac_ctx->pdev, + first_ap_profile.chan_freq); + if (bss_chan_id) { + *ap_chnl_id = bss_chan_id; QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, - FL("Found best AP & its on chnl[%d]"), - first_ap_profile.channelId); + FL("Found best AP & its on freq[%d]"), + first_ap_profile.chan_freq); } else { /* * This means scan result is empty @@ -13685,6 +13689,7 @@ QDF_STATUS sme_get_beacon_frm(mac_handle_t mac_handle, struct bss_description *bss_descp; struct scan_result_list *bss_list; uint32_t ie_len; + uint8_t bss_chan_id; scan_filter = qdf_mem_malloc(sizeof(tCsrScanResultFilter)); if (!scan_filter) { @@ -13740,8 +13745,10 @@ QDF_STATUS sme_get_beacon_frm(mac_handle_t mac_handle, */ ie_len = bss_descp->length + sizeof(bss_descp->length) - (uint16_t)(offsetof(struct bss_description, ieFields[0])); - sme_debug("found bss_descriptor ie_len: %d channel %d", - ie_len, bss_descp->channelId); + bss_chan_id = wlan_reg_freq_to_chan(mac_ctx->pdev, + bss_descp->chan_freq); + sme_debug("found bss_descriptor ie_len: %d frequency %d", + ie_len, bss_descp->chan_freq); /* include mac header and fixed params along with IEs in frame */ *frame_len = SIR_MAC_HDR_LEN_3A + SIR_MAC_B_PR_SSID_OFFSET + ie_len; @@ -13754,7 +13761,7 @@ QDF_STATUS sme_get_beacon_frm(mac_handle_t mac_handle, sme_prepare_beacon_from_bss_descp(*frame_buf, bss_descp, bssid, ie_len); if (!*channel) - *channel = bss_descp->channelId; + *channel = bss_chan_id; free_scan_flter: /* free scan filter and exit */ if (scan_filter) { @@ -14569,6 +14576,7 @@ static bool sme_get_status_for_candidate(mac_handle_t mac_handle, struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle); struct wlan_mlme_mbo *mbo_cfg; int8_t current_rssi_mcc_thres; + uint8_t bss_chan_id, conn_bss_chan_id; if (!(mac_ctx->mlme_cfg)) { pe_err("mlme cfg is NULL"); @@ -14592,6 +14600,11 @@ static bool sme_get_status_for_candidate(mac_handle_t mac_handle, if (trans_reason == MBO_TRANSITION_REASON_LOAD_BALANCING || trans_reason == MBO_TRANSITION_REASON_TRANSITIONING_TO_PREMIUM_AP) { + bss_chan_id = wlan_reg_freq_to_chan(mac_ctx->pdev, + bss_desc->chan_freq); + conn_bss_chan_id = wlan_reg_freq_to_chan( + mac_ctx->pdev, + conn_bss_desc->chan_freq); /* * MCC rejection * If moving to candidate's channel will result in MCC scenario @@ -14601,7 +14614,7 @@ static bool sme_get_status_for_candidate(mac_handle_t mac_handle, */ current_rssi_mcc_thres = mbo_cfg->mbo_current_rssi_mcc_thres; if ((conn_bss_desc->rssi > current_rssi_mcc_thres) && - csr_is_mcc_channel(mac_ctx, bss_desc->channelId)) { + csr_is_mcc_channel(mac_ctx, bss_chan_id)) { sme_err("Candidate BSS "QDF_MAC_ADDR_STR" causes MCC, hence reject", QDF_MAC_ADDR_ARRAY(bss_desc->bssId)); info->status = @@ -14616,8 +14629,8 @@ static bool sme_get_status_for_candidate(mac_handle_t mac_handle, * less than mbo_candidate_rssi_btc_thres, then reject the * candidate with MBO reason code 2. */ - if (WLAN_REG_IS_5GHZ_CH(conn_bss_desc->channelId) && - WLAN_REG_IS_24GHZ_CH(bss_desc->channelId) && + if (WLAN_REG_IS_5GHZ_CH(conn_bss_chan_id) && + WLAN_REG_IS_24GHZ_CH(bss_chan_id) && is_bt_in_progress && (bss_desc->rssi < mbo_cfg->mbo_candidate_rssi_btc_thres)) { sme_err("Candidate BSS "QDF_MAC_ADDR_STR" causes BT coex, hence reject", @@ -14633,9 +14646,9 @@ static bool sme_get_status_for_candidate(mac_handle_t mac_handle, * reject the candidate with MBO reason code 5. */ if (policy_mgr_is_safe_channel(mac_ctx->psoc, - conn_bss_desc->channelId) && + conn_bss_chan_id) && !(policy_mgr_is_safe_channel(mac_ctx->psoc, - bss_desc->channelId))) { + bss_chan_id))) { sme_err("High interference expected if transitioned to BSS " QDF_MAC_ADDR_STR" hence reject", QDF_MAC_ADDR_ARRAY(bss_desc->bssId)); diff --git a/core/sme/src/nan/nan_datapath_api.c b/core/sme/src/nan/nan_datapath_api.c index 086efe5f7795..77e47f18a588 100644 --- a/core/sme/src/nan/nan_datapath_api.c +++ b/core/sme/src/nan/nan_datapath_api.c @@ -103,8 +103,10 @@ void csr_roam_save_ndi_connected_info(struct mac_context *mac_ctx, connect_profile->BSSType = roam_profile->BSSType; connect_profile->modifyProfileFields.uapsd_mask = roam_profile->uapsd_mask; - connect_profile->operationChannel = bssdesc->channelId; connect_profile->op_freq = bssdesc->chan_freq; + connect_profile->operationChannel = + wlan_reg_freq_to_chan(mac_ctx->pdev, + bssdesc->chan_freq); connect_profile->beaconInterval = 0; qdf_mem_copy(&connect_profile->Keys, &roam_profile->Keys, sizeof(roam_profile->Keys)); diff --git a/core/sme/src/rrm/sme_rrm.c b/core/sme/src/rrm/sme_rrm.c index 1afc7c551496..f4e64e6c2d21 100644 --- a/core/sme/src/rrm/sme_rrm.c +++ b/core/sme/src/rrm/sme_rrm.c @@ -212,11 +212,11 @@ sme_rrm_send_beacon_report_xmit_ind(struct mac_context *mac_ctx, tmp_bss_desc[i] = beacon_rep->pBssDescription[i]; sme_debug("RRM Result Bssid = " QDF_MAC_ADDR_STR - " chan= %d, rssi = -%d", - QDF_MAC_ADDR_ARRAY( - beacon_rep->pBssDescription[i]->bssId), - beacon_rep->pBssDescription[i]->channelId, - beacon_rep->pBssDescription[i]->rssi * (-1)); + " freq= %d, rssi = -%d", + QDF_MAC_ADDR_ARRAY( + beacon_rep->pBssDescription[i]->bssId), + beacon_rep->pBssDescription[i]->chan_freq, + beacon_rep->pBssDescription[i]->rssi * (-1)); beacon_rep->numBssDesc++; if (++i >= SIR_BCN_REPORT_MAX_BSS_DESC) break; @@ -331,8 +331,9 @@ static QDF_STATUS sme_ese_send_beacon_req_scan_results( ie_len = GET_IE_LEN_IN_BSS(bss_desc->length); bcn_rpt_fields = &bcn_report->bcnRepBssInfo[j].bcnReportFields; - bcn_rpt_fields->ChanNum = - bss_desc->channelId; + bcn_rpt_fields->ChanNum = wlan_reg_freq_to_chan( + mac_ctx->pdev, + bss_desc->chan_freq); bcn_report->bcnRepBssInfo[j].bcnReportFields.Spare = 0; if (cur_meas_req) bcn_rpt_fields->MeasDuration = @@ -359,9 +360,9 @@ static QDF_STATUS sme_ese_send_beacon_req_scan_results( continue; bcn_report->bcnRepBssInfo[j].ieLen = out_ie_len; - sme_debug("Bssid"QDF_MAC_ADDR_STR" Channel: %d Rssi: %d", - QDF_MAC_ADDR_ARRAY(bss_desc->bssId), - bss_desc->channelId, (-1) * bss_desc->rssi); + sme_debug("Bssid"QDF_MAC_ADDR_STR" Freq:%d Rssi:%d", + QDF_MAC_ADDR_ARRAY(bss_desc->bssId), + bss_desc->chan_freq, (-1) * bss_desc->rssi); bcn_report->numBss++; if (++j >= SIR_BCN_REPORT_MAX_BSS_DESC) break;