From bc1baf6cb36d563fad19d99a9d3c5e5ae0a09b8b Mon Sep 17 00:00:00 2001 From: Utkarsh Bhatnagar Date: Mon, 9 Jan 2023 14:16:11 +0530 Subject: [PATCH] qcacld-3.0: Don't fill CCK rates for SAE Pre Auth frame If while roaming from 2.4 GHz to 5 GHz band with SAE encryption, rates shouldn't be filled from the current session/AP as this may lead to incorrectly filling rates for instance this may lead to incorrectly filling CCk rates for SAE Pre-Auth while roaming from 2.4 GHz to 5 GHz. As even though with roaming offloaded, sae pre_auth due to crypto limitations of fw has to be triggered by the driver. Change-Id: I2293563db047e10ec8a2ade9f3b2a602cf3e3edf CRs-Fixed: 3336853 --- .../src/pe/lim/lim_send_management_frames.c | 28 ++++++++++++++++--- core/mac/src/pe/lim/lim_utils.c | 18 ++++++++++-- core/mac/src/pe/lim/lim_utils.h | 6 ++-- core/sme/inc/csr_api.h | 9 ++++++ core/sme/src/csr/csr_api_roam.c | 2 +- 5 files changed, 53 insertions(+), 10 deletions(-) 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 d505e6704d02..ea07afe0a7cb 100644 --- a/core/mac/src/pe/lim/lim_send_management_frames.c +++ b/core/mac/src/pe/lim/lim_send_management_frames.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -2646,7 +2646,7 @@ lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx, QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, frame, (uint16_t)(sizeof(tSirMacMgmtHdr) + payload)); - 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, @@ -3133,7 +3133,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); @@ -5700,6 +5700,9 @@ static void lim_tx_mgmt_frame(struct mac_context *mac_ctx, uint8_t vdev_id, struct pe_session *session; uint16_t auth_ack_status; enum rateid min_rid = RATEID_DEFAULT; + qdf_freq_t *pre_auth_freq = NULL; + qdf_freq_t channel_freq = 0; + enum QDF_OPMODE opmode; session = pe_find_session_by_vdev_id(mac_ctx, vdev_id); if (!session) { @@ -5712,7 +5715,24 @@ static void lim_tx_mgmt_frame(struct mac_context *mac_ctx, uint8_t vdev_id, qdf_mtrace(QDF_MODULE_ID_PE, QDF_MODULE_ID_WMA, TRACE_CODE_TX_MGMT, session->peSessionId, 0); - min_rid = lim_get_min_session_txrate(session); + opmode = wlan_get_opmode_from_vdev_id(mac_ctx->pdev, vdev_id); + if (opmode != QDF_NAN_DISC_MODE && 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) { + 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, (uint16_t)msg_len, diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index 6e85825a8c3f..1922b487c16a 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -8248,15 +8248,27 @@ 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) +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, curr_rate, i; - tSirMacRateSet *rateset = &session->rateSet; + tSirMacRateSet *rateset; 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)) + csr_get_basic_rates(rateset, *pre_auth_freq); + else + return rid; + } + for (i = 0; i < rateset->numRates; i++) { /* Ignore MSB - set to indicate basic rate */ curr_rate = rateset->rate[i] & 0x7F; diff --git a/core/mac/src/pe/lim/lim_utils.h b/core/mac/src/pe/lim/lim_utils.h index 6b2e0103741b..eaa7d7585adc 100644 --- a/core/mac/src/pe/lim/lim_utils.h +++ b/core/mac/src/pe/lim/lim_utils.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -1687,13 +1687,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 diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h index d2b522974b6b..72da90d303ef 100644 --- a/core/sme/inc/csr_api.h +++ b/core/sme/inc/csr_api.h @@ -1485,6 +1485,15 @@ QDF_STATUS csr_mlme_vdev_disconnect_all_p2p_client_event(uint8_t vdev_id); */ QDF_STATUS csr_mlme_vdev_stop_bss(uint8_t vdev_id); +/* + * csr_get_basic_rates() - Get basic rate for a band + * @b_rates: Basic rate + * @chan_freq: frequency for which basic rate is required + * + * Return: void + */ +void csr_get_basic_rates(tSirMacRateSet *b_rates, uint32_t chan_freq); + /* * csr_mlme_get_concurrent_operation_freq() - Callback for MLME module to * get the concurrent operation frequency diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 0b75b2e3a1e8..aea7767b52b8 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -14951,7 +14951,7 @@ csr_update_sae_single_pmk_ap_cap(struct mac_context *mac, } #endif -static void csr_get_basic_rates(tSirMacRateSet *b_rates, uint32_t chan_freq) +void csr_get_basic_rates(tSirMacRateSet *b_rates, uint32_t chan_freq) { /* * Some IOT APs don't send supported rates in