Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 1 | /* |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 3 | * |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
| 19 | /** |
| 20 | * DOC: lim_reassoc_utils.c |
| 21 | * |
| 22 | * Host based roaming re-association utilities |
| 23 | */ |
| 24 | |
| 25 | #include "cds_api.h" |
| 26 | #include "ani_global.h" |
| 27 | #include "wni_api.h" |
| 28 | #include "sir_common.h" |
| 29 | |
| 30 | #include "wni_cfg.h" |
| 31 | #include "cfg_api.h" |
| 32 | |
| 33 | #include "sch_api.h" |
| 34 | #include "utils_api.h" |
| 35 | #include "lim_utils.h" |
| 36 | #include "lim_assoc_utils.h" |
| 37 | #include "lim_security_utils.h" |
| 38 | #include "lim_ser_des_utils.h" |
| 39 | #include "lim_sta_hash_api.h" |
| 40 | #include "lim_admit_control.h" |
| 41 | #include "lim_send_messages.h" |
| 42 | #include "lim_ibss_peer_mgmt.h" |
| 43 | #include "lim_ft_defs.h" |
| 44 | #include "lim_session.h" |
| 45 | |
| 46 | #include "qdf_types.h" |
| 47 | #include "wma_types.h" |
| 48 | #include "lim_types.h" |
| 49 | |
| 50 | /** |
| 51 | * lim_update_re_assoc_globals() - Update reassoc global data |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 52 | * @mac: Global MAC context |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 53 | * @pAssocRsp: Reassociation response data |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 54 | * @pe_session: PE Session |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 55 | * |
| 56 | * This function is called to Update the Globals (LIM) during ReAssoc. |
| 57 | * |
| 58 | * Return: None |
| 59 | */ |
| 60 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 61 | void lim_update_re_assoc_globals(struct mac_context *mac, tpSirAssocRsp pAssocRsp, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 62 | struct pe_session *pe_session) |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 63 | { |
| 64 | /* Update the current Bss Information */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 65 | qdf_mem_copy(pe_session->bssId, |
| 66 | pe_session->limReAssocbssId, sizeof(tSirMacAddr)); |
| 67 | pe_session->currentOperChannel = pe_session->limReassocChannelId; |
| 68 | pe_session->htSecondaryChannelOffset = |
| 69 | pe_session->reAssocHtSupportedChannelWidthSet; |
| 70 | pe_session->htRecommendedTxWidthSet = |
| 71 | pe_session->reAssocHtRecommendedTxWidthSet; |
| 72 | pe_session->htSecondaryChannelOffset = |
| 73 | pe_session->reAssocHtSecondaryChannelOffset; |
| 74 | pe_session->limCurrentBssCaps = pe_session->limReassocBssCaps; |
| 75 | pe_session->limCurrentBssQosCaps = |
| 76 | pe_session->limReassocBssQosCaps; |
| 77 | pe_session->limCurrentBssPropCap = |
| 78 | pe_session->limReassocBssPropCap; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 79 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 80 | qdf_mem_copy((uint8_t *) &pe_session->ssId, |
| 81 | (uint8_t *) &pe_session->limReassocSSID, |
| 82 | pe_session->limReassocSSID.length + 1); |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 83 | |
| 84 | /* Store assigned AID for TIM processing */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 85 | pe_session->limAID = pAssocRsp->aid & 0x3FFF; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 86 | /** Set the State Back to ReAssoc Rsp*/ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 87 | pe_session->limMlmState = eLIM_MLM_WT_REASSOC_RSP_STATE; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 88 | MTRACE(mac_trace |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 89 | (mac, TRACE_CODE_MLM_STATE, pe_session->peSessionId, |
| 90 | pe_session->limMlmState)); |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 91 | |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * @lim_handle_del_bss_in_re_assoc_context() - DEL BSS during reassociation |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 96 | * @mac: Global MAC Context |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 97 | * @pStaDs: Station Hash entry |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 98 | * @pe_session: PE Session |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 99 | * |
| 100 | * While Processing the ReAssociation Response Frame in STA, |
| 101 | * a.immediately after receiving the Reassoc Response the RxCleanUp is |
| 102 | * being issued and the end of DelBSS the new BSS is being added. |
| 103 | * |
| 104 | * b. If an AP rejects the ReAssociation (Disassoc/Deauth) with some context |
| 105 | * change, We need to update CSR with ReAssocCNF Response with the |
| 106 | * ReAssoc Fail and the reason Code, that is also being handled in the |
| 107 | * DELBSS context only |
| 108 | * |
| 109 | * Return: None |
| 110 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 111 | void lim_handle_del_bss_in_re_assoc_context(struct mac_context *mac, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 112 | tpDphHashNode pStaDs, struct pe_session *pe_session) |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 113 | { |
| 114 | tLimMlmReassocCnf mlmReassocCnf; |
| 115 | tpSirBssDescription bss_desc; |
| 116 | /* |
| 117 | * Skipped the DeleteDPH Hash Entry as we need it for the new BSS |
| 118 | * Set the MlmState to IDLE |
| 119 | */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 120 | pe_session->limMlmState = eLIM_MLM_IDLE_STATE; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 121 | /* Update PE session Id */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 122 | mlmReassocCnf.sessionId = pe_session->peSessionId; |
| 123 | switch (pe_session->limSmeState) { |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 124 | case eLIM_SME_WT_REASSOC_STATE: |
| 125 | { |
| 126 | tpSirAssocRsp assocRsp; |
| 127 | tpDphHashNode pStaDs; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 128 | QDF_STATUS retStatus = QDF_STATUS_SUCCESS; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 129 | tpSchBeaconStruct beacon_struct; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 130 | |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 131 | beacon_struct = qdf_mem_malloc(sizeof(tSchBeaconStruct)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 132 | if (!beacon_struct) { |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 133 | mlmReassocCnf.resultCode = |
| 134 | eSIR_SME_RESOURCES_UNAVAILABLE; |
| 135 | mlmReassocCnf.protStatusCode = |
| 136 | eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 137 | lim_delete_dph_hash_entry(mac, pe_session->bssId, |
| 138 | DPH_STA_HASH_INDEX_PEER, pe_session); |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 139 | goto error; |
| 140 | } |
| 141 | /* Delete the older STA Table entry */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 142 | lim_delete_dph_hash_entry(mac, pe_session->bssId, |
| 143 | DPH_STA_HASH_INDEX_PEER, pe_session); |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 144 | /* |
| 145 | * Add an entry for AP to hash table |
| 146 | * maintained by DPH module |
| 147 | */ |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 148 | pStaDs = dph_add_hash_entry(mac, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 149 | pe_session->limReAssocbssId, |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 150 | DPH_STA_HASH_INDEX_PEER, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 151 | &pe_session->dph.dphHashTable); |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 152 | if (pStaDs == NULL) { |
| 153 | /* Could not add hash table entry */ |
Srinivas Girigowda | cc95af0 | 2017-03-26 11:31:49 -0700 | [diff] [blame] | 154 | pe_err("could not add hash entry at DPH for"); |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 155 | lim_print_mac_addr(mac, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 156 | pe_session->limReAssocbssId, LOGE); |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 157 | mlmReassocCnf.resultCode = |
| 158 | eSIR_SME_RESOURCES_UNAVAILABLE; |
| 159 | mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS; |
| 160 | qdf_mem_free(beacon_struct); |
| 161 | goto error; |
| 162 | } |
| 163 | /* |
| 164 | * While Processing the ReAssoc Response Frame the Rsp Frame |
| 165 | * is being stored to be used here for sending ADDBSS |
| 166 | */ |
| 167 | assocRsp = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 168 | (tpSirAssocRsp) pe_session->limAssocResponseData; |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 169 | lim_update_assoc_sta_datas(mac, pStaDs, assocRsp, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 170 | pe_session); |
| 171 | lim_update_re_assoc_globals(mac, assocRsp, pe_session); |
| 172 | bss_desc = &pe_session->pLimReAssocReq->bssDescription; |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 173 | lim_extract_ap_capabilities(mac, |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 174 | (uint8_t *) bss_desc->ieFields, |
| 175 | lim_get_ielen_from_bss_description(bss_desc), |
| 176 | beacon_struct); |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 177 | if (mac->lim.gLimProtectionControl != |
Pragaspathi Thilagaraj | 1ee7600 | 2018-09-18 21:38:51 +0530 | [diff] [blame] | 178 | MLME_FORCE_POLICY_PROTECTION_DISABLE) |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 179 | lim_decide_sta_protection_on_assoc(mac, |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 180 | beacon_struct, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 181 | pe_session); |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 182 | if (beacon_struct->erpPresent) { |
| 183 | if (beacon_struct->erpIEInfo.barkerPreambleMode) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 184 | pe_session->beaconParams.fShortPreamble = 0; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 185 | else |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 186 | pe_session->beaconParams.fShortPreamble = 1; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 187 | } |
| 188 | /* |
| 189 | * updateBss flag is false, as in this case, PE is first |
| 190 | * deleting the existing BSS and then adding a new one |
| 191 | */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 192 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 193 | lim_sta_send_add_bss(mac, assocRsp, beacon_struct, |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 194 | bss_desc, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 195 | false, pe_session)) { |
Srinivas Girigowda | cc95af0 | 2017-03-26 11:31:49 -0700 | [diff] [blame] | 196 | pe_err("Posting ADDBSS in the ReAssocCtx Failed"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 197 | retStatus = QDF_STATUS_E_FAILURE; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 198 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 199 | if (retStatus != QDF_STATUS_SUCCESS) { |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 200 | mlmReassocCnf.resultCode = |
| 201 | eSIR_SME_RESOURCES_UNAVAILABLE; |
| 202 | mlmReassocCnf.protStatusCode = |
| 203 | eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 204 | qdf_mem_free(assocRsp); |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 205 | mac->lim.gLimAssocResponseData = NULL; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 206 | qdf_mem_free(beacon_struct); |
| 207 | goto error; |
| 208 | } |
| 209 | qdf_mem_free(assocRsp); |
| 210 | qdf_mem_free(beacon_struct); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 211 | pe_session->limAssocResponseData = NULL; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 212 | } |
| 213 | break; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 214 | default: |
Srinivas Girigowda | cc95af0 | 2017-03-26 11:31:49 -0700 | [diff] [blame] | 215 | pe_err("DelBss in wrong system Role and SME State"); |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 216 | mlmReassocCnf.resultCode = eSIR_SME_REFUSED; |
| 217 | mlmReassocCnf.protStatusCode = |
| 218 | eSIR_SME_UNEXPECTED_REQ_RESULT_CODE; |
| 219 | goto error; |
| 220 | } |
| 221 | return; |
| 222 | error: |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 223 | lim_post_sme_message(mac, LIM_MLM_REASSOC_CNF, |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 224 | (uint32_t *) &mlmReassocCnf); |
| 225 | } |
| 226 | |
| 227 | /** |
| 228 | * @lim_handle_add_bss_in_re_assoc_context() - ADD BSS during reassociation |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 229 | * @mac: Global MAC Context |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 230 | * @pStaDs: Station Hash entry |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 231 | * @pe_session: PE Session |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 232 | * |
| 233 | * While Processing the ReAssociation Response Frame in STA, |
| 234 | * a. immediately after receiving the Reassoc Response the RxCleanUp is |
| 235 | * being issued and the end of DelBSS the new BSS is being added. |
| 236 | * |
| 237 | * b. If an AP rejects the ReAssociation (Disassoc/Deauth) with some context |
| 238 | * change, We need to update CSR with ReAssocCNF Response with the |
| 239 | * ReAssoc Fail and the reason Code, that is also being handled in the |
| 240 | * DELBSS context only |
| 241 | * |
| 242 | * Return: None |
| 243 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 244 | void lim_handle_add_bss_in_re_assoc_context(struct mac_context *mac, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 245 | tpDphHashNode pStaDs, struct pe_session *pe_session) |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 246 | { |
| 247 | tLimMlmReassocCnf mlmReassocCnf; |
| 248 | /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/ |
| 249 | /** Set the MlmState to IDLE*/ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 250 | pe_session->limMlmState = eLIM_MLM_IDLE_STATE; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 251 | MTRACE(mac_trace |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 252 | (mac, TRACE_CODE_MLM_STATE, pe_session->peSessionId, |
| 253 | pe_session->limMlmState)); |
| 254 | switch (pe_session->limSmeState) { |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 255 | case eLIM_SME_WT_REASSOC_STATE: { |
| 256 | tpSirAssocRsp assocRsp; |
| 257 | tpDphHashNode pStaDs; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 258 | QDF_STATUS retStatus = QDF_STATUS_SUCCESS; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 259 | tSchBeaconStruct *pBeaconStruct; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 260 | |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 261 | pBeaconStruct = |
| 262 | qdf_mem_malloc(sizeof(tSchBeaconStruct)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 263 | if (!pBeaconStruct) { |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 264 | mlmReassocCnf.resultCode = |
| 265 | eSIR_SME_RESOURCES_UNAVAILABLE; |
| 266 | mlmReassocCnf.protStatusCode = |
| 267 | eSIR_SME_RESOURCES_UNAVAILABLE; |
| 268 | goto Error; |
| 269 | } |
| 270 | /* Get the AP entry from DPH hash table */ |
| 271 | pStaDs = |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 272 | dph_get_hash_entry(mac, DPH_STA_HASH_INDEX_PEER, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 273 | &pe_session->dph.dphHashTable); |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 274 | if (pStaDs == NULL) { |
Srinivas Girigowda | cc95af0 | 2017-03-26 11:31:49 -0700 | [diff] [blame] | 275 | pe_err("Fail to get STA PEER entry from hash"); |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 276 | mlmReassocCnf.resultCode = |
| 277 | eSIR_SME_RESOURCES_UNAVAILABLE; |
| 278 | mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS; |
| 279 | qdf_mem_free(pBeaconStruct); |
| 280 | goto Error; |
| 281 | } |
| 282 | /* |
| 283 | * While Processing the ReAssoc Response Frame the Rsp Frame |
| 284 | * is being stored to be used here for sending ADDBSS |
| 285 | */ |
| 286 | assocRsp = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 287 | (tpSirAssocRsp) pe_session->limAssocResponseData; |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 288 | lim_update_assoc_sta_datas(mac, pStaDs, assocRsp, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 289 | pe_session); |
| 290 | lim_update_re_assoc_globals(mac, assocRsp, pe_session); |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 291 | lim_extract_ap_capabilities(mac, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 292 | (uint8_t *) pe_session-> |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 293 | pLimReAssocReq->bssDescription. |
| 294 | ieFields, |
| 295 | lim_get_ielen_from_bss_description |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 296 | (&pe_session-> |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 297 | pLimReAssocReq-> |
| 298 | bssDescription), |
| 299 | pBeaconStruct); |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 300 | if (mac->lim.gLimProtectionControl != |
Pragaspathi Thilagaraj | 1ee7600 | 2018-09-18 21:38:51 +0530 | [diff] [blame] | 301 | MLME_FORCE_POLICY_PROTECTION_DISABLE) |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 302 | lim_decide_sta_protection_on_assoc(mac, |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 303 | pBeaconStruct, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 304 | pe_session); |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 305 | |
| 306 | if (pBeaconStruct->erpPresent) { |
| 307 | if (pBeaconStruct->erpIEInfo.barkerPreambleMode) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 308 | pe_session->beaconParams. |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 309 | fShortPreamble = 0; |
| 310 | else |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 311 | pe_session->beaconParams. |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 312 | fShortPreamble = 1; |
| 313 | } |
| 314 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 315 | pe_session->isNonRoamReassoc = 1; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 316 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 317 | lim_sta_send_add_bss(mac, assocRsp, pBeaconStruct, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 318 | &pe_session->pLimReAssocReq-> |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 319 | bssDescription, true, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 320 | pe_session)) { |
Srinivas Girigowda | cc95af0 | 2017-03-26 11:31:49 -0700 | [diff] [blame] | 321 | pe_err("Post ADDBSS in the ReAssocCtxt Failed"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 322 | retStatus = QDF_STATUS_E_FAILURE; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 323 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 324 | if (retStatus != QDF_STATUS_SUCCESS) { |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 325 | mlmReassocCnf.resultCode = |
| 326 | eSIR_SME_RESOURCES_UNAVAILABLE; |
| 327 | mlmReassocCnf.protStatusCode = |
| 328 | eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 329 | qdf_mem_free(assocRsp); |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 330 | mac->lim.gLimAssocResponseData = NULL; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 331 | qdf_mem_free(pBeaconStruct); |
| 332 | goto Error; |
| 333 | } |
| 334 | qdf_mem_free(assocRsp); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 335 | pe_session->limAssocResponseData = NULL; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 336 | qdf_mem_free(pBeaconStruct); |
| 337 | } |
| 338 | break; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 339 | default: |
Srinivas Girigowda | cc95af0 | 2017-03-26 11:31:49 -0700 | [diff] [blame] | 340 | pe_err("DelBss in the wrong system Role and SME State"); |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 341 | mlmReassocCnf.resultCode = eSIR_SME_REFUSED; |
| 342 | mlmReassocCnf.protStatusCode = |
| 343 | eSIR_SME_UNEXPECTED_REQ_RESULT_CODE; |
| 344 | goto Error; |
| 345 | } |
| 346 | return; |
| 347 | Error: |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 348 | lim_post_sme_message(mac, LIM_MLM_REASSOC_CNF, |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 349 | (uint32_t *) &mlmReassocCnf); |
| 350 | } |
| 351 | |
| 352 | /** |
| 353 | * lim_is_reassoc_in_progress() - Check if reassoiciation is in progress |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 354 | * @mac: Global MAC Context |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 355 | * @pe_session: PE Session |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 356 | * |
| 357 | * Return: true When STA is waiting for Reassoc response from AP |
| 358 | * else false |
| 359 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 360 | bool lim_is_reassoc_in_progress(struct mac_context *mac, struct pe_session *pe_session) |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 361 | { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 362 | if (pe_session == NULL) |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 363 | return false; |
Naveen Rawat | ba66297 | 2017-07-05 16:07:08 -0700 | [diff] [blame] | 364 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 365 | if (LIM_IS_STA_ROLE(pe_session) && |
| 366 | (pe_session->limSmeState == eLIM_SME_WT_REASSOC_STATE)) |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 367 | return true; |
| 368 | |
| 369 | return false; |
| 370 | } |
| 371 | |
| 372 | /** |
| 373 | * lim_add_ft_sta_self()- function to add STA once we have connected with a |
| 374 | * new AP |
| 375 | * @mac_ctx: pointer to global mac structure |
| 376 | * @assoc_id: association id for the station connection |
| 377 | * @session_entry: pe session entr |
| 378 | * |
| 379 | * This function is called to add a STA once we have connected with a new |
| 380 | * AP, that we have performed an FT to. |
| 381 | * |
| 382 | * The Add STA Response is created and now after the ADD Bss Is Successful |
| 383 | * we add the self sta. We update with the association id from the reassoc |
| 384 | * response from the AP. |
| 385 | * |
Jeff Johnson | d9e0351 | 2018-06-29 12:04:03 -0700 | [diff] [blame] | 386 | * Return: QDF_STATUS_SUCCESS on success else QDF_STATUS failure codes |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 387 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 388 | QDF_STATUS lim_add_ft_sta_self(struct mac_context *mac_ctx, uint16_t assoc_id, |
Jeff Johnson | f19e3f1 | 2018-11-19 06:45:35 -0800 | [diff] [blame] | 389 | struct pe_session *session_entry) |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 390 | { |
| 391 | tpAddStaParams add_sta_params = NULL; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 392 | QDF_STATUS ret_code = QDF_STATUS_SUCCESS; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 393 | struct scheduler_msg msg_q = {0}; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 394 | |
| 395 | add_sta_params = session_entry->ftPEContext.pAddStaReq; |
| 396 | add_sta_params->assocId = assoc_id; |
| 397 | add_sta_params->smesessionId = session_entry->smeSessionId; |
| 398 | |
| 399 | msg_q.type = WMA_ADD_STA_REQ; |
| 400 | msg_q.reserved = 0; |
| 401 | msg_q.bodyptr = add_sta_params; |
| 402 | msg_q.bodyval = 0; |
| 403 | |
| 404 | QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 405 | "Sending WMA_ADD_STA_REQ (aid %d)", |
| 406 | add_sta_params->assocId); |
| 407 | MTRACE(mac_trace_msg_tx(mac_ctx, session_entry->peSessionId, |
| 408 | msg_q.type)); |
| 409 | |
| 410 | session_entry->limPrevMlmState = session_entry->limMlmState; |
| 411 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, |
| 412 | session_entry->peSessionId, eLIM_MLM_WT_ADD_STA_RSP_STATE)); |
| 413 | session_entry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE; |
| 414 | ret_code = wma_post_ctrl_msg(mac_ctx, &msg_q); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 415 | if (QDF_STATUS_SUCCESS != ret_code) { |
Srinivas Girigowda | cc95af0 | 2017-03-26 11:31:49 -0700 | [diff] [blame] | 416 | pe_err("Posting WMA_ADD_STA_REQ to HAL failed, reason=%X", |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 417 | ret_code); |
| 418 | qdf_mem_free(add_sta_params); |
| 419 | } |
| 420 | |
| 421 | session_entry->ftPEContext.pAddStaReq = NULL; |
| 422 | return ret_code; |
| 423 | } |
| 424 | |
| 425 | /** |
| 426 | * lim_restore_pre_reassoc_state() - Restore the pre-association context |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 427 | * @mac: Global MAC Context |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 428 | * @resultCode: Assoc response result |
| 429 | * @protStatusCode: Internal protocol status code |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 430 | * @pe_session: PE Session |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 431 | * |
| 432 | * This function is called on STA role whenever Reasociation |
| 433 | * Response with a reject code is received from AP. |
| 434 | * Reassociation failure timer is stopped, Old (or current) AP's |
| 435 | * context is restored both at Polaris & software |
| 436 | * |
| 437 | * Return: None |
| 438 | */ |
| 439 | |
| 440 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 441 | lim_restore_pre_reassoc_state(struct mac_context *mac, |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 442 | tSirResultCodes resultCode, uint16_t protStatusCode, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 443 | struct pe_session *pe_session) |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 444 | { |
| 445 | tLimMlmReassocCnf mlmReassocCnf; |
| 446 | |
Srinivas Girigowda | cc95af0 | 2017-03-26 11:31:49 -0700 | [diff] [blame] | 447 | pe_debug("sessionid: %d protStatusCode: %d resultCode: %d", |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 448 | pe_session->smeSessionId, protStatusCode, resultCode); |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 449 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 450 | pe_session->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 451 | MTRACE(mac_trace |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 452 | (mac, TRACE_CODE_MLM_STATE, pe_session->peSessionId, |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 453 | eLIM_MLM_LINK_ESTABLISHED_STATE)); |
| 454 | |
| 455 | /* 'Change' timer for future activations */ |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 456 | lim_deactivate_and_change_timer(mac, eLIM_REASSOC_FAIL_TIMER); |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 457 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 458 | lim_set_channel(mac, pe_session->currentOperChannel, |
| 459 | pe_session->ch_center_freq_seg0, |
| 460 | pe_session->ch_center_freq_seg1, |
| 461 | pe_session->ch_width, |
| 462 | pe_session->maxTxPower, |
| 463 | pe_session->peSessionId, |
Arif Hussain | 671a190 | 2017-03-17 09:08:32 -0700 | [diff] [blame] | 464 | 0, 0); |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 465 | |
| 466 | /* @ToDo:Need to Integrate the STOP the Dataxfer to AP from 11H code */ |
| 467 | |
| 468 | mlmReassocCnf.resultCode = resultCode; |
| 469 | mlmReassocCnf.protStatusCode = protStatusCode; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 470 | mlmReassocCnf.sessionId = pe_session->peSessionId; |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 471 | lim_post_sme_message(mac, |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 472 | LIM_MLM_REASSOC_CNF, (uint32_t *) &mlmReassocCnf); |
| 473 | } |
| 474 | |
| 475 | /** |
| 476 | * lim_post_reassoc_failure() - Post failure message to SME |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 477 | * @mac: Global MAC Context |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 478 | * @resultCode: Result Code |
| 479 | * @protStatusCode: Protocol Status Code |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 480 | * @pe_session: PE Session |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 481 | * |
| 482 | * Return: None |
| 483 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 484 | void lim_post_reassoc_failure(struct mac_context *mac, |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 485 | tSirResultCodes resultCode, uint16_t protStatusCode, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 486 | struct pe_session *pe_session) |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 487 | { |
| 488 | tLimMlmReassocCnf mlmReassocCnf; |
| 489 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 490 | pe_session->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE; |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 491 | MTRACE(mac_trace |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 492 | (mac, TRACE_CODE_MLM_STATE, pe_session->peSessionId, |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 493 | eLIM_MLM_LINK_ESTABLISHED_STATE)); |
| 494 | |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 495 | lim_deactivate_and_change_timer(mac, eLIM_REASSOC_FAIL_TIMER); |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 496 | |
| 497 | mlmReassocCnf.resultCode = resultCode; |
| 498 | mlmReassocCnf.protStatusCode = protStatusCode; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 499 | mlmReassocCnf.sessionId = pe_session->peSessionId; |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 500 | lim_post_sme_message(mac, |
Varun Reddy Yeturu | 99ff7f0 | 2016-02-11 07:10:22 -0800 | [diff] [blame] | 501 | LIM_MLM_REASSOC_CNF, (uint32_t *) &mlmReassocCnf); |
| 502 | } |
| 503 | |