From a49d6b9742bff23588229e8dcf4070caf29c1fa6 Mon Sep 17 00:00:00 2001 From: Kiran Kumar Lokere Date: Tue, 28 Apr 2020 16:26:40 -0700 Subject: [PATCH] qcacld-3.0: Fix the HE 160MHz BW related capability settings Reset the HE 160MHz bandwidth related capabilities if the connection mode has lower bandwidth. Set the 160MHz support in HE channel width capability if AP is 160MHz capable and current operating mode is 80MHz. Change-Id: Iddb678ac7543875a3a7d15bb38e13dd27086360b CRs-Fixed: 2674741 --- .../src/pe/lim/lim_process_sme_req_messages.c | 2 +- core/mac/src/pe/lim/lim_prop_exts_utils.c | 66 ++++++++++++++----- core/mac/src/pe/lim/lim_utils.h | 7 +- core/sme/src/common/sme_api.c | 8 ++- 4 files changed, 63 insertions(+), 20 deletions(-) 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 70382fee5c77..8110aa3329f0 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 @@ -789,7 +789,7 @@ __lim_handle_sme_start_bss_request(struct mac_context *mac_ctx, uint32_t *msg_bu sme_start_bss_req->center_freq_seg0; session->ch_center_freq_seg1 = sme_start_bss_req->center_freq_seg1; - lim_update_he_bw_cap_mcs(session); + lim_update_he_bw_cap_mcs(session, NULL); } /* Delete pre-auth list if any */ diff --git a/core/mac/src/pe/lim/lim_prop_exts_utils.c b/core/mac/src/pe/lim/lim_prop_exts_utils.c index d4b064ddc52f..a678b86af6f9 100644 --- a/core/mac/src/pe/lim/lim_prop_exts_utils.c +++ b/core/mac/src/pe/lim/lim_prop_exts_utils.c @@ -201,25 +201,34 @@ static void lim_check_he_ldpc_cap(struct pe_session *session, } } -void lim_update_he_bw_cap_mcs(struct pe_session *session) +void lim_update_he_bw_cap_mcs(struct pe_session *session, + tSirProbeRespBeacon *beacon) { + uint8_t is_80mhz; + if (!session->he_capable) return; - if (session->ch_width <= CH_WIDTH_80MHZ) { - *(uint16_t *)session->he_config.rx_he_mcs_map_160 = - HE_MCS_ALL_DISABLED; - *(uint16_t *)session->he_config.tx_he_mcs_map_160 = - HE_MCS_ALL_DISABLED; - *(uint16_t *)session->he_config.rx_he_mcs_map_80_80 = - HE_MCS_ALL_DISABLED; - *(uint16_t *)session->he_config.tx_he_mcs_map_80_80 = - HE_MCS_ALL_DISABLED; + if ((session->opmode == QDF_STA_MODE || + session->opmode == QDF_P2P_CLIENT_MODE) && + beacon && beacon->he_cap.present) { + if (!beacon->he_cap.chan_width_2) + is_80mhz = 1; + else if (beacon->he_cap.chan_width_2 && + (*(uint16_t *)beacon->he_cap.rx_he_mcs_map_160 == + HE_MCS_ALL_DISABLED)) + is_80mhz = 1; + else + is_80mhz = 0; + } else { + is_80mhz = 1; + } + + if (session->ch_width <= CH_WIDTH_80MHZ && is_80mhz) { + session->he_config.chan_width_2 = 0; + session->he_config.chan_width_3 = 0; } else if (session->ch_width == CH_WIDTH_160MHZ) { - *(uint16_t *)session->he_config.rx_he_mcs_map_80_80 = - HE_MCS_ALL_DISABLED; - *(uint16_t *)session->he_config.tx_he_mcs_map_80_80 = - HE_MCS_ALL_DISABLED; + session->he_config.chan_width_3 = 0; } /* Reset the > 20MHz caps for 20MHz connection */ if (session->ch_width == CH_WIDTH_20MHZ) { @@ -234,6 +243,33 @@ void lim_update_he_bw_cap_mcs(struct pe_session *session) session->he_config.he_ppdu_20_in_160_80p80Mhz = 0; session->he_config.he_ppdu_80_in_160_80p80Mhz = 0; } + if (WLAN_REG_IS_24GHZ_CH_FREQ(session->curr_op_freq)) { + session->he_config.chan_width_1 = 0; + session->he_config.chan_width_2 = 0; + session->he_config.chan_width_3 = 0; + session->he_config.chan_width_5 = 0; + session->he_config.chan_width_6 = 0; + } else { + session->he_config.chan_width_0 = 0; + session->he_config.chan_width_4 = 0; + session->he_config.chan_width_6 = 0; + } + if (!session->he_config.chan_width_2) { + session->he_config.bfee_sts_gt_80 = 0; + session->he_config.num_sounding_gt_80 = 0; + session->he_config.he_ppdu_20_in_160_80p80Mhz = 0; + session->he_config.he_ppdu_80_in_160_80p80Mhz = 0; + *(uint16_t *)session->he_config.rx_he_mcs_map_160 = + HE_MCS_ALL_DISABLED; + *(uint16_t *)session->he_config.tx_he_mcs_map_160 = + HE_MCS_ALL_DISABLED; + } + if (!session->he_config.chan_width_3) { + *(uint16_t *)session->he_config.rx_he_mcs_map_80_80 = + HE_MCS_ALL_DISABLED; + *(uint16_t *)session->he_config.tx_he_mcs_map_80_80 = + HE_MCS_ALL_DISABLED; + } } #else static inline void lim_extract_he_op(struct pe_session *session, @@ -501,7 +537,7 @@ void lim_extract_ap_capability(struct mac_context *mac_ctx, uint8_t *p_ie, } lim_check_he_ldpc_cap(session, beacon_struct); lim_extract_he_op(session, beacon_struct); - lim_update_he_bw_cap_mcs(session); + lim_update_he_bw_cap_mcs(session, beacon_struct); /* Extract the UAPSD flag from WMM Parameter element */ if (beacon_struct->wmeEdcaPresent) *uapsd = beacon_struct->edcaParams.qosInfo.uapsd; diff --git a/core/mac/src/pe/lim/lim_utils.h b/core/mac/src/pe/lim/lim_utils.h index c3491634eecd..600d38feb7c2 100644 --- a/core/mac/src/pe/lim/lim_utils.h +++ b/core/mac/src/pe/lim/lim_utils.h @@ -1250,10 +1250,12 @@ static inline bool lim_is_session_he_capable(struct pe_session *session) /** * lim_update_he_bw_cap_mcs(): Update he mcs map per bandwidth * @session_entry: pointer to PE session + * @beacon: pointer to beacon * * Return: None */ -void lim_update_he_bw_cap_mcs(struct pe_session *session); +void lim_update_he_bw_cap_mcs(struct pe_session *session, + tSirProbeRespBeacon *beacon); static inline bool lim_is_he_6ghz_band(struct pe_session *session) { @@ -1483,7 +1485,8 @@ static inline bool lim_is_session_he_capable(struct pe_session *session) return false; } -static inline void lim_update_he_bw_cap_mcs(struct pe_session *session) +static inline void lim_update_he_bw_cap_mcs(struct pe_session *session, + tSirProbeRespBeacon *beacon) { } diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index c9b7f8d7a271..b86553591bdf 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -12065,11 +12065,15 @@ int sme_update_he_tx_bfee_nsts(mac_handle_t mac_handle, uint8_t session_id, sme_err("No session for id %d", session_id); return -EINVAL; } - if (cfg_in_range(CFG_HE_BFEE_STS_LT80, cfg_val)) + if (cfg_in_range(CFG_HE_BFEE_STS_LT80, cfg_val)) { mac_ctx->mlme_cfg->he_caps.dot11_he_cap.bfee_sts_lt_80 = cfg_val; - else + mac_ctx->mlme_cfg->he_caps.dot11_he_cap.bfee_sts_gt_80 = + cfg_val; + } else { return -EINVAL; + } + csr_update_session_he_cap(mac_ctx, session); return 0;