From 4f1ae8538d96e0200914b305ec1d7662d7640112 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Fri, 25 Aug 2023 15:58:29 +0530 Subject: [PATCH] qcacld-3.0: Fix cb mode calculation for 2.4 GHz If user configure to not use 40 MHz in 2.4 GHz, then avoid setting 40 MHz capability and use cb mode as WNI_CFG_CHANNEL_BONDING_MODE_DISABLE for 2.4 GHz. Change-Id: I4e9153e211e02f6b959e16dad4573c2b490cb215 CRs-Fixed: 3584510 --- .../mac/src/pe/lim/lim_process_beacon_frame.c | 12 +----- core/mac/src/pe/lim/lim_utils.c | 43 ++++++++++++------- core/mac/src/pe/lim/lim_utils.h | 12 ++++++ core/mac/src/pe/sch/sch_beacon_process.c | 16 ++----- .../src/sys/legacy/src/utils/src/parser_api.c | 15 +++---- 5 files changed, 49 insertions(+), 49 deletions(-) diff --git a/core/mac/src/pe/lim/lim_process_beacon_frame.c b/core/mac/src/pe/lim/lim_process_beacon_frame.c index d56d3d3df3..9da816b011 100644 --- a/core/mac/src/pe/lim/lim_process_beacon_frame.c +++ b/core/mac/src/pe/lim/lim_process_beacon_frame.c @@ -285,16 +285,8 @@ void lim_process_beacon_eht_op(struct pe_session *session, chan_id = wlan_reg_freq_to_chan(wlan_vdev_get_pdev(vdev), bcn_ptr->chan_freq); - 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); if (cb_mode == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) { /* * if channel bonding is disabled from INI do not diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index 3795ad5495..df41fcfe05 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -3811,26 +3811,39 @@ 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) { qdf_freq_t chan_freq; - uint32_t self_cb_mode = mac->roam.configParam.channelBondingMode5GHz; + uint8_t cb_mode; - if (WLAN_REG_IS_24GHZ_CH_FREQ(pe_session->curr_op_freq)) - self_cb_mode = mac->roam.configParam.channelBondingMode24GHz; + 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 (self_cb_mode == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) { - pe_debug("self_cb_mode 0 for freq %d", - pe_session->curr_op_freq); - return; - } - - if (wlan_reg_is_24ghz_ch_freq(pe_session->curr_op_freq) && - pe_session->force_24ghz_in_ht20) { - pe_debug("force_24ghz_in_ht20 is set and channel is 2.4 Ghz"); + 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; } @@ -11184,10 +11197,8 @@ bool lim_update_channel_width(struct mac_context *mac_ctx, enum phy_ch_width oper_mode; enum phy_ch_width 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 720b55472e..b9696957cd 100644 --- a/core/mac/src/pe/lim/lim_utils.h +++ b/core/mac/src/pe/lim/lim_utils.h @@ -462,6 +462,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 01ae8ea240..cc94b12fd7 100644 --- a/core/mac/src/pe/sch/sch_beacon_process.c +++ b/core/mac/src/pe/sch/sch_beacon_process.c @@ -433,8 +433,8 @@ sch_bcn_update_he_ies(struct mac_context *mac_ctx, tpDphHashNode sta_ds, static void sch_bcn_update_opmode_change(struct mac_context *mac_ctx, tpDphHashNode sta_ds, - struct pe_session *session, tpSchBeaconStruct bcn, - tpSirMacMgmtHdr mac_hdr, uint8_t cb_mode) + struct pe_session *session, tpSchBeaconStruct bcn, + tpSirMacMgmtHdr mac_hdr) { enum phy_ch_width ch_bw; enum phy_ch_width ch_width = CH_WIDTH_20MHZ; @@ -550,23 +550,13 @@ sch_bcn_process_sta_opmode(struct mac_context *mac_ctx, { tpDphHashNode sta = NULL; 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; /* check for VHT capability */ sta = dph_lookup_hash_entry(mac_ctx, pMh->sa, &aid, &session->dph.dphHashTable); if (!sta) return; - sch_bcn_update_opmode_change(mac_ctx, sta, session, bcn, pMh, - cb_mode); + sch_bcn_update_opmode_change(mac_ctx, sta, session, bcn, pMh); sch_bcn_update_he_ies(mac_ctx, sta, session, bcn, pMh); lim_detect_change_in_srp(mac_ctx, sta, session, bcn); return; 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 7d2ecba4c2..0f036761a5 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 @@ -989,6 +989,7 @@ populate_dot11f_ht_caps(struct mac_context *mac, QDF_STATUS nSirStatus; uint8_t disable_high_ht_mcs_2x2 = 0; struct ch_params ch_params = {0}; + uint8_t cb_mode; tSirMacTxBFCapabilityInfo *pTxBFCapabilityInfo; tSirMacASCapabilityInfo *pASCapabilityInfo; @@ -1017,10 +1018,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_pwrmode( @@ -1158,14 +1160,7 @@ ePhyChanBondState wlan_get_cb_mode(struct mac_context *mac, uint32_t self_cb_mode; struct ch_params ch_params = {0}; - if (WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq)) { - self_cb_mode = - mac->roam.configParam.channelBondingMode24GHz; - } else { - self_cb_mode = - mac->roam.configParam.channelBondingMode5GHz; - } - + self_cb_mode = lim_get_cb_mode_for_freq(mac, pe_session, ch_freq); if (self_cb_mode == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) return PHY_SINGLE_CHANNEL_CENTERED;