diff --git a/core/mac/src/pe/lim/lim_assoc_utils.c b/core/mac/src/pe/lim/lim_assoc_utils.c index 5c97adb4fd22..a2a392a934b6 100644 --- a/core/mac/src/pe/lim/lim_assoc_utils.c +++ b/core/mac/src/pe/lim/lim_assoc_utils.c @@ -1773,7 +1773,7 @@ QDF_STATUS lim_populate_peer_rate_set(struct mac_context *mac, if (IS_DOT11_MODE_HE(pe_session->dot11mode) && he_caps) { lim_calculate_he_nss(pRates, pe_session); - } else if (IS_DOT11_MODE_VHT(pe_session->dot11mode)) { + } else if (pe_session->vhtCapability) { if ((pRates->vhtRxMCSMap & MCSMAPMASK2x2) == MCSMAPMASK2x2) pe_session->nss = NSS_1x1_MODE; } else if (pRates->supportedMCSSet[1] == 0) { @@ -2741,7 +2741,7 @@ lim_add_sta_self(struct mac_context *mac, uint8_t updateSta, pAddStaParams->fShortGI20Mhz = pe_session->ht_config.ht_sgi20; pAddStaParams->fShortGI40Mhz = pe_session->ht_config.ht_sgi40; } - pAddStaParams->vhtCapable = IS_DOT11_MODE_VHT(selfStaDot11Mode); + pAddStaParams->vhtCapable = pe_session->vhtCapability; if (pAddStaParams->vhtCapable) pAddStaParams->ch_width = pe_session->ch_width; @@ -2752,7 +2752,7 @@ lim_add_sta_self(struct mac_context *mac, uint8_t updateSta, pe_session->vht_config.su_beam_former; /* In 11ac mode, the hardware is capable of supporting 128K AMPDU size */ - if (IS_DOT11_MODE_VHT(selfStaDot11Mode)) + if (pe_session->vhtCapability) pAddStaParams->maxAmpduSize = mac->mlme_cfg->vht_caps.vht_cap_info.ampdu_len_exponent; @@ -3130,8 +3130,8 @@ lim_check_and_announce_join_success(struct mac_context *mac_ctx, lim_post_sme_message(mac_ctx, LIM_MLM_JOIN_CNF, (uint32_t *) &mlm_join_cnf); - if ((IS_DOT11_MODE_VHT(session_entry->dot11mode)) && - beacon_probe_rsp->vendor_vht_ie.VHTCaps.present) { + if (session_entry->vhtCapability && + beacon_probe_rsp->vendor_vht_ie.VHTCaps.present) { session_entry->is_vendor_specific_vhtcaps = true; session_entry->vendor_specific_vht_ie_sub_type = beacon_probe_rsp->vendor_vht_ie.sub_type; diff --git a/core/mac/src/pe/lim/lim_ft.c b/core/mac/src/pe/lim/lim_ft.c index 28afb12587d3..640cc20cfac4 100644 --- a/core/mac/src/pe/lim/lim_ft.c +++ b/core/mac/src/pe/lim/lim_ft.c @@ -526,9 +526,6 @@ void lim_fill_ft_session(struct mac_context *mac, lim_fill_dot11mode(mac, ft_session, pe_session, pBeaconStruct); pe_debug("dot11mode: %d", ft_session->dot11mode); - if (IS_DOT11_MODE_HE(ft_session->dot11mode)) - lim_update_session_he_capable(mac, ft_session); - ft_session->vhtCapability = (IS_DOT11_MODE_VHT(ft_session->dot11mode) && IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps)); @@ -536,6 +533,10 @@ void lim_fill_ft_session(struct mac_context *mac, (IS_DOT11_MODE_HT(ft_session->dot11mode) && pBeaconStruct->HTCaps.present); + if (IS_DOT11_MODE_HE(ft_session->dot11mode) && + pBeaconStruct->he_cap.present) + lim_update_session_he_capable(mac, ft_session); + /* Assign default configured nss value in the new session */ if (!wlan_reg_is_24ghz_ch_freq(ft_session->curr_op_freq)) ft_session->vdev_nss = mac->vdev_type_nss_5g.sta; diff --git a/core/mac/src/pe/lim/lim_process_assoc_req_frame.c b/core/mac/src/pe/lim/lim_process_assoc_req_frame.c index 170375e8f792..857f80fefc71 100644 --- a/core/mac/src/pe/lim/lim_process_assoc_req_frame.c +++ b/core/mac/src/pe/lim/lim_process_assoc_req_frame.c @@ -1631,7 +1631,7 @@ static bool lim_update_sta_ds(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr, sta_ds->non_ecsa_capable = 1; if (sta_ds->mlmStaContext.vhtCapability && - IS_DOT11_MODE_VHT(session->dot11mode)) { + session->vhtCapability) { sta_ds->htMaxRxAMpduFactor = vht_caps->maxAMPDULenExp; sta_ds->vhtLdpcCapable = diff --git a/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c b/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c index c39f63cb0806..8e07863ce222 100644 --- a/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c +++ b/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c @@ -156,8 +156,7 @@ void lim_update_assoc_sta_datas(struct mac_context *mac_ctx, else if (assoc_rsp->vendor_vht_ie.VHTCaps.present) vht_caps = &assoc_rsp->vendor_vht_ie.VHTCaps; - if ((IS_DOT11_MODE_VHT(session_entry->dot11mode)) && - ((vht_caps) && vht_caps->present)) { + if (session_entry->vhtCapability && (vht_caps && vht_caps->present)) { sta_ds->mlmStaContext.vhtCapability = vht_caps->present; /* 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 09eb5968c461..6b47cf790ab3 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 @@ -5315,10 +5315,11 @@ static void lim_process_sme_dfs_csa_ie_request(struct mac_context *mac_ctx, dfs_csa_ie_req->ch_switch_mode; /* - * Validate if SAP is operating HT or VHT mode and set the Channel + * Validate if SAP is operating HT or VHT/HE mode and set the Channel * Switch Wrapper element with the Wide Band Switch subelement. */ - if (true != session_entry->vhtCapability) + if (!(session_entry->vhtCapability || + lim_is_session_he_capable(session_entry))) goto skip_vht; /* Now encode the Wider Ch BW element depending on the ch width */ diff --git a/core/mac/src/pe/lim/lim_send_management_frames.c b/core/mac/src/pe/lim/lim_send_management_frames.c index 2c0fe22a8bd4..6e0d802264b6 100644 --- a/core/mac/src/pe/lim/lim_send_management_frames.c +++ b/core/mac/src/pe/lim/lim_send_management_frames.c @@ -202,7 +202,7 @@ lim_send_probe_req_mgmt_frame(struct mac_context *mac_ctx, * if gEnableVhtFor24GHzBand is false and dot11mode is 11ac * set it to 11n. */ - if (channel <= SIR_11B_CHANNEL_END && + if (wlan_reg_is_24ghz_ch_freq(chan_freq) && !mac_ctx->mlme_cfg->vht_caps.vht_cap_info.b24ghz_band && (MLME_DOT11_MODE_11AC == dot11mode || MLME_DOT11_MODE_11AC_ONLY == dot11mode)) @@ -268,7 +268,6 @@ lim_send_probe_req_mgmt_frame(struct mac_context *mac_ctx, populate_dot11f_wfatpc(mac_ctx, &pr.WFATPC, txPower, 0); if (pesession) { - pesession->htCapability = IS_DOT11_MODE_HT(dot11mode); /* Include HT Capability IE */ if (pesession->htCapability && !(WLAN_REG_IS_6GHZ_CHAN_FREQ(chan_freq))) @@ -283,8 +282,7 @@ lim_send_probe_req_mgmt_frame(struct mac_context *mac_ctx, * Set channelbonding information as "disabled" when tunned to a * 2.4 GHz channel */ - if (channel <= SIR_11B_CHANNEL_END && - !(WLAN_REG_IS_6GHZ_CHAN_FREQ(chan_freq))) { + if (wlan_reg_is_24ghz_ch_freq(chan_freq)) { if (mac_ctx->roam.configParam.channelBondingMode24GHz == PHY_SINGLE_CHANNEL_CENTERED) { pr.HTCaps.supportedChannelWidthSet = @@ -296,7 +294,6 @@ lim_send_probe_req_mgmt_frame(struct mac_context *mac_ctx, } } if (pesession) { - pesession->vhtCapability = IS_DOT11_MODE_VHT(dot11mode); /* Include VHT Capability IE */ if (pesession->vhtCapability && !(WLAN_REG_IS_6GHZ_CHAN_FREQ(chan_freq))) { diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index 47ca5c29e57d..86b32eaaeda9 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -7041,6 +7041,10 @@ void lim_update_session_he_capable(struct mac_context *mac, struct pe_session *s session->vhtCapability = 0; session->he_6ghz_band = 1; } + if (wlan_reg_is_24ghz_ch_freq(session->curr_op_freq) && + !mac->mlme_cfg->vht_caps.vht_cap_info.b24ghz_band) + session->vhtCapability = 0; + pe_debug("he_capable: %d", session->he_capable); } @@ -7061,9 +7065,21 @@ void lim_update_session_he_capable_chan_switch(struct mac_context *mac, session->he_6ghz_band = 1; } - pe_debug("he_capable: %d ht %d vht %d 6ghz_band %d new freq %d", + /* + * If new channel is 2.4gh set VHT as per the b24ghz_band INI + * if new channel is 5Ghz set the vht, this will happen if we move from + * 2.4Ghz to 5Ghz. + */ + if (wlan_reg_is_24ghz_ch_freq(new_chan_freq) && + !mac->mlme_cfg->vht_caps.vht_cap_info.b24ghz_band) + session->vhtCapability = 0; + else if (wlan_reg_is_5ghz_ch_freq(new_chan_freq)) + session->vhtCapability = 1; + + pe_debug("he_capable: %d ht %d vht %d 6ghz_band %d new freq %d vht in 2.4gh %d", session->he_capable, session->htCapability, - session->vhtCapability, session->he_6ghz_band, new_chan_freq); + session->vhtCapability, session->he_6ghz_band, new_chan_freq, + mac->mlme_cfg->vht_caps.vht_cap_info.b24ghz_band); } void lim_set_he_caps(struct mac_context *mac, struct pe_session *session,