Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Kiran Kumar Lokere | 27026ae | 2018-03-09 11:38:19 -0800 | [diff] [blame] | 2 | * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -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 | /* |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 20 | * |
| 21 | * This file lim_process_assoc_rsp_frame.cc contains the code |
| 22 | * for processing Re/Association Response Frame. |
| 23 | * Author: Chandra Modumudi |
| 24 | * Date: 03/18/02 |
| 25 | * History:- |
| 26 | * Date Modified by Modification Information |
| 27 | * -------------------------------------------------------------------- |
| 28 | * |
| 29 | */ |
| 30 | |
| 31 | #include "wni_api.h" |
| 32 | #include "wni_cfg.h" |
| 33 | #include "ani_global.h" |
| 34 | #include "cfg_api.h" |
| 35 | #include "sch_api.h" |
| 36 | |
| 37 | #include "utils_api.h" |
| 38 | #include "lim_types.h" |
| 39 | #include "lim_utils.h" |
| 40 | #include "lim_assoc_utils.h" |
| 41 | #include "lim_security_utils.h" |
| 42 | #include "lim_ser_des_utils.h" |
| 43 | #include "lim_sta_hash_api.h" |
| 44 | #include "lim_send_messages.h" |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 45 | #include "lim_process_fils.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 46 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 47 | extern QDF_STATUS sch_beacon_edca_process(struct mac_context *mac, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 48 | tSirMacEdcaParamSetIE *edca, struct pe_session *pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 49 | |
| 50 | /** |
| 51 | * lim_update_stads_htcap() - Updates station Descriptor HT capability |
| 52 | * @mac_ctx: Pointer to Global MAC structure |
| 53 | * @sta_ds: Station Descriptor in DPH |
| 54 | * @assoc_rsp: Pointer to Association Response Structure |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 55 | * @session_entry : PE session Entry |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 56 | * |
| 57 | * This function is called to Update the HT capabilities in |
| 58 | * Station Descriptor (dph) Details from |
| 59 | * Association / ReAssociation Response Frame |
| 60 | * |
| 61 | * Return: None |
| 62 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 63 | static void lim_update_stads_htcap(struct mac_context *mac_ctx, |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 64 | tpDphHashNode sta_ds, tpSirAssocRsp assoc_rsp, |
Jeff Johnson | 82e779e | 2018-11-19 06:52:11 -0800 | [diff] [blame] | 65 | struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 66 | { |
| 67 | uint16_t highest_rxrate = 0; |
| 68 | tDot11fIEHTCaps *ht_caps; |
| 69 | |
| 70 | ht_caps = &assoc_rsp->HTCaps; |
| 71 | sta_ds->mlmStaContext.htCapability = assoc_rsp->HTCaps.present; |
| 72 | if (assoc_rsp->HTCaps.present) { |
| 73 | sta_ds->htGreenfield = |
| 74 | (uint8_t) ht_caps->greenField; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 75 | if (session_entry->htSupportedChannelWidthSet) { |
| 76 | sta_ds->htSupportedChannelWidthSet = |
| 77 | (uint8_t) (ht_caps->supportedChannelWidthSet ? |
| 78 | assoc_rsp->HTInfo.recommendedTxWidthSet : |
| 79 | ht_caps->supportedChannelWidthSet); |
| 80 | } else |
| 81 | sta_ds->htSupportedChannelWidthSet = |
| 82 | eHT_CHANNEL_WIDTH_20MHZ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 83 | sta_ds->htLsigTXOPProtection = |
| 84 | (uint8_t) ht_caps->lsigTXOPProtection; |
| 85 | sta_ds->htMIMOPSState = |
| 86 | (tSirMacHTMIMOPowerSaveState)ht_caps->mimoPowerSave; |
| 87 | sta_ds->htMaxAmsduLength = |
| 88 | (uint8_t) ht_caps->maximalAMSDUsize; |
| 89 | sta_ds->htAMpduDensity = ht_caps->mpduDensity; |
| 90 | sta_ds->htDsssCckRate40MHzSupport = |
| 91 | (uint8_t) ht_caps->dsssCckMode40MHz; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 92 | sta_ds->htMaxRxAMpduFactor = |
| 93 | ht_caps->maxRxAMPDUFactor; |
| 94 | lim_fill_rx_highest_supported_rate(mac_ctx, &highest_rxrate, |
| 95 | ht_caps->supportedMCSSet); |
| 96 | sta_ds->supportedRates.rxHighestDataRate = |
| 97 | highest_rxrate; |
| 98 | /* |
| 99 | * This is for AP as peer STA and we are INFRA STA |
| 100 | *.We will put APs offset in dph node which is peer STA |
| 101 | */ |
| 102 | sta_ds->htSecondaryChannelOffset = |
| 103 | (uint8_t) assoc_rsp->HTInfo.secondaryChannelOffset; |
| 104 | /* |
| 105 | * FIXME_AMPDU |
| 106 | * In the future, may need to check for |
| 107 | * "assoc.HTCaps.delayedBA" |
| 108 | * For now, it is IMMEDIATE BA only on ALL TID's |
| 109 | */ |
| 110 | sta_ds->baPolicyFlag = 0xFF; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 111 | |
| 112 | /* Check if we have support for gShortGI20Mhz and |
| 113 | * gShortGI40Mhz from ini file |
| 114 | */ |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 115 | if (session_entry->htConfig.ht_sgi20) |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 116 | sta_ds->htShortGI20Mhz = |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 117 | (uint8_t)assoc_rsp->HTCaps.shortGI20MHz; |
| 118 | else |
| 119 | sta_ds->htShortGI20Mhz = false; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 120 | |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 121 | if (session_entry->htConfig.ht_sgi40) |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 122 | sta_ds->htShortGI40Mhz = |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 123 | (uint8_t)assoc_rsp->HTCaps.shortGI40MHz; |
| 124 | else |
| 125 | sta_ds->htShortGI40Mhz = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 126 | } |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * lim_update_assoc_sta_datas() - Updates station Descriptor |
| 131 | * mac_ctx: Pointer to Global MAC structure |
| 132 | * sta_ds: Station Descriptor in DPH |
| 133 | * assoc_rsp: Pointer to Association Response Structure |
| 134 | * session_entry : PE session Entry |
| 135 | * |
| 136 | * This function is called to Update the Station Descriptor (dph) Details from |
| 137 | * Association / ReAssociation Response Frame |
| 138 | * |
| 139 | * Return: None |
| 140 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 141 | void lim_update_assoc_sta_datas(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 142 | tpDphHashNode sta_ds, tpSirAssocRsp assoc_rsp, |
Jeff Johnson | 82e779e | 2018-11-19 06:52:11 -0800 | [diff] [blame] | 143 | struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 144 | { |
| 145 | uint32_t phy_mode; |
| 146 | bool qos_mode; |
| 147 | tDot11fIEVHTCaps *vht_caps = NULL; |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 148 | tDot11fIEhe_cap *he_cap = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 149 | |
| 150 | lim_get_phy_mode(mac_ctx, &phy_mode, session_entry); |
| 151 | sta_ds->staType = STA_ENTRY_SELF; |
| 152 | limGetQosMode(session_entry, &qos_mode); |
| 153 | sta_ds->mlmStaContext.authType = session_entry->limCurrentAuthType; |
| 154 | |
| 155 | /* Add capabilities information, rates and AID */ |
| 156 | sta_ds->mlmStaContext.capabilityInfo = assoc_rsp->capabilityInfo; |
| 157 | sta_ds->shortPreambleEnabled = |
| 158 | (uint8_t) assoc_rsp->capabilityInfo.shortPreamble; |
| 159 | |
Jeff Johnson | 118a4a0 | 2018-05-06 00:14:15 -0700 | [diff] [blame] | 160 | /* Update HT Capabilities only when the self mode supports HT */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 161 | if (IS_DOT11_MODE_HT(session_entry->dot11mode)) |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 162 | lim_update_stads_htcap(mac_ctx, sta_ds, assoc_rsp, |
| 163 | session_entry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 164 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 165 | if (assoc_rsp->VHTCaps.present) |
| 166 | vht_caps = &assoc_rsp->VHTCaps; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 167 | else if (assoc_rsp->vendor_vht_ie.VHTCaps.present) |
| 168 | vht_caps = &assoc_rsp->vendor_vht_ie.VHTCaps; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 169 | |
| 170 | if (IS_DOT11_MODE_VHT(session_entry->dot11mode)) { |
| 171 | if ((vht_caps != NULL) && vht_caps->present) { |
| 172 | sta_ds->mlmStaContext.vhtCapability = |
| 173 | vht_caps->present; |
| 174 | /* |
| 175 | * If 11ac is supported and if the peer is |
| 176 | * sending VHT capabilities, |
| 177 | * then htMaxRxAMpduFactor should be |
| 178 | * overloaded with VHT maxAMPDULenExp |
| 179 | */ |
| 180 | sta_ds->htMaxRxAMpduFactor = vht_caps->maxAMPDULenExp; |
| 181 | if (session_entry->htSupportedChannelWidthSet) { |
| 182 | if (assoc_rsp->VHTOperation.present) |
| 183 | sta_ds->vhtSupportedChannelWidthSet = |
| 184 | assoc_rsp->VHTOperation.chanWidth; |
| 185 | else |
| 186 | sta_ds->vhtSupportedChannelWidthSet = |
| 187 | eHT_CHANNEL_WIDTH_40MHZ; |
| 188 | } |
| 189 | } |
| 190 | } |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 191 | |
| 192 | if (IS_DOT11_MODE_HE(session_entry->dot11mode)) |
| 193 | lim_update_stads_he_caps(sta_ds, assoc_rsp, session_entry); |
| 194 | |
| 195 | if (lim_is_sta_he_capable(sta_ds)) |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 196 | he_cap = &assoc_rsp->he_cap; |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 197 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 198 | if (lim_populate_peer_rate_set(mac_ctx, &sta_ds->supportedRates, |
| 199 | assoc_rsp->HTCaps.supportedMCSSet, |
| 200 | false, session_entry, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 201 | vht_caps, he_cap) != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 202 | pe_err("could not get rateset and extended rate set"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 203 | return; |
| 204 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 205 | sta_ds->vhtSupportedRxNss = |
| 206 | ((sta_ds->supportedRates.vhtRxMCSMap & MCSMAPMASK2x2) |
| 207 | == MCSMAPMASK2x2) ? 1 : 2; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 208 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 209 | /* If one of the rates is 11g rates, set the ERP mode. */ |
| 210 | if ((phy_mode == WNI_CFG_PHY_MODE_11G) && |
| 211 | sirIsArate(sta_ds->supportedRates.llaRates[0] & 0x7f)) |
| 212 | sta_ds->erpEnabled = eHAL_SET; |
| 213 | |
| 214 | /* Could not get prop rateset from CFG. Log error. */ |
| 215 | sta_ds->qosMode = 0; |
| 216 | sta_ds->lleEnabled = 0; |
| 217 | |
| 218 | /* update TSID to UP mapping */ |
| 219 | if (qos_mode) { |
| 220 | if (assoc_rsp->edcaPresent) { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 221 | QDF_STATUS status; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 222 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 223 | status = |
| 224 | sch_beacon_edca_process(mac_ctx, |
| 225 | &assoc_rsp->edca, session_entry); |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 226 | pe_debug("Edca set update based on AssocRsp: status %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 227 | status); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 228 | if (status != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 229 | pe_err("Edca error in AssocResp"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 230 | } else { |
| 231 | /* update default tidmap based on ACM */ |
| 232 | sta_ds->qosMode = 1; |
| 233 | sta_ds->lleEnabled = 1; |
| 234 | } |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | sta_ds->wmeEnabled = 0; |
| 239 | sta_ds->wsmEnabled = 0; |
| 240 | if (session_entry->limWmeEnabled && assoc_rsp->wmeEdcaPresent) { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 241 | QDF_STATUS status; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 242 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 243 | status = sch_beacon_edca_process(mac_ctx, &assoc_rsp->edca, |
| 244 | session_entry); |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 245 | pe_debug("WME Edca set update based on AssocRsp: status %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 246 | status); |
| 247 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 248 | if (status != QDF_STATUS_SUCCESS) |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 249 | pe_err("WME Edca error in AssocResp - ignoring"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 250 | |
| 251 | else { |
| 252 | /* update default tidmap based on HashACM */ |
| 253 | sta_ds->qosMode = 1; |
| 254 | sta_ds->wmeEnabled = 1; |
| 255 | } |
| 256 | } else { |
| 257 | /* |
| 258 | * We received assoc rsp from a legacy AP. |
| 259 | * So fill in the default local EDCA params. |
| 260 | * This is needed (refer to bug #14989) as we'll |
| 261 | * be passing the gLimEdcaParams to HAL in |
| 262 | * lim_process_sta_mlm_add_bss_rsp(). |
| 263 | */ |
| 264 | sch_set_default_edca_params(mac_ctx, session_entry); |
| 265 | } |
| 266 | |
| 267 | if (qos_mode && (!sta_ds->qosMode) && |
| 268 | sta_ds->mlmStaContext.htCapability) { |
| 269 | /* |
| 270 | * Enable QOS for all HT AP's even though WMM |
| 271 | * or 802.11E IE is not present |
| 272 | */ |
| 273 | sta_ds->qosMode = 1; |
| 274 | sta_ds->wmeEnabled = 1; |
| 275 | } |
| 276 | #ifdef WLAN_FEATURE_11W |
| 277 | if (session_entry->limRmfEnabled) |
| 278 | sta_ds->rmfEnabled = 1; |
| 279 | #endif |
| 280 | } |
| 281 | |
| 282 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 283 | * lim_update_ric_data() - update session with ric data |
| 284 | * @mac_ctx: Pointer to Global MAC structure |
| 285 | * @session_entry: PE session handle |
| 286 | * @assoc_rsp: pointer to assoc response |
| 287 | * |
| 288 | * This function is called by lim_process_assoc_rsp_frame() to |
| 289 | * update PE session context with RIC data. |
| 290 | * |
| 291 | * Return: None |
| 292 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 293 | static void lim_update_ric_data(struct mac_context *mac_ctx, |
Jeff Johnson | 82e779e | 2018-11-19 06:52:11 -0800 | [diff] [blame] | 294 | struct pe_session *session_entry, tpSirAssocRsp assoc_rsp) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 295 | { |
| 296 | if (session_entry->ricData != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 297 | qdf_mem_free(session_entry->ricData); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 298 | session_entry->ricData = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 299 | session_entry->RICDataLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 300 | } |
| 301 | if (assoc_rsp->ricPresent) { |
| 302 | session_entry->RICDataLen = |
| 303 | assoc_rsp->num_RICData * sizeof(tDot11fIERICDataDesc); |
Varun Reddy Yeturu | 61ce89c | 2015-11-01 07:57:39 -0800 | [diff] [blame] | 304 | if (session_entry->RICDataLen) { |
| 305 | session_entry->ricData = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 306 | qdf_mem_malloc(session_entry->RICDataLen); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 307 | if (!session_entry->ricData) |
Varun Reddy Yeturu | 61ce89c | 2015-11-01 07:57:39 -0800 | [diff] [blame] | 308 | session_entry->RICDataLen = 0; |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 309 | else |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 310 | qdf_mem_copy(session_entry->ricData, |
Varun Reddy Yeturu | 61ce89c | 2015-11-01 07:57:39 -0800 | [diff] [blame] | 311 | &assoc_rsp->RICData[0], |
| 312 | session_entry->RICDataLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 313 | } else { |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 314 | pe_err("RIC data not present"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 315 | } |
| 316 | } else { |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 317 | pe_debug("Ric is not present"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 318 | session_entry->RICDataLen = 0; |
| 319 | session_entry->ricData = NULL; |
| 320 | } |
| 321 | return; |
| 322 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 323 | |
| 324 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 325 | /** |
| 326 | * lim_update_ese_tspec() - update session with Tspec info. |
| 327 | * @mac_ctx: Pointer to Global MAC structure |
| 328 | * @session_entry: PE session handle |
| 329 | * @assoc_rsp: pointer to assoc response |
| 330 | * |
| 331 | * This function is called by lim_process_assoc_rsp_frame() to |
| 332 | * update PE session context with Tspec data. |
| 333 | * |
| 334 | * Return: None |
| 335 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 336 | static void lim_update_ese_tspec(struct mac_context *mac_ctx, |
Jeff Johnson | 82e779e | 2018-11-19 06:52:11 -0800 | [diff] [blame] | 337 | struct pe_session *session_entry, tpSirAssocRsp assoc_rsp) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 338 | { |
| 339 | if (session_entry->tspecIes != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 340 | qdf_mem_free(session_entry->tspecIes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 341 | session_entry->tspecIes = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 342 | session_entry->tspecLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 343 | } |
| 344 | if (assoc_rsp->tspecPresent) { |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 345 | pe_debug("Tspec EID present in assoc rsp"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 346 | session_entry->tspecLen = |
| 347 | assoc_rsp->num_tspecs * sizeof(tDot11fIEWMMTSPEC); |
Varun Reddy Yeturu | 61ce89c | 2015-11-01 07:57:39 -0800 | [diff] [blame] | 348 | if (session_entry->tspecLen) { |
| 349 | session_entry->tspecIes = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 350 | qdf_mem_malloc(session_entry->tspecLen); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 351 | if (!session_entry->tspecIes) |
Varun Reddy Yeturu | 61ce89c | 2015-11-01 07:57:39 -0800 | [diff] [blame] | 352 | session_entry->tspecLen = 0; |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 353 | else |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 354 | qdf_mem_copy(session_entry->tspecIes, |
Varun Reddy Yeturu | 61ce89c | 2015-11-01 07:57:39 -0800 | [diff] [blame] | 355 | &assoc_rsp->TSPECInfo[0], |
| 356 | session_entry->tspecLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 357 | } else { |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 358 | pe_err("TSPEC has Zero length"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 359 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 360 | } else { |
| 361 | session_entry->tspecLen = 0; |
| 362 | session_entry->tspecIes = NULL; |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 363 | pe_debug("Tspec EID *NOT* present in assoc rsp"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 364 | } |
| 365 | return; |
| 366 | } |
| 367 | |
| 368 | /** |
| 369 | * lim_update_ese_tsm() - update session with TSM info. |
| 370 | * @mac_ctx: Pointer to Global MAC structure |
| 371 | * @session_entry: PE session handle |
| 372 | * @assoc_rsp: pointer to assoc response |
| 373 | * |
| 374 | * This function is called by lim_process_assoc_rsp_frame() to |
| 375 | * update PE session context with TSM IE data and send |
| 376 | * eWNI_TSM_IE_IND to SME. |
| 377 | * |
| 378 | * Return: None |
| 379 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 380 | static void lim_update_ese_tsm(struct mac_context *mac_ctx, |
Jeff Johnson | 82e779e | 2018-11-19 06:52:11 -0800 | [diff] [blame] | 381 | struct pe_session *session_entry, tpSirAssocRsp assoc_rsp) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 382 | { |
| 383 | uint8_t cnt = 0; |
| 384 | tpEseTSMContext tsm_ctx; |
| 385 | |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 386 | pe_debug("TSM IE Present in Reassoc Rsp"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 387 | /* |
| 388 | * Start the TSM timer only if the TSPEC |
| 389 | * Ie is present in the reassoc rsp |
| 390 | */ |
| 391 | if (!assoc_rsp->tspecPresent) { |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 392 | pe_err("TSM present but TSPEC IE not present"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 393 | return; |
| 394 | } |
| 395 | tsm_ctx = &session_entry->eseContext.tsm; |
| 396 | /* Find the TSPEC IE with VO user priority */ |
| 397 | for (cnt = 0; cnt < assoc_rsp->num_tspecs; cnt++) { |
| 398 | if (upToAc(assoc_rsp->TSPECInfo[cnt].user_priority) == |
| 399 | EDCA_AC_VO) { |
| 400 | tsm_ctx->tid = |
| 401 | assoc_rsp->TSPECInfo[cnt].user_priority; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 402 | qdf_mem_copy(&tsm_ctx->tsmInfo, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 403 | &assoc_rsp->tsmIE, sizeof(tSirMacESETSMIE)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 404 | lim_send_sme_tsm_ie_ind(mac_ctx, |
| 405 | session_entry, assoc_rsp->tsmIE.tsid, |
| 406 | assoc_rsp->tsmIE.state, |
| 407 | assoc_rsp->tsmIE.msmt_interval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 408 | if (tsm_ctx->tsmInfo.state) |
| 409 | tsm_ctx->tsmMetrics.RoamingCount++; |
| 410 | break; |
| 411 | } |
| 412 | } |
| 413 | } |
| 414 | #endif |
| 415 | |
| 416 | /** |
| 417 | * lim_update_stads_ext_cap() - update sta ds with ext cap |
| 418 | * @mac_ctx: Pointer to Global MAC structure |
| 419 | * @session_entry: PE session handle |
| 420 | * @assoc_rsp: pointer to assoc response |
| 421 | * |
| 422 | * This function is called by lim_process_assoc_rsp_frame() to |
| 423 | * update STA DS with ext capablities. |
| 424 | * |
| 425 | * Return: None |
| 426 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 427 | static void lim_update_stads_ext_cap(struct mac_context *mac_ctx, |
Jeff Johnson | 82e779e | 2018-11-19 06:52:11 -0800 | [diff] [blame] | 428 | struct pe_session *session_entry, tpSirAssocRsp assoc_rsp, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 429 | tpDphHashNode sta_ds) |
| 430 | { |
| 431 | struct s_ext_cap *ext_cap; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 432 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 433 | if (!assoc_rsp->ExtCap.present) { |
| 434 | sta_ds->timingMeasCap = 0; |
| 435 | #ifdef FEATURE_WLAN_TDLS |
| 436 | session_entry->tdls_prohibited = false; |
| 437 | session_entry->tdls_chan_swit_prohibited = false; |
| 438 | #endif |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 439 | pe_debug("ExtCap not present"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 440 | return; |
| 441 | } |
| 442 | |
| 443 | ext_cap = (struct s_ext_cap *)assoc_rsp->ExtCap.bytes; |
| 444 | lim_set_stads_rtt_cap(sta_ds, ext_cap, mac_ctx); |
| 445 | #ifdef FEATURE_WLAN_TDLS |
| 446 | session_entry->tdls_prohibited = ext_cap->tdls_prohibited; |
| 447 | session_entry->tdls_chan_swit_prohibited = |
| 448 | ext_cap->tdls_chan_swit_prohibited; |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 449 | pe_debug("ExtCap: tdls_prohibited: %d tdls_chan_swit_prohibited: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 450 | ext_cap->tdls_prohibited, |
| 451 | ext_cap->tdls_chan_swit_prohibited); |
| 452 | #endif |
Varun Reddy Yeturu | 4f849e5 | 2018-06-15 18:08:37 -0700 | [diff] [blame] | 453 | lim_set_peer_twt_cap(session_entry, ext_cap); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 454 | } |
| 455 | |
| 456 | /** |
Varun Reddy Yeturu | 32de0e4 | 2016-04-15 14:25:59 +0530 | [diff] [blame] | 457 | * lim_stop_reassoc_retry_timer() - Cleanup after reassoc response is received |
| 458 | * @mac_ctx: Global MAC context |
| 459 | * |
| 460 | * Stop the reassoc retry timer and release the stored reassoc request. |
| 461 | * |
| 462 | * Return: None |
| 463 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 464 | static void lim_stop_reassoc_retry_timer(struct mac_context *mac_ctx) |
Varun Reddy Yeturu | 32de0e4 | 2016-04-15 14:25:59 +0530 | [diff] [blame] | 465 | { |
| 466 | mac_ctx->lim.reAssocRetryAttempt = 0; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 467 | if ((NULL != mac_ctx->lim.pe_session) |
Varun Reddy Yeturu | 32de0e4 | 2016-04-15 14:25:59 +0530 | [diff] [blame] | 468 | && (NULL != |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 469 | mac_ctx->lim.pe_session->pLimMlmReassocRetryReq)) { |
Varun Reddy Yeturu | 32de0e4 | 2016-04-15 14:25:59 +0530 | [diff] [blame] | 470 | qdf_mem_free( |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 471 | mac_ctx->lim.pe_session->pLimMlmReassocRetryReq); |
| 472 | mac_ctx->lim.pe_session->pLimMlmReassocRetryReq = NULL; |
Varun Reddy Yeturu | 32de0e4 | 2016-04-15 14:25:59 +0530 | [diff] [blame] | 473 | } |
| 474 | lim_deactivate_and_change_timer(mac_ctx, eLIM_REASSOC_FAIL_TIMER); |
| 475 | } |
| 476 | |
| 477 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 478 | * lim_process_assoc_rsp_frame() - Processes assoc response |
| 479 | * @mac_ctx: Pointer to Global MAC structure |
| 480 | * @rx_packet_info - A pointer to Rx packet info structure |
| 481 | * @sub_type - Indicates whether it is Association Response (=0) or |
| 482 | * Reassociation Response (=1) frame |
| 483 | * |
| 484 | * This function is called by limProcessMessageQueue() upon |
| 485 | * Re/Association Response frame reception. |
| 486 | * |
| 487 | * Return: None |
| 488 | */ |
| 489 | |
| 490 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame^] | 491 | lim_process_assoc_rsp_frame(struct mac_context *mac_ctx, |
Jeff Johnson | 82e779e | 2018-11-19 06:52:11 -0800 | [diff] [blame] | 492 | uint8_t *rx_pkt_info, uint8_t subtype, struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 493 | { |
| 494 | uint8_t *body; |
| 495 | uint16_t caps, ie_len; |
| 496 | uint32_t frame_len; |
| 497 | tSirMacAddr current_bssid; |
| 498 | tpSirMacMgmtHdr hdr = NULL; |
| 499 | tSirMacCapabilityInfo mac_capab; |
| 500 | tpDphHashNode sta_ds; |
| 501 | tpSirAssocRsp assoc_rsp; |
| 502 | tLimMlmAssocCnf assoc_cnf; |
| 503 | tSchBeaconStruct *beacon; |
| 504 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 505 | uint8_t sme_sessionid = 0; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 506 | struct csr_roam_session *roam_session; |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 507 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 508 | /* Initialize status code to success. */ |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 509 | if (lim_is_roam_synch_in_progress(session_entry)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 510 | hdr = (tpSirMacMgmtHdr) mac_ctx->roam.pReassocResp; |
| 511 | else |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 512 | hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 513 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 514 | sme_sessionid = session_entry->smeSessionId; |
| 515 | #endif |
| 516 | assoc_cnf.resultCode = eSIR_SME_SUCCESS; |
| 517 | /* Update PE session Id */ |
| 518 | assoc_cnf.sessionId = session_entry->peSessionId; |
| 519 | if (hdr == NULL) { |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 520 | pe_err("LFR3: Reassoc response packet header is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 521 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 522 | } |
| 523 | |
Abhinav Kumar | 50d4dc7 | 2018-06-15 16:35:50 +0530 | [diff] [blame] | 524 | pe_debug("received Re/Assoc: %d resp on sessionid: %d systemrole: %d" |
Srinivas Girigowda | 2b5d47c | 2017-03-29 00:28:46 -0700 | [diff] [blame] | 525 | " and mlmstate: %d RSSI: %d from "MAC_ADDRESS_STR, subtype, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 526 | session_entry->peSessionId, GET_LIM_SYSTEM_ROLE(session_entry), |
| 527 | session_entry->limMlmState, |
Deepak Dhamdhere | 68929ec | 2015-08-05 15:16:35 -0700 | [diff] [blame] | 528 | (uint) abs((int8_t) WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info)), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 529 | MAC_ADDR_ARRAY(hdr->sa)); |
| 530 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 531 | beacon = qdf_mem_malloc(sizeof(tSchBeaconStruct)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 532 | if (!beacon) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 533 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 534 | |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 535 | if (LIM_IS_AP_ROLE(session_entry)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 536 | /* |
| 537 | * Should not have received Re/Association |
| 538 | * Response frame on AP. Log error |
| 539 | */ |
Jeff Johnson | 4ceed38 | 2018-05-06 16:24:57 -0700 | [diff] [blame] | 540 | pe_err("Should not received Re/Assoc Response in role: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 541 | GET_LIM_SYSTEM_ROLE(session_entry)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 542 | qdf_mem_free(beacon); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 543 | return; |
| 544 | } |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 545 | if (lim_is_roam_synch_in_progress(session_entry)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 546 | hdr = (tpSirMacMgmtHdr) mac_ctx->roam.pReassocResp; |
| 547 | frame_len = mac_ctx->roam.reassocRespLen - SIR_MAC_HDR_LEN_3A; |
| 548 | } else { |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 549 | hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
| 550 | frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info); |
| 551 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 552 | if (((subtype == LIM_ASSOC) && |
| 553 | (session_entry->limMlmState != eLIM_MLM_WT_ASSOC_RSP_STATE)) || |
| 554 | ((subtype == LIM_REASSOC) && |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 555 | !lim_is_roam_synch_in_progress(session_entry) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 556 | ((session_entry->limMlmState != eLIM_MLM_WT_REASSOC_RSP_STATE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 557 | && (session_entry->limMlmState != |
| 558 | eLIM_MLM_WT_FT_REASSOC_RSP_STATE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 559 | ))) { |
| 560 | /* Received unexpected Re/Association Response frame */ |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 561 | pe_debug("Received Re/Assoc rsp in unexpected state: %d on session: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 562 | session_entry->limMlmState, session_entry->peSessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 563 | if (!hdr->fc.retry) { |
| 564 | if (!(mac_ctx->lim.retry_packet_cnt & 0xf)) { |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 565 | pe_err("recvd Re/Assoc rsp:not a retry frame"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 566 | lim_print_mlm_state(mac_ctx, LOGE, |
| 567 | session_entry->limMlmState); |
| 568 | } else { |
| 569 | mac_ctx->lim.retry_packet_cnt++; |
| 570 | } |
| 571 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 572 | qdf_mem_free(beacon); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 573 | return; |
| 574 | } |
| 575 | sir_copy_mac_addr(current_bssid, session_entry->bssId); |
| 576 | if (subtype == LIM_ASSOC) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 577 | if (qdf_mem_cmp |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 578 | (hdr->sa, current_bssid, sizeof(tSirMacAddr))) { |
| 579 | /* |
| 580 | * Received Association Response frame from an entity |
| 581 | * other than one to which request was initiated. |
| 582 | * Ignore this and wait until Assoc Failure Timeout |
| 583 | */ |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 584 | pe_warn("received AssocRsp from unexpected peer "MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 585 | MAC_ADDR_ARRAY(hdr->sa)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 586 | qdf_mem_free(beacon); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 587 | return; |
| 588 | } |
| 589 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 590 | if (qdf_mem_cmp |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 591 | (hdr->sa, session_entry->limReAssocbssId, |
| 592 | sizeof(tSirMacAddr))) { |
| 593 | /* |
| 594 | * Received Reassociation Response frame from an entity |
| 595 | * other than one to which request was initiated. |
| 596 | * Ignore this and wait until Reassoc Failure Timeout. |
| 597 | */ |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 598 | pe_warn("received ReassocRsp from unexpected peer "MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 599 | MAC_ADDR_ARRAY(hdr->sa)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 600 | qdf_mem_free(beacon); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 601 | return; |
| 602 | } |
| 603 | } |
| 604 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 605 | assoc_rsp = qdf_mem_malloc(sizeof(*assoc_rsp)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 606 | if (!assoc_rsp) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 607 | qdf_mem_free(beacon); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 608 | return; |
| 609 | } |
| 610 | /* Get pointer to Re/Association Response frame body */ |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 611 | if (lim_is_roam_synch_in_progress(session_entry)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 612 | body = mac_ctx->roam.pReassocResp + SIR_MAC_HDR_LEN_3A; |
| 613 | else |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 614 | body = WMA_GET_RX_MPDU_DATA(rx_pkt_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 615 | /* parse Re/Association Response frame. */ |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 616 | if (sir_convert_assoc_resp_frame2_struct(mac_ctx, session_entry, body, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 617 | frame_len, assoc_rsp) == QDF_STATUS_E_FAILURE) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 618 | qdf_mem_free(assoc_rsp); |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 619 | pe_err("Parse error Assoc resp subtype: %d" "length: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 620 | frame_len, subtype); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 621 | qdf_mem_free(beacon); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 622 | return; |
| 623 | } |
| 624 | |
| 625 | if (!assoc_rsp->suppRatesPresent) { |
Sandeep Puligilla | 1f1e400 | 2018-08-18 12:15:01 -0700 | [diff] [blame] | 626 | pe_debug("assoc response does not have supported rate set"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 627 | qdf_mem_copy(&assoc_rsp->supportedRates, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 628 | &session_entry->rateSet, |
| 629 | sizeof(tSirMacRateSet)); |
| 630 | } |
| 631 | |
| 632 | assoc_cnf.protStatusCode = assoc_rsp->statusCode; |
| 633 | if (session_entry->assocRsp != NULL) { |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 634 | pe_warn("session_entry->assocRsp is not NULL freeing it and setting NULL"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 635 | qdf_mem_free(session_entry->assocRsp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 636 | session_entry->assocRsp = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 637 | session_entry->assocRspLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 638 | } |
| 639 | |
yeshwanth sriram guntuka | d716a41 | 2017-07-18 17:25:32 +0530 | [diff] [blame] | 640 | if (frame_len) { |
| 641 | session_entry->assocRsp = qdf_mem_malloc(frame_len); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 642 | if (session_entry->assocRsp) { |
yeshwanth sriram guntuka | d716a41 | 2017-07-18 17:25:32 +0530 | [diff] [blame] | 643 | /* |
| 644 | * Store the Assoc response. This is sent |
| 645 | * to csr/hdd in join cnf response. |
| 646 | */ |
| 647 | qdf_mem_copy(session_entry->assocRsp, body, frame_len); |
| 648 | session_entry->assocRspLen = frame_len; |
| 649 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 650 | } |
| 651 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 652 | lim_update_ric_data(mac_ctx, session_entry, assoc_rsp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 653 | |
| 654 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 655 | roam_session = |
| 656 | &mac_ctx->roam.roamSession[sme_sessionid]; |
| 657 | if (assoc_rsp->FTInfo.R0KH_ID.present) { |
| 658 | roam_session->ftSmeContext.r0kh_id_len = |
| 659 | assoc_rsp->FTInfo.R0KH_ID.num_PMK_R0_ID; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 660 | qdf_mem_copy(roam_session->ftSmeContext.r0kh_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 661 | assoc_rsp->FTInfo.R0KH_ID.PMK_R0_ID, |
| 662 | roam_session->ftSmeContext.r0kh_id_len); |
| 663 | } else { |
| 664 | roam_session->ftSmeContext.r0kh_id_len = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 665 | qdf_mem_zero(roam_session->ftSmeContext.r0kh_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 666 | SIR_ROAM_R0KH_ID_MAX_LEN); |
| 667 | } |
| 668 | #endif |
| 669 | |
| 670 | #ifdef FEATURE_WLAN_ESE |
| 671 | lim_update_ese_tspec(mac_ctx, session_entry, assoc_rsp); |
| 672 | #endif |
| 673 | |
| 674 | if (assoc_rsp->capabilityInfo.ibss) { |
| 675 | /* |
| 676 | * Received Re/Association Response from peer |
| 677 | * with IBSS capability set. |
| 678 | * Ignore the frame and wait until Re/assoc |
| 679 | * failure timeout. |
| 680 | */ |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 681 | pe_err("received Re/AssocRsp frame with IBSS capability"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 682 | qdf_mem_free(assoc_rsp); |
| 683 | qdf_mem_free(beacon); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 684 | return; |
| 685 | } |
| 686 | |
| 687 | if (cfg_get_capability_info(mac_ctx, &caps, session_entry) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 688 | != QDF_STATUS_SUCCESS) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 689 | qdf_mem_free(assoc_rsp); |
| 690 | qdf_mem_free(beacon); |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 691 | pe_err("could not retrieve Capabilities"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 692 | return; |
| 693 | } |
| 694 | lim_copy_u16((uint8_t *) &mac_capab, caps); |
| 695 | |
| 696 | /* Stop Association failure timer */ |
| 697 | if (subtype == LIM_ASSOC) |
| 698 | lim_deactivate_and_change_timer(mac_ctx, eLIM_ASSOC_FAIL_TIMER); |
Varun Reddy Yeturu | 32de0e4 | 2016-04-15 14:25:59 +0530 | [diff] [blame] | 699 | else |
| 700 | lim_stop_reassoc_retry_timer(mac_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 701 | |
Abhishek Singh | f3756fc | 2017-06-28 16:04:06 +0530 | [diff] [blame] | 702 | if (eSIR_MAC_XS_FRAME_LOSS_POOR_CHANNEL_RSSI_STATUS == |
| 703 | assoc_rsp->statusCode && |
| 704 | assoc_rsp->rssi_assoc_rej.present) |
| 705 | lim_assoc_rej_add_to_rssi_based_reject_list(mac_ctx, |
| 706 | &assoc_rsp->rssi_assoc_rej, hdr->sa, |
| 707 | WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info)); |
| 708 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 709 | if (assoc_rsp->statusCode != eSIR_MAC_SUCCESS_STATUS |
| 710 | #ifdef WLAN_FEATURE_11W |
Selvaraj, Sridhar | 88015a1 | 2016-09-16 20:33:21 +0530 | [diff] [blame] | 711 | && (!session_entry->limRmfEnabled || |
Krunal Soni | 3b7f733 | 2015-11-12 10:54:30 -0800 | [diff] [blame] | 712 | assoc_rsp->statusCode != eSIR_MAC_TRY_AGAIN_LATER) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 713 | #endif |
| 714 | ) { |
| 715 | /* |
| 716 | *Re/Association response was received |
| 717 | * either with failure code. |
| 718 | */ |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 719 | pe_err("received Re/AssocRsp frame failure code: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 720 | assoc_rsp->statusCode); |
| 721 | /* |
| 722 | * Need to update 'association failure' error counter |
| 723 | * along with STATUS CODE |
| 724 | * Return Assoc confirm to SME with received failure code |
| 725 | */ |
| 726 | assoc_cnf.resultCode = eSIR_SME_ASSOC_REFUSED; |
| 727 | /* Delete Pre-auth context for the associated BSS */ |
| 728 | if (lim_search_pre_auth_list(mac_ctx, hdr->sa)) |
| 729 | lim_delete_pre_auth_node(mac_ctx, hdr->sa); |
| 730 | goto assocReject; |
| 731 | } else if ((assoc_rsp->aid & 0x3FFF) > 2007) { |
| 732 | /* |
| 733 | * Re/Association response was received |
| 734 | * with invalid AID value |
| 735 | */ |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 736 | pe_err("received Re/AssocRsp frame with invalid aid: %X", |
| 737 | assoc_rsp->aid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 738 | assoc_cnf.resultCode = eSIR_SME_INVALID_ASSOC_RSP_RXED; |
| 739 | assoc_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 740 | /* Send advisory Disassociation frame to AP */ |
| 741 | lim_send_disassoc_mgmt_frame(mac_ctx, |
| 742 | eSIR_MAC_UNSPEC_FAILURE_REASON, |
| 743 | hdr->sa, session_entry, false); |
| 744 | goto assocReject; |
| 745 | } |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 746 | |
| 747 | /* |
| 748 | * If it is FILS connection, check is FILS params are matching |
| 749 | * with Authentication stage. |
| 750 | */ |
| 751 | if (!lim_verify_fils_params_assoc_rsp(mac_ctx, session_entry, |
| 752 | assoc_rsp, &assoc_cnf)) { |
| 753 | pe_err("FILS params doesnot match"); |
| 754 | assoc_cnf.resultCode = eSIR_SME_INVALID_ASSOC_RSP_RXED; |
| 755 | assoc_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 756 | /* Send advisory Disassociation frame to AP */ |
| 757 | lim_send_disassoc_mgmt_frame(mac_ctx, |
| 758 | eSIR_MAC_UNSPEC_FAILURE_REASON, |
| 759 | hdr->sa, session_entry, false); |
| 760 | goto assocReject; |
| 761 | } |
| 762 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 763 | /* |
| 764 | * Association Response received with success code |
| 765 | * Set the link state to POSTASSOC now that we have received |
| 766 | * assoc/reassoc response |
| 767 | * NOTE: for BTAMP case, it is being handled in |
| 768 | * lim_process_mlm_assoc_req |
| 769 | */ |
| 770 | #ifdef WLAN_FEATURE_11W |
Krunal Soni | 3b7f733 | 2015-11-12 10:54:30 -0800 | [diff] [blame] | 771 | if (session_entry->limRmfEnabled && |
| 772 | assoc_rsp->statusCode == eSIR_MAC_TRY_AGAIN_LATER) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 773 | if (assoc_rsp->TimeoutInterval.present && |
| 774 | (assoc_rsp->TimeoutInterval.timeoutType == |
| 775 | SIR_MAC_TI_TYPE_ASSOC_COMEBACK)) { |
| 776 | uint16_t timeout_value = |
| 777 | assoc_rsp->TimeoutInterval.timeoutValue; |
| 778 | if (timeout_value < 10) { |
| 779 | /* |
| 780 | * if this value is less than 10 then our timer |
| 781 | * will fail to start and due to this we will |
| 782 | * never re-attempt. Better modify the timer |
| 783 | * value here. |
| 784 | */ |
| 785 | timeout_value = 10; |
| 786 | } |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 787 | pe_debug("ASSOC res with eSIR_MAC_TRY_AGAIN_LATER recvd.Starting timer to wait timeout: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 788 | timeout_value); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 789 | if (QDF_STATUS_SUCCESS != |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 790 | qdf_mc_timer_start( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 791 | &session_entry->pmfComebackTimer, |
| 792 | timeout_value)) { |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 793 | pe_err("Failed to start comeback timer"); |
Padma, Santhosh Kumar | dcba34f | 2016-08-08 18:10:14 +0530 | [diff] [blame] | 794 | |
| 795 | assoc_cnf.resultCode = eSIR_SME_ASSOC_REFUSED; |
| 796 | assoc_cnf.protStatusCode = |
| 797 | eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 798 | |
| 799 | /* |
| 800 | * Delete Pre-auth context for the |
| 801 | * associated BSS |
| 802 | */ |
| 803 | if (lim_search_pre_auth_list(mac_ctx, hdr->sa)) |
| 804 | lim_delete_pre_auth_node(mac_ctx, |
| 805 | hdr->sa); |
| 806 | |
| 807 | goto assocReject; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 808 | } |
| 809 | } else { |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 810 | pe_warn("ASSOC resp with try again event recvd, but try again time interval IE is wrong"); |
Padma, Santhosh Kumar | dcba34f | 2016-08-08 18:10:14 +0530 | [diff] [blame] | 811 | |
| 812 | assoc_cnf.resultCode = eSIR_SME_ASSOC_REFUSED; |
| 813 | assoc_cnf.protStatusCode = |
| 814 | eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 815 | |
| 816 | /* Delete Pre-auth context for the associated BSS */ |
| 817 | if (lim_search_pre_auth_list(mac_ctx, hdr->sa)) |
| 818 | lim_delete_pre_auth_node(mac_ctx, hdr->sa); |
| 819 | |
| 820 | goto assocReject; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 821 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 822 | qdf_mem_free(beacon); |
| 823 | qdf_mem_free(assoc_rsp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 824 | return; |
| 825 | } |
| 826 | #endif |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 827 | if (!lim_is_roam_synch_in_progress(session_entry)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 828 | if (lim_set_link_state |
| 829 | (mac_ctx, eSIR_LINK_POSTASSOC_STATE, |
| 830 | session_entry->bssId, |
| 831 | session_entry->selfMacAddr, NULL, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 832 | NULL) != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 833 | pe_err("Set link state to POSTASSOC failed"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 834 | qdf_mem_free(beacon); |
| 835 | qdf_mem_free(assoc_rsp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 836 | return; |
| 837 | } |
| 838 | } |
yeshwanth sriram guntuka | 58bbcf8 | 2017-02-21 12:16:04 +0530 | [diff] [blame] | 839 | |
| 840 | if (assoc_rsp->QosMapSet.present) |
| 841 | qdf_mem_copy(&session_entry->QosMapSet, |
| 842 | &assoc_rsp->QosMapSet, sizeof(tSirQosMapSet)); |
Srinivas Girigowda | eff16d9 | 2018-09-12 14:56:29 -0700 | [diff] [blame] | 843 | else |
yeshwanth sriram guntuka | 58bbcf8 | 2017-02-21 12:16:04 +0530 | [diff] [blame] | 844 | qdf_mem_zero(&session_entry->QosMapSet, sizeof(tSirQosMapSet)); |
| 845 | |
| 846 | if (assoc_rsp->obss_scanparams.present) |
| 847 | lim_update_obss_scanparams(session_entry, |
| 848 | &assoc_rsp->obss_scanparams); |
| 849 | |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 850 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ROAM_ASSOC_COMP_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 851 | session_entry, assoc_rsp->statusCode ? QDF_STATUS_E_FAILURE : |
| 852 | QDF_STATUS_SUCCESS, assoc_rsp->statusCode); |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 853 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 854 | if (subtype == LIM_REASSOC) { |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 855 | pe_debug("Successfully Reassociated with BSS"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 856 | #ifdef FEATURE_WLAN_ESE |
| 857 | if (assoc_rsp->tsmPresent) |
| 858 | lim_update_ese_tsm(mac_ctx, session_entry, assoc_rsp); |
| 859 | #endif |
| 860 | if (session_entry->pLimMlmJoinReq) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 861 | qdf_mem_free(session_entry->pLimMlmJoinReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 862 | session_entry->pLimMlmJoinReq = NULL; |
| 863 | } |
| 864 | |
| 865 | session_entry->limAssocResponseData = (void *)assoc_rsp; |
| 866 | /* |
| 867 | * Store the ReAssocRsp Frame in DphTable |
| 868 | * to be used during processing DelSta and |
| 869 | * DelBss to send AddBss again |
| 870 | */ |
| 871 | sta_ds = |
| 872 | dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER, |
| 873 | &session_entry->dph.dphHashTable); |
| 874 | |
| 875 | if (!sta_ds) { |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 876 | pe_err("could not get hash entry at DPH for"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 877 | lim_print_mac_addr(mac_ctx, hdr->sa, LOGE); |
| 878 | assoc_cnf.resultCode = |
| 879 | eSIR_SME_INVALID_ASSOC_RSP_RXED; |
| 880 | assoc_cnf.protStatusCode = |
| 881 | eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 882 | |
| 883 | /* Send advisory Disassociation frame to AP */ |
| 884 | lim_send_disassoc_mgmt_frame(mac_ctx, |
| 885 | eSIR_MAC_UNSPEC_FAILURE_REASON, hdr->sa, |
| 886 | session_entry, false); |
| 887 | goto assocReject; |
| 888 | } |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 889 | if ((session_entry->limMlmState == |
| 890 | eLIM_MLM_WT_FT_REASSOC_RSP_STATE) || |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 891 | lim_is_roam_synch_in_progress(session_entry)) { |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 892 | pe_debug("Sending self sta"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 893 | lim_update_assoc_sta_datas(mac_ctx, sta_ds, assoc_rsp, |
| 894 | session_entry); |
yeshwanth sriram guntuka | 58bbcf8 | 2017-02-21 12:16:04 +0530 | [diff] [blame] | 895 | lim_update_stads_ext_cap(mac_ctx, session_entry, |
| 896 | assoc_rsp, sta_ds); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 897 | /* Store assigned AID for TIM processing */ |
| 898 | session_entry->limAID = assoc_rsp->aid & 0x3FFF; |
| 899 | /* Downgrade the EDCA parameters if needed */ |
| 900 | lim_set_active_edca_params(mac_ctx, |
| 901 | session_entry->gLimEdcaParams, |
| 902 | session_entry); |
| 903 | /* Send the active EDCA parameters to HAL */ |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 904 | if (!lim_is_roam_synch_in_progress(session_entry)) { |
| 905 | lim_send_edca_params(mac_ctx, |
| 906 | session_entry->gLimEdcaParamsActive, |
Kiran Kumar Lokere | 27026ae | 2018-03-09 11:38:19 -0800 | [diff] [blame] | 907 | sta_ds->bssId, false); |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 908 | lim_add_ft_sta_self(mac_ctx, |
| 909 | (assoc_rsp->aid & 0x3FFF), |
| 910 | session_entry); |
| 911 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 912 | qdf_mem_free(beacon); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 913 | return; |
| 914 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 915 | |
| 916 | /* |
| 917 | * If we're re-associating to the same BSS, |
| 918 | * we don't want to invoke delete STA, delete |
| 919 | * BSS, as that would remove the already |
| 920 | * established TSPEC. Just go ahead and re-add |
| 921 | * the BSS, STA with new capability information. |
| 922 | * However, if we're re-associating to a different |
| 923 | * BSS, then follow thru with del STA, del BSS, |
| 924 | * add BSS, add STA. |
| 925 | */ |
| 926 | if (sir_compare_mac_addr(session_entry->bssId, |
| 927 | session_entry->limReAssocbssId)) |
| 928 | lim_handle_add_bss_in_re_assoc_context(mac_ctx, sta_ds, |
| 929 | session_entry); |
| 930 | else { |
| 931 | /* |
| 932 | * reset the uapsd mask settings since |
| 933 | * we're re-associating to new AP |
| 934 | */ |
| 935 | session_entry->gUapsdPerAcDeliveryEnableMask = 0; |
| 936 | session_entry->gUapsdPerAcTriggerEnableMask = 0; |
| 937 | |
| 938 | if (lim_cleanup_rx_path(mac_ctx, sta_ds, session_entry) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 939 | != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 940 | pe_err("Could not cleanup the rx path"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 941 | goto assocReject; |
| 942 | } |
| 943 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 944 | qdf_mem_free(beacon); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 945 | return; |
| 946 | } |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 947 | pe_debug("Successfully Associated with BSS " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 948 | MAC_ADDR_ARRAY(hdr->sa)); |
| 949 | #ifdef FEATURE_WLAN_ESE |
| 950 | if (session_entry->eseContext.tsm.tsmInfo.state) |
| 951 | session_entry->eseContext.tsm.tsmMetrics.RoamingCount = 0; |
| 952 | #endif |
| 953 | /* Store assigned AID for TIM processing */ |
| 954 | session_entry->limAID = assoc_rsp->aid & 0x3FFF; |
| 955 | |
| 956 | /* STA entry was created during pre-assoc state. */ |
| 957 | sta_ds = dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER, |
| 958 | &session_entry->dph.dphHashTable); |
| 959 | if (sta_ds == NULL) { |
| 960 | /* Could not add hash table entry */ |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 961 | pe_err("could not get hash entry at DPH"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 962 | lim_print_mac_addr(mac_ctx, hdr->sa, LOGE); |
| 963 | assoc_cnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 964 | assoc_cnf.protStatusCode = eSIR_SME_SUCCESS; |
| 965 | lim_post_sme_message(mac_ctx, LIM_MLM_ASSOC_CNF, |
| 966 | (uint32_t *) &assoc_cnf); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 967 | qdf_mem_free(assoc_rsp); |
| 968 | qdf_mem_free(beacon); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 969 | return; |
| 970 | } |
| 971 | /* Delete Pre-auth context for the associated BSS */ |
| 972 | if (lim_search_pre_auth_list(mac_ctx, hdr->sa)) |
| 973 | lim_delete_pre_auth_node(mac_ctx, hdr->sa); |
| 974 | |
| 975 | lim_update_assoc_sta_datas(mac_ctx, sta_ds, assoc_rsp, session_entry); |
| 976 | /* |
| 977 | * Extract the AP capabilities from the beacon that |
| 978 | * was received earlier |
| 979 | */ |
| 980 | ie_len = lim_get_ielen_from_bss_description( |
| 981 | &session_entry->pLimJoinReq->bssDescription); |
| 982 | lim_extract_ap_capabilities(mac_ctx, |
| 983 | (uint8_t *) session_entry->pLimJoinReq->bssDescription.ieFields, |
| 984 | ie_len, |
| 985 | beacon); |
| 986 | |
Kiran Kumar Lokere | f54b855 | 2018-07-10 00:53:38 -0700 | [diff] [blame] | 987 | if (lim_is_session_he_capable(session_entry)) { |
Kiran Kumar Lokere | b52cfc8 | 2018-10-08 21:54:38 -0700 | [diff] [blame] | 988 | session_entry->mu_edca_present = assoc_rsp->mu_edca_present; |
| 989 | if (session_entry->mu_edca_present) { |
| 990 | pe_debug("Save MU EDCA params to session"); |
| 991 | session_entry->ap_mu_edca_params[EDCA_AC_BE] = |
| 992 | assoc_rsp->mu_edca.acbe; |
| 993 | session_entry->ap_mu_edca_params[EDCA_AC_BK] = |
| 994 | assoc_rsp->mu_edca.acbk; |
| 995 | session_entry->ap_mu_edca_params[EDCA_AC_VI] = |
| 996 | assoc_rsp->mu_edca.acvi; |
| 997 | session_entry->ap_mu_edca_params[EDCA_AC_VO] = |
| 998 | assoc_rsp->mu_edca.acvo; |
Kiran Kumar Lokere | f54b855 | 2018-07-10 00:53:38 -0700 | [diff] [blame] | 999 | } |
Kiran Kumar Lokere | 27026ae | 2018-03-09 11:38:19 -0800 | [diff] [blame] | 1000 | |
| 1001 | } |
| 1002 | |
Selvaraj, Sridhar | e01e073 | 2016-09-13 12:45:22 +0530 | [diff] [blame] | 1003 | if (beacon->VHTCaps.present) |
| 1004 | sta_ds->parsed_ies.vht_caps = beacon->VHTCaps; |
| 1005 | if (beacon->HTCaps.present) |
| 1006 | sta_ds->parsed_ies.ht_caps = beacon->HTCaps; |
| 1007 | if (beacon->hs20vendor_ie.present) |
| 1008 | sta_ds->parsed_ies.hs20vendor_ie = beacon->hs20vendor_ie; |
| 1009 | if (beacon->HTInfo.present) |
| 1010 | sta_ds->parsed_ies.ht_operation = beacon->HTInfo; |
| 1011 | if (beacon->VHTOperation.present) |
| 1012 | sta_ds->parsed_ies.vht_operation = beacon->VHTOperation; |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1013 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1014 | if (mac_ctx->lim.gLimProtectionControl != |
Pragaspathi Thilagaraj | 1ee7600 | 2018-09-18 21:38:51 +0530 | [diff] [blame] | 1015 | MLME_FORCE_POLICY_PROTECTION_DISABLE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1016 | lim_decide_sta_protection_on_assoc(mac_ctx, beacon, |
Pragaspathi Thilagaraj | 1ee7600 | 2018-09-18 21:38:51 +0530 | [diff] [blame] | 1017 | session_entry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1018 | |
| 1019 | if (beacon->erpPresent) { |
| 1020 | if (beacon->erpIEInfo.barkerPreambleMode) |
| 1021 | session_entry->beaconParams.fShortPreamble = false; |
| 1022 | else |
| 1023 | session_entry->beaconParams.fShortPreamble = true; |
| 1024 | } |
| 1025 | |
| 1026 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 1027 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_CONNECTED, session_entry, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1028 | QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1029 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1030 | lim_update_stads_ext_cap(mac_ctx, session_entry, assoc_rsp, sta_ds); |
| 1031 | /* Update the BSS Entry, this entry was added during preassoc. */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1032 | if (QDF_STATUS_SUCCESS == lim_sta_send_add_bss(mac_ctx, assoc_rsp, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1033 | beacon, |
| 1034 | &session_entry->pLimJoinReq->bssDescription, true, |
| 1035 | session_entry)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1036 | qdf_mem_free(assoc_rsp); |
| 1037 | qdf_mem_free(beacon); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1038 | return; |
| 1039 | } else { |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 1040 | pe_err("could not update the bss entry"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1041 | assoc_cnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 1042 | assoc_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 1043 | } |
| 1044 | |
| 1045 | assocReject: |
| 1046 | if ((subtype == LIM_ASSOC) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1047 | || ((subtype == LIM_REASSOC) |
| 1048 | && (session_entry->limMlmState == |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 1049 | eLIM_MLM_WT_FT_REASSOC_RSP_STATE))) { |
Nishank Aggarwal | 4744414 | 2017-03-24 15:31:15 +0530 | [diff] [blame] | 1050 | pe_err("Assoc Rejected by the peer mlmestate: %d sessionid: %d Reason: %d MACADDR:" |
| 1051 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1052 | session_entry->limMlmState, |
| 1053 | session_entry->peSessionId, |
| 1054 | assoc_cnf.resultCode, MAC_ADDR_ARRAY(hdr->sa)); |
| 1055 | session_entry->limMlmState = eLIM_MLM_IDLE_STATE; |
| 1056 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, |
| 1057 | session_entry->peSessionId, |
| 1058 | session_entry->limMlmState)); |
| 1059 | if (session_entry->pLimMlmJoinReq) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1060 | qdf_mem_free(session_entry->pLimMlmJoinReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1061 | session_entry->pLimMlmJoinReq = NULL; |
| 1062 | } |
| 1063 | if (subtype == LIM_ASSOC) { |
| 1064 | lim_post_sme_message(mac_ctx, LIM_MLM_ASSOC_CNF, |
| 1065 | (uint32_t *) &assoc_cnf); |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 1066 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1067 | assoc_cnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE; |
| 1068 | lim_post_sme_message(mac_ctx, LIM_MLM_REASSOC_CNF, |
| 1069 | (uint32_t *)&assoc_cnf); |
| 1070 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1071 | } else { |
| 1072 | lim_restore_pre_reassoc_state(mac_ctx, |
| 1073 | eSIR_SME_REASSOC_REFUSED, |
| 1074 | assoc_cnf.protStatusCode, |
| 1075 | session_entry); |
| 1076 | } |
| 1077 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1078 | qdf_mem_free(beacon); |
| 1079 | qdf_mem_free(assoc_rsp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1080 | return; |
| 1081 | } |