diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index 55a46dcd2144..6124376906d6 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -3765,10 +3765,41 @@ static void lim_ht_switch_chnl_req(struct pe_session *session) } } +uint8_t lim_get_cb_mode_for_freq(struct mac_context *mac, + struct pe_session *session, + qdf_freq_t chan_freq) +{ + uint8_t cb_mode = mac->roam.configParam.channelBondingMode5GHz; + + if (WLAN_REG_IS_24GHZ_CH_FREQ(chan_freq)) { + if (session->force_24ghz_in_ht20) { + cb_mode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; + pe_debug_rl("vdev %d force 20 Mhz in 2.4 GHz", + session->vdev_id); + } else { + cb_mode = mac->roam.configParam.channelBondingMode24GHz; + } + } + + return cb_mode; +} + void lim_update_sta_run_time_ht_switch_chnl_params(struct mac_context *mac, tDot11fIEHTInfo *pHTInfo, struct pe_session *pe_session) { + uint8_t cb_mode; + + cb_mode = lim_get_cb_mode_for_freq(mac, pe_session, + pe_session->curr_op_freq); + + /* If self capability is set to '20Mhz only', then do not change the CB mode. */ + if (cb_mode == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) { + pe_debug_rl("self_cb_mode 0 for freq %d", + pe_session->curr_op_freq); + return; + } + /* If self capability is set to '20Mhz only', then do not change the CB mode. */ if (!lim_get_ht_capability (mac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pe_session)) @@ -9325,10 +9356,8 @@ bool lim_update_channel_width(struct mac_context *mac_ctx, uint8_t cb_mode, oper_mode; uint32_t fw_vht_ch_wd; - if (wlan_reg_is_24ghz_ch_freq(session->curr_op_freq)) - cb_mode = mac_ctx->roam.configParam.channelBondingMode24GHz; - else - cb_mode = mac_ctx->roam.configParam.channelBondingMode5GHz; + cb_mode = lim_get_cb_mode_for_freq(mac_ctx, session, + session->curr_op_freq); /* * Do not update the channel bonding mode if channel bonding * mode is disabled in INI. diff --git a/core/mac/src/pe/lim/lim_utils.h b/core/mac/src/pe/lim/lim_utils.h index 4cf1acd04d2f..a78655dbad4b 100644 --- a/core/mac/src/pe/lim/lim_utils.h +++ b/core/mac/src/pe/lim/lim_utils.h @@ -327,6 +327,18 @@ void lim_decide_sta_protection_on_assoc(struct mac_context *mac, tpSchBeaconStruct pBeaconStruct, struct pe_session *pe_session); +/** + * lim_get_cb_mode_for_freq() - Get cb mode depending on the freq + * @mac: pointer to Global MAC structure + * @pe_session: pe session + * @chan_freq: Freq to get cb mode for + * + * Return: cb mode allowed for the freq + */ +uint8_t lim_get_cb_mode_for_freq(struct mac_context *mac, + struct pe_session *session, + qdf_freq_t chan_freq); + /** * lim_update_sta_run_time_ht_switch_chnl_params() - Process change in HT * bandwidth diff --git a/core/mac/src/pe/sch/sch_beacon_process.c b/core/mac/src/pe/sch/sch_beacon_process.c index b8f150f5aa08..e8201f66e67f 100644 --- a/core/mac/src/pe/sch/sch_beacon_process.c +++ b/core/mac/src/pe/sch/sch_beacon_process.c @@ -537,14 +537,8 @@ sch_bcn_process_sta_opmode(struct mac_context *mac_ctx, uint16_t aid; uint8_t cb_mode; - if (wlan_reg_is_24ghz_ch_freq(session->curr_op_freq)) { - if (session->force_24ghz_in_ht20) - cb_mode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; - else - cb_mode = - mac_ctx->roam.configParam.channelBondingMode24GHz; - } else - cb_mode = mac_ctx->roam.configParam.channelBondingMode5GHz; + cb_mode = lim_get_cb_mode_for_freq(mac_ctx, session, + session->curr_op_freq); /* check for VHT capability */ sta = dph_lookup_hash_entry(mac_ctx, pMh->sa, &aid, &session->dph.dphHashTable); diff --git a/core/mac/src/sys/legacy/src/utils/src/parser_api.c b/core/mac/src/sys/legacy/src/utils/src/parser_api.c index 06eba68603ba..213c8d74a92c 100644 --- a/core/mac/src/sys/legacy/src/utils/src/parser_api.c +++ b/core/mac/src/sys/legacy/src/utils/src/parser_api.c @@ -915,7 +915,7 @@ populate_dot11f_ht_caps(struct mac_context *mac, { qdf_size_t ncfglen; QDF_STATUS nSirStatus; - uint8_t disable_high_ht_mcs_2x2 = 0; + uint8_t disable_high_ht_mcs_2x2 = 0, cb_mode; struct ch_params ch_params = {0}; tSirMacTxBFCapabilityInfo *pTxBFCapabilityInfo; @@ -945,10 +945,11 @@ populate_dot11f_ht_caps(struct mac_context *mac, pDot11f->shortGI20MHz = ht_cap_info->short_gi_20_mhz; pDot11f->shortGI40MHz = ht_cap_info->short_gi_40_mhz; } else { + cb_mode = lim_get_cb_mode_for_freq(mac, pe_session, + pe_session->curr_op_freq); if (WLAN_REG_IS_24GHZ_CH_FREQ(pe_session->curr_op_freq) && LIM_IS_STA_ROLE(pe_session) && - WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != - mac->roam.configParam.channelBondingMode24GHz) { + cb_mode != WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) { pDot11f->supportedChannelWidthSet = 1; ch_params.ch_width = CH_WIDTH_40MHZ; wlan_reg_set_channel_params_for_freq(