From faa9af44a3adb8a4ca7d1f9944a21337b81d77f5 Mon Sep 17 00:00:00 2001 From: Jianmin Zhu Date: Wed, 24 Mar 2021 19:42:27 +0800 Subject: [PATCH] qcacld-3.0: Remove btm cap in SAE assoc req if SAE roaming disabled Some legacy Helium firmware doesn't support SAE roaming, but btm cap is set in associate request of DUT, then connected SAE AP thinks DUT supports btm, AP will send btm request to DUT, DUT triggers roaming, but fails and disconnects from current AP, users will complain this unexpected disconnect. Change-Id: Ife9860addef6898a518618f555158e7888ac74db CRs-Fixed: 2884694 --- .../dispatcher/inc/wlan_cm_roam_api.h | 17 +++++ core/mac/src/include/parser_api.h | 14 ++++ .../src/pe/lim/lim_send_management_frames.c | 3 + .../src/sys/legacy/src/utils/src/parser_api.c | 23 +++++++ core/sme/src/csr/csr_api_roam.c | 66 +++++++++++-------- 5 files changed, 96 insertions(+), 27 deletions(-) diff --git a/components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_api.h b/components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_api.h index 746952db0637..87ec2aed0be9 100644 --- a/components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_api.h +++ b/components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_api.h @@ -44,6 +44,17 @@ QDF_STATUS wlan_cm_enable_roaming_on_connected_sta(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id); +/** + * cm_akm_roam_allowed() - check if roam allowed for some akm type + * + * @mac_ctx: mac + * @vdev_id: vdev id + * + * Return: QDF_STATUS: QDF_STATUS_SUCCESS is allowed + */ +QDF_STATUS +cm_akm_roam_allowed(struct mac_context *mac_ctx, uint8_t vdev_id); + /** * wlan_cm_roam_cmd_allowed() - check roam cmd is allowed or not * @psoc: pointer to psoc object @@ -155,6 +166,12 @@ wlan_cm_enable_roaming_on_connected_sta(struct wlan_objmgr_pdev *pdev, { return QDF_STATUS_E_NOSUPPORT; } + +static inline QDF_STATUS +cm_akm_roam_allowed(struct mac_context *mac_ctx, uint8_t vdev_id) +{ + return false; +} #endif /** diff --git a/core/mac/src/include/parser_api.h b/core/mac/src/include/parser_api.h index 547114bac784..cc0cc6ae4162 100644 --- a/core/mac/src/include/parser_api.h +++ b/core/mac/src/include/parser_api.h @@ -1254,6 +1254,20 @@ QDF_STATUS populate_dot11f_twt_extended_caps(struct mac_context *mac_ctx, } #endif +/** + * populate_dot11f_btm_extended_caps() - populate btm extended capabilities + * @mac_ctx: Global MAC context. + * @pe_session: Pointer to the PE session. + * @dot11f: Pointer to the extended capabilities of the session. + * + * Disable btm for SAE types for Helium firmware limit + * + * Return: QDF_STATUS Success or Failure + */ +QDF_STATUS populate_dot11f_btm_extended_caps(struct mac_context *mac_ctx, + struct pe_session *pe_session, + struct sDot11fIEExtCap *dot11f); + /** * lim_truncate_ppet: truncates ppet of trailling zeros * @ppet: ppet to truncate 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 7a0e4e188ac8..ff3908fe2845 100644 --- a/core/mac/src/pe/lim/lim_send_management_frames.c +++ b/core/mac/src/pe/lim/lim_send_management_frames.c @@ -2368,6 +2368,9 @@ lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx, lim_merge_extcap_struct(&frm->ExtCap, &bcn_ext_cap, false); } + + populate_dot11f_btm_extended_caps(mac_ctx, pe_session, + &frm->ExtCap); /* * TWT extended capabilities should be populated after the * intersection of beacon caps and self caps is done because 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 e83c3706e630..1091050060ad 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 @@ -46,6 +46,7 @@ #include "wlan_mlme_ucfg_api.h" #include "wlan_mlme_api.h" #include "wlan_reg_services_api.h" +#include "wlan_cm_roam_api.h" #define RSN_OUI_SIZE 4 /* ////////////////////////////////////////////////////////////////////// */ @@ -6502,4 +6503,26 @@ QDF_STATUS populate_dot11f_twt_extended_caps(struct mac_context *mac_ctx, } #endif +QDF_STATUS populate_dot11f_btm_extended_caps(struct mac_context *mac_ctx, + struct pe_session *pe_session, + struct sDot11fIEExtCap *dot11f) +{ + struct s_ext_cap *p_ext_cap; + QDF_STATUS status; + + pe_debug("enter"); + dot11f->num_bytes = DOT11F_IE_EXTCAP_MAX_LEN; + p_ext_cap = (struct s_ext_cap *)dot11f->bytes; + + status = cm_akm_roam_allowed(mac_ctx, pe_session->vdev_id); + if (QDF_IS_STATUS_ERROR(status)) { + p_ext_cap->bss_transition = 0; + pe_debug("Disable btm for roaming not suppprted"); + } + + dot11f->num_bytes = lim_compute_ext_cap_ie_length(dot11f); + + return QDF_STATUS_SUCCESS; +} + /* parser_api.c ends here. */ diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index c955b6ad0c8e..02407de22739 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -17316,25 +17316,11 @@ csr_roam_offload_scan(struct mac_context *mac_ctx, uint8_t session_id, } QDF_STATUS -wlan_cm_roam_cmd_allowed(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, - uint8_t command, uint8_t reason) +cm_akm_roam_allowed(struct mac_context *mac_ctx, uint8_t vdev_id) { - uint8_t *state = NULL; struct csr_roam_session *session; - struct mac_context *mac_ctx; - tpCsrNeighborRoamControlInfo roam_info; enum csr_akm_type roam_profile_akm = eCSR_AUTH_TYPE_UNKNOWN; uint32_t fw_akm_bitmap; - bool p2p_disable_sta_roaming = 0, nan_disable_sta_roaming = 0; - - mac_ctx = sme_get_mac_context(); - if (!mac_ctx) { - sme_err("mac_ctx is NULL"); - return QDF_STATUS_E_FAILURE; - } - - sme_debug("RSO Command %d, vdev %d, Reason %d", - command, vdev_id, reason); session = CSR_GET_SESSION(mac_ctx, vdev_id); if (!session) { @@ -17343,18 +17329,6 @@ wlan_cm_roam_cmd_allowed(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, return QDF_STATUS_E_FAILURE; } - roam_info = &mac_ctx->roam.neighborRoamInfo[vdev_id]; - - if (roam_info->neighborRoamState != - eCSR_NEIGHBOR_ROAM_STATE_CONNECTED && - (command == ROAM_SCAN_OFFLOAD_UPDATE_CFG || - command == ROAM_SCAN_OFFLOAD_START || - command == ROAM_SCAN_OFFLOAD_RESTART)) { - sme_debug("Session not in connected state, RSO not sent and state=%d ", - roam_info->neighborRoamState); - return QDF_STATUS_E_FAILURE; - } - if (session->pCurRoamProfile) roam_profile_akm = session->pCurRoamProfile->AuthType.authType[0]; @@ -17419,6 +17393,44 @@ wlan_cm_roam_cmd_allowed(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, } } + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS +wlan_cm_roam_cmd_allowed(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, + uint8_t command, uint8_t reason) +{ + uint8_t *state = NULL; + struct mac_context *mac_ctx; + tpCsrNeighborRoamControlInfo roam_info; + bool p2p_disable_sta_roaming = 0, nan_disable_sta_roaming = 0; + QDF_STATUS status; + + mac_ctx = sme_get_mac_context(); + if (!mac_ctx) { + sme_err("mac_ctx is NULL"); + return QDF_STATUS_E_FAILURE; + } + + sme_debug("RSO Command %d, vdev %d, Reason %d", + command, vdev_id, reason); + + roam_info = &mac_ctx->roam.neighborRoamInfo[vdev_id]; + + if (roam_info->neighborRoamState != + eCSR_NEIGHBOR_ROAM_STATE_CONNECTED && + (command == ROAM_SCAN_OFFLOAD_UPDATE_CFG || + command == ROAM_SCAN_OFFLOAD_START || + command == ROAM_SCAN_OFFLOAD_RESTART)) { + sme_debug("Session not in connected state, RSO not sent and state=%d ", + roam_info->neighborRoamState); + return QDF_STATUS_E_FAILURE; + } + + status = cm_akm_roam_allowed(mac_ctx, vdev_id); + if (QDF_IS_STATUS_ERROR(status)) + return status; + p2p_disable_sta_roaming = (cfg_p2p_is_roam_config_disabled(psoc) && (policy_mgr_mode_specific_connection_count(