diff --git a/core/mac/src/pe/include/lim_api.h b/core/mac/src/pe/include/lim_api.h index fd978fc3a1..983c42edce 100644 --- a/core/mac/src/pe/include/lim_api.h +++ b/core/mac/src/pe/include/lim_api.h @@ -566,6 +566,17 @@ void lim_set_twt_ext_capabilities(struct mac_context *mac_ctx, {} #endif +/** + * lim_get_basic_rates() - Get basic rates for the given frequency + * @b_rates: Pointer to rates + * @chan_freq: frequency for which rates are required + * + * This api will get basic rates for the given frequency + * + * Return: void + */ +void lim_get_basic_rates(tSirMacRateSet *b_rates, uint32_t chan_freq); + /** * lim_fill_pe_session() - Lim fill pe session * @mac_ctx: Pointer to mac context 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 d87e40e6b9..c739922993 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 @@ -2791,7 +2791,7 @@ lim_fill_ese_params(struct mac_context *mac_ctx, struct pe_session *session, } #endif -static void lim_get_basic_rates(tSirMacRateSet *b_rates, uint32_t chan_freq) +void lim_get_basic_rates(tSirMacRateSet *b_rates, uint32_t chan_freq) { /* * Some IOT APs don't send supported rates in 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 e1e66e0b54..7a77976aa4 100644 --- a/core/mac/src/pe/lim/lim_send_management_frames.c +++ b/core/mac/src/pe/lim/lim_send_management_frames.c @@ -3203,7 +3203,7 @@ lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx, pe_session->vdev_id, QDF_MAC_ADDR_REF(pe_session->bssId), mac_ctx->mgmtSeqNum); - min_rid = lim_get_min_session_txrate(pe_session); + min_rid = lim_get_min_session_txrate(pe_session, NULL); lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_START_EVENT, pe_session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); lim_diag_mgmt_tx_event_report(mac_ctx, mac_hdr, @@ -3815,7 +3815,7 @@ alloc_packet: session->peSessionId, mac_hdr->fc.subType)); mac_ctx->auth_ack_status = LIM_ACK_NOT_RCD; - min_rid = lim_get_min_session_txrate(session); + min_rid = lim_get_min_session_txrate(session, NULL); peer_rssi = mac_ctx->lim.bss_rssi; lim_diag_mgmt_tx_event_report(mac_ctx, mac_hdr, session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); @@ -6531,7 +6531,8 @@ static void lim_tx_mgmt_frame(struct mac_context *mac_ctx, uint8_t vdev_id, enum rateid min_rid = RATEID_DEFAULT; enum QDF_OPMODE opmode; uint16_t session_id; - uint16_t channel_freq = 0; + qdf_freq_t channel_freq = 0; + qdf_freq_t *pre_auth_freq = NULL; opmode = wlan_get_opmode_from_vdev_id(mac_ctx->pdev, vdev_id); if (opmode != QDF_NAN_DISC_MODE) { @@ -6551,22 +6552,24 @@ static void lim_tx_mgmt_frame(struct mac_context *mac_ctx, uint8_t vdev_id, session_id, 0); if (opmode != QDF_NAN_DISC_MODE) { - min_rid = lim_get_min_session_txrate(session); if (fc->subType == SIR_MAC_MGMT_AUTH) { tpSirFTPreAuthReq pre_auth_req; uint16_t auth_algo = *(uint16_t *)(frame + sizeof(tSirMacMgmtHdr)); - if ((auth_algo == eSIR_AUTH_TYPE_SAE) && - (session->ftPEContext.pFTPreAuthReq)) { - pre_auth_req = - session->ftPEContext.pFTPreAuthReq; - channel_freq = - pre_auth_req->pre_auth_channel_freq; + if (auth_algo == eSIR_AUTH_TYPE_SAE) { + if (session->ftPEContext.pFTPreAuthReq) { + pre_auth_req = + session->ftPEContext.pFTPreAuthReq; + channel_freq = + pre_auth_req->pre_auth_channel_freq; + } + pre_auth_freq = &channel_freq; } pe_debug("TX SAE pre-auth frame on freq %d", channel_freq); } + min_rid = lim_get_min_session_txrate(session, pre_auth_freq); } qdf_status = wma_tx_frameWithTxComplete(mac_ctx, packet, diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index bd0e64ef3f..2430d19e60 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -9450,37 +9450,69 @@ QDF_STATUS lim_util_get_type_subtype(void *pkt, uint8_t *type, return QDF_STATUS_SUCCESS; } -enum rateid lim_get_min_session_txrate(struct pe_session *session) +static void lim_get_min_rate(uint8_t *min_rate, tSirMacRateSet *rateset) { - enum rateid rid = RATEID_DEFAULT; - uint8_t min_rate = SIR_MAC_RATE_54, curr_rate, i; - tSirMacRateSet *rateset = &session->rateSet; - bool enable_he_mcs0_for_6ghz_mgmt = false; - qdf_freq_t op_freq; - - if (!session) - return rid; - else { - op_freq = wlan_get_operation_chan_freq(session->vdev); - /* - * For 6GHz freq and if enable_he_mcs0_for_mgmt_6ghz INI is - * enabled then FW will use rate of MCS0 for 11AX and configured - * via WMI_MGMT_TX_SEND_CMDID - */ - wlan_mlme_get_mgmt_6ghz_rate_support( - session->mac_ctx->psoc, - &enable_he_mcs0_for_6ghz_mgmt); - if (op_freq && wlan_reg_is_6ghz_chan_freq(op_freq) && - enable_he_mcs0_for_6ghz_mgmt) - return rid; - } + uint8_t curr_rate, i; for (i = 0; i < rateset->numRates; i++) { /* Ignore MSB - set to indicate basic rate */ curr_rate = rateset->rate[i] & 0x7F; - min_rate = (curr_rate < min_rate) ? curr_rate : min_rate; + *min_rate = (curr_rate < *min_rate) ? curr_rate : + *min_rate; } - pe_debug("supported min_rate: %0x(%d)", min_rate, min_rate); + + pe_debug("supported min_rate: %0x(%d)", *min_rate, *min_rate); +} + +static bool lim_is_enable_he_mcs0_for_6ghz_mgmt(struct pe_session *session, + qdf_freq_t freq) +{ + bool enable_he_mcs0_for_6ghz_mgmt = false; + + if (!wlan_reg_is_6ghz_chan_freq(freq)) + return enable_he_mcs0_for_6ghz_mgmt; + + /* + * For 6GHz freq and if enable_he_mcs0_for_mgmt_6ghz INI is + * enabled then FW will use rate of MCS0 for 11AX and configured + * via WMI_MGMT_TX_SEND_CMDID + */ + wlan_mlme_get_mgmt_6ghz_rate_support( + session->mac_ctx->psoc, + &enable_he_mcs0_for_6ghz_mgmt); + + return enable_he_mcs0_for_6ghz_mgmt; +} + +enum rateid lim_get_min_session_txrate(struct pe_session *session, + qdf_freq_t *pre_auth_freq) +{ + enum rateid rid = RATEID_DEFAULT; + uint8_t min_rate = SIR_MAC_RATE_54; + tSirMacRateSet *rateset; + qdf_freq_t op_freq; + + if (!session) + return rid; + + rateset = &session->rateSet; + + if (pre_auth_freq) { + pe_debug("updated rateset to pre auth freq %d", + *pre_auth_freq); + if (*pre_auth_freq && + !lim_is_enable_he_mcs0_for_6ghz_mgmt(session, + *pre_auth_freq)) + lim_get_basic_rates(rateset, *pre_auth_freq); + else + return rid; + } + + op_freq = wlan_get_operation_chan_freq(session->vdev); + if (lim_is_enable_he_mcs0_for_6ghz_mgmt(session, op_freq)) + return rid; + + lim_get_min_rate(&min_rate, rateset); switch (min_rate) { case SIR_MAC_RATE_1: diff --git a/core/mac/src/pe/lim/lim_utils.h b/core/mac/src/pe/lim/lim_utils.h index 74b5faaa03..a6b02e1bd2 100644 --- a/core/mac/src/pe/lim/lim_utils.h +++ b/core/mac/src/pe/lim/lim_utils.h @@ -2385,13 +2385,15 @@ QDF_STATUS lim_util_get_type_subtype(void *pkt, uint8_t *type, /** * lim_get_min_session_txrate() - Get the minimum rate supported in the session * @session: Pointer to PE session + * @pre_auth_freq: Pointer to pre_auth_freq * * This API will find the minimum rate supported by the given PE session and * return the enum rateid corresponding to the rate. * * Return: enum rateid */ -enum rateid lim_get_min_session_txrate(struct pe_session *session); +enum rateid lim_get_min_session_txrate(struct pe_session *session, + qdf_freq_t *pre_auth_freq); /** * lim_send_dfs_chan_sw_ie_update() - updates the channel switch IE in beacon