Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Yeshwanth Sriram Guntuka | 72a2fb2 | 2018-01-03 11:25:36 +0530 | [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 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19 | /**========================================================================= |
| 20 | |
| 21 | \file lim_session.c |
| 22 | |
| 23 | \brief implementation for lim Session related APIs |
| 24 | |
| 25 | \author Sunit Bhatia |
| 26 | |
| 27 | ========================================================================*/ |
| 28 | |
| 29 | /*-------------------------------------------------------------------------- |
| 30 | Include Files |
| 31 | ------------------------------------------------------------------------*/ |
| 32 | #include "ani_global.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 33 | #include "lim_ft_defs.h" |
| 34 | #include "lim_ft.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 35 | #include "lim_session.h" |
| 36 | #include "lim_utils.h" |
| 37 | |
| 38 | #include "sch_api.h" |
| 39 | #include "lim_send_messages.h" |
| 40 | |
Qiwei Cai | 50a2108 | 2018-08-07 14:30:09 +0800 | [diff] [blame^] | 41 | #ifdef WLAN_ALLOCATE_GLOBAL_BUFFERS_DYNAMICALLY |
| 42 | static struct sDphHashNode *g_dph_node_array; |
Naveen Rawat | b0c5b6b | 2017-11-27 17:37:40 -0800 | [diff] [blame] | 43 | |
Qiwei Cai | 50a2108 | 2018-08-07 14:30:09 +0800 | [diff] [blame^] | 44 | QDF_STATUS pe_allocate_dph_node_array_buffer(void) |
| 45 | { |
| 46 | uint32_t buf_size; |
| 47 | |
| 48 | buf_size = SIR_MAX_SUPPORTED_BSS * (SIR_SAP_MAX_NUM_PEERS + 1) |
| 49 | * sizeof(struct sDphHashNode); |
| 50 | g_dph_node_array = qdf_mem_malloc(buf_size); |
| 51 | |
| 52 | if (!g_dph_node_array) { |
| 53 | pe_err("%s: Failed to allocate %d bytes", __func__, buf_size); |
| 54 | return QDF_STATUS_E_NOMEM; |
| 55 | } else { |
| 56 | return QDF_STATUS_SUCCESS; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | void pe_free_dph_node_array_buffer(void) |
| 61 | { |
| 62 | qdf_mem_free(g_dph_node_array); |
| 63 | g_dph_node_array = NULL; |
| 64 | } |
| 65 | |
| 66 | static inline |
| 67 | struct sDphHashNode *pe_get_session_dph_node_array(uint8_t session_id) |
| 68 | { |
| 69 | return &g_dph_node_array[session_id * (SIR_SAP_MAX_NUM_PEERS + 1)]; |
| 70 | } |
| 71 | |
| 72 | #else /* WLAN_ALLOCATE_GLOBAL_BUFFERS_DYNAMICALLY */ |
Naveen Rawat | b0c5b6b | 2017-11-27 17:37:40 -0800 | [diff] [blame] | 73 | static struct sDphHashNode |
| 74 | g_dph_node_array[SIR_MAX_SUPPORTED_BSS][SIR_SAP_MAX_NUM_PEERS + 1]; |
| 75 | |
Qiwei Cai | 50a2108 | 2018-08-07 14:30:09 +0800 | [diff] [blame^] | 76 | static inline |
| 77 | struct sDphHashNode *pe_get_session_dph_node_array(uint8_t session_id) |
| 78 | { |
| 79 | return g_dph_node_array[session_id]; |
| 80 | } |
| 81 | #endif /* WLAN_ALLOCATE_GLOBAL_BUFFERS_DYNAMICALLY */ |
| 82 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 83 | /*-------------------------------------------------------------------------- |
| 84 | |
| 85 | \brief pe_init_beacon_params() - Initialize the beaconParams structure |
| 86 | |
| 87 | \param tpPESession - pointer to the session context or NULL if session can not be created. |
| 88 | \return void |
| 89 | \sa |
| 90 | |
| 91 | --------------------------------------------------------------------------*/ |
| 92 | |
Jeff Johnson | 9769900 | 2016-10-07 07:32:55 -0700 | [diff] [blame] | 93 | static void pe_init_beacon_params(tpAniSirGlobal pMac, |
| 94 | tpPESession psessionEntry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 95 | { |
| 96 | psessionEntry->beaconParams.beaconInterval = 0; |
| 97 | psessionEntry->beaconParams.fShortPreamble = 0; |
| 98 | psessionEntry->beaconParams.llaCoexist = 0; |
| 99 | psessionEntry->beaconParams.llbCoexist = 0; |
| 100 | psessionEntry->beaconParams.llgCoexist = 0; |
| 101 | psessionEntry->beaconParams.ht20Coexist = 0; |
| 102 | psessionEntry->beaconParams.llnNonGFCoexist = 0; |
| 103 | psessionEntry->beaconParams.fRIFSMode = 0; |
| 104 | psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = 0; |
| 105 | psessionEntry->beaconParams.gHTObssMode = 0; |
| 106 | |
| 107 | /* Number of legacy STAs associated */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 108 | qdf_mem_set((void *)&psessionEntry->gLim11bParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 109 | sizeof(tLimProtStaParams), 0); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 110 | qdf_mem_set((void *)&psessionEntry->gLim11aParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 111 | sizeof(tLimProtStaParams), 0); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 112 | qdf_mem_set((void *)&psessionEntry->gLim11gParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 113 | sizeof(tLimProtStaParams), 0); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 114 | qdf_mem_set((void *)&psessionEntry->gLimNonGfParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 115 | sizeof(tLimProtStaParams), 0); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 116 | qdf_mem_set((void *)&psessionEntry->gLimHt20Params, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 117 | sizeof(tLimProtStaParams), 0); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 118 | qdf_mem_set((void *)&psessionEntry->gLimLsigTxopParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 119 | sizeof(tLimProtStaParams), 0); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 120 | qdf_mem_set((void *)&psessionEntry->gLimOlbcParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 121 | sizeof(tLimProtStaParams), 0); |
| 122 | } |
| 123 | |
| 124 | /* |
| 125 | * pe_reset_protection_callback() - resets protection structs so that when an AP |
| 126 | * causing use of protection goes away, corresponding protection bit can be |
| 127 | * reset |
| 128 | * @ptr: pointer to pSessionEntry |
| 129 | * |
| 130 | * This function resets protection structs so that when an AP causing use of |
| 131 | * protection goes away, corresponding protection bit can be reset. This allowes |
| 132 | * protection bits to be reset once legacy overlapping APs are gone. |
| 133 | * |
| 134 | * Return: void |
| 135 | */ |
Jeff Johnson | 9769900 | 2016-10-07 07:32:55 -0700 | [diff] [blame] | 136 | static void pe_reset_protection_callback(void *ptr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 137 | { |
| 138 | tpPESession pe_session_entry = (tpPESession)ptr; |
| 139 | tpAniSirGlobal mac_ctx = (tpAniSirGlobal)pe_session_entry->mac_ctx; |
| 140 | int8_t i = 0; |
| 141 | tUpdateBeaconParams beacon_params; |
| 142 | uint16_t current_protection_state = 0; |
| 143 | tpDphHashNode station_hash_node = NULL; |
| 144 | tSirMacHTOperatingMode old_op_mode; |
| 145 | bool bcn_prms_changed = false; |
| 146 | |
| 147 | if (pe_session_entry->valid == false) { |
Nishank Aggarwal | c7c6592 | 2017-03-24 19:56:23 +0530 | [diff] [blame] | 148 | pe_err("session already deleted. exiting timer callback"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 149 | return; |
| 150 | } |
| 151 | |
Manishekar Chandrasekaran | 9e8c7be | 2016-08-03 14:57:14 +0530 | [diff] [blame] | 152 | /* |
| 153 | * During CAC period, if the callback is triggered, the beacon |
| 154 | * template may get updated. Subsequently if the vdev is not up, the |
| 155 | * vdev would be made up -- which should not happen during the CAC |
| 156 | * period. To avoid this, ignore the protection callback if the session |
| 157 | * is not yet up. |
| 158 | */ |
| 159 | if (!wma_is_vdev_up(pe_session_entry->smeSessionId)) { |
Nishank Aggarwal | c7c6592 | 2017-03-24 19:56:23 +0530 | [diff] [blame] | 160 | pe_err("session is not up yet. exiting timer callback"); |
Manishekar Chandrasekaran | 9e8c7be | 2016-08-03 14:57:14 +0530 | [diff] [blame] | 161 | return; |
| 162 | } |
| 163 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 164 | current_protection_state |= |
| 165 | pe_session_entry->gLimOverlap11gParams.protectionEnabled | |
| 166 | pe_session_entry->gLimOverlap11aParams.protectionEnabled << 1 | |
| 167 | pe_session_entry->gLimOverlapHt20Params.protectionEnabled << 2 | |
| 168 | pe_session_entry->gLimOverlapNonGfParams.protectionEnabled << 3 | |
| 169 | pe_session_entry->gLimOlbcParams.protectionEnabled << 4; |
| 170 | |
Nishank Aggarwal | c7c6592 | 2017-03-24 19:56:23 +0530 | [diff] [blame] | 171 | pe_debug("old protection state: 0x%04X, new protection state: 0x%04X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 172 | pe_session_entry->old_protection_state, |
| 173 | current_protection_state); |
| 174 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 175 | qdf_mem_zero(&pe_session_entry->gLimOverlap11gParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 176 | sizeof(pe_session_entry->gLimOverlap11gParams)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 177 | qdf_mem_zero(&pe_session_entry->gLimOverlap11aParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 178 | sizeof(pe_session_entry->gLimOverlap11aParams)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 179 | qdf_mem_zero(&pe_session_entry->gLimOverlapHt20Params, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 180 | sizeof(pe_session_entry->gLimOverlapHt20Params)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 181 | qdf_mem_zero(&pe_session_entry->gLimOverlapNonGfParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 182 | sizeof(pe_session_entry->gLimOverlapNonGfParams)); |
| 183 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 184 | qdf_mem_zero(&pe_session_entry->gLimOlbcParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 185 | sizeof(pe_session_entry->gLimOlbcParams)); |
| 186 | |
Abhishek Singh | af7e7fa | 2016-08-08 17:59:31 +0530 | [diff] [blame] | 187 | /* |
| 188 | * Do not reset fShortPreamble and beaconInterval, as they |
| 189 | * are not updated. |
| 190 | */ |
| 191 | pe_session_entry->beaconParams.llaCoexist = 0; |
| 192 | pe_session_entry->beaconParams.llbCoexist = 0; |
| 193 | pe_session_entry->beaconParams.llgCoexist = 0; |
| 194 | pe_session_entry->beaconParams.ht20Coexist = 0; |
| 195 | pe_session_entry->beaconParams.llnNonGFCoexist = 0; |
| 196 | pe_session_entry->beaconParams.fRIFSMode = 0; |
| 197 | pe_session_entry->beaconParams.fLsigTXOPProtectionFullSupport = 0; |
| 198 | pe_session_entry->beaconParams.gHTObssMode = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 199 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 200 | |
| 201 | old_op_mode = pe_session_entry->htOperMode; |
| 202 | pe_session_entry->htOperMode = eSIR_HT_OP_MODE_PURE; |
Masti, Narayanraddi | 4d8860c | 2016-08-22 15:46:48 +0530 | [diff] [blame] | 203 | mac_ctx->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 204 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 205 | qdf_mem_zero(&beacon_params, sizeof(tUpdateBeaconParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 206 | /* index 0, is self node, peers start from 1 */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 207 | for (i = 1 ; i <= mac_ctx->lim.gLimAssocStaLimit ; i++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 208 | station_hash_node = dph_get_hash_entry(mac_ctx, i, |
| 209 | &pe_session_entry->dph.dphHashTable); |
| 210 | if (NULL == station_hash_node) |
| 211 | continue; |
| 212 | lim_decide_ap_protection(mac_ctx, station_hash_node->staAddr, |
| 213 | &beacon_params, pe_session_entry); |
| 214 | } |
| 215 | |
| 216 | if (pe_session_entry->htOperMode != old_op_mode) |
| 217 | bcn_prms_changed = true; |
| 218 | |
| 219 | if ((current_protection_state != |
| 220 | pe_session_entry->old_protection_state) && |
| 221 | (false == mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running)) { |
Nishank Aggarwal | c7c6592 | 2017-03-24 19:56:23 +0530 | [diff] [blame] | 222 | pe_debug("protection changed, update beacon template"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 223 | /* update beacon fix params and send update to FW */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 224 | qdf_mem_zero(&beacon_params, sizeof(tUpdateBeaconParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 225 | beacon_params.bssIdx = pe_session_entry->bssIdx; |
| 226 | beacon_params.fShortPreamble = |
| 227 | pe_session_entry->beaconParams.fShortPreamble; |
| 228 | beacon_params.beaconInterval = |
| 229 | pe_session_entry->beaconParams.beaconInterval; |
| 230 | beacon_params.llaCoexist = |
| 231 | pe_session_entry->beaconParams.llaCoexist; |
| 232 | beacon_params.llbCoexist = |
| 233 | pe_session_entry->beaconParams.llbCoexist; |
| 234 | beacon_params.llgCoexist = |
| 235 | pe_session_entry->beaconParams.llgCoexist; |
| 236 | beacon_params.ht20MhzCoexist = |
| 237 | pe_session_entry->beaconParams.ht20Coexist; |
| 238 | beacon_params.llnNonGFCoexist = |
| 239 | pe_session_entry->beaconParams.llnNonGFCoexist; |
| 240 | beacon_params.fLsigTXOPProtectionFullSupport = |
| 241 | pe_session_entry->beaconParams. |
| 242 | fLsigTXOPProtectionFullSupport; |
| 243 | beacon_params.fRIFSMode = |
| 244 | pe_session_entry->beaconParams.fRIFSMode; |
| 245 | beacon_params.smeSessionId = |
| 246 | pe_session_entry->smeSessionId; |
Selvaraj, Sridhar | dc038ee | 2016-06-24 15:22:14 +0530 | [diff] [blame] | 247 | beacon_params.paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 248 | bcn_prms_changed = true; |
| 249 | } |
| 250 | |
| 251 | if (bcn_prms_changed) { |
| 252 | sch_set_fixed_beacon_fields(mac_ctx, pe_session_entry); |
| 253 | lim_send_beacon_params(mac_ctx, &beacon_params, pe_session_entry); |
| 254 | } |
| 255 | |
| 256 | pe_session_entry->old_protection_state = current_protection_state; |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 257 | if (qdf_mc_timer_start(&pe_session_entry-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 258 | protection_fields_reset_timer, |
| 259 | SCH_PROTECTION_RESET_TIME) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 260 | != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | c7c6592 | 2017-03-24 19:56:23 +0530 | [diff] [blame] | 261 | pe_err("cannot create or start protectionFieldsResetTimer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 262 | } |
| 263 | } |
| 264 | |
Abhishek Singh | cfb4448 | 2017-03-10 12:42:37 +0530 | [diff] [blame] | 265 | #ifdef WLAN_FEATURE_11W |
| 266 | /** |
| 267 | * pe_init_pmf_comeback_timer: init PMF comeback timer |
| 268 | * @mac_ctx: pointer to global adapter context |
| 269 | * @session: pe session |
| 270 | * @session_id: session ID |
| 271 | * |
| 272 | * Return: void |
| 273 | */ |
| 274 | static void pe_init_pmf_comeback_timer(tpAniSirGlobal mac_ctx, |
| 275 | tpPESession session, uint8_t session_id) |
| 276 | { |
| 277 | QDF_STATUS status; |
| 278 | |
| 279 | session->pmfComebackTimerInfo.pMac = mac_ctx; |
| 280 | session->pmfComebackTimerInfo.sessionID = session_id; |
| 281 | status = qdf_mc_timer_init(&session->pmfComebackTimer, |
| 282 | QDF_TIMER_TYPE_SW, lim_pmf_comeback_timer_callback, |
| 283 | (void *)&session->pmfComebackTimerInfo); |
| 284 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Nishank Aggarwal | c7c6592 | 2017-03-24 19:56:23 +0530 | [diff] [blame] | 285 | pe_err("cannot init pmf comeback timer"); |
Abhishek Singh | cfb4448 | 2017-03-10 12:42:37 +0530 | [diff] [blame] | 286 | } |
| 287 | #else |
| 288 | static inline void |
| 289 | pe_init_pmf_comeback_timer(tpAniSirGlobal mac_ctx, |
| 290 | tpPESession session, uint8_t session_id) |
| 291 | { |
| 292 | } |
| 293 | #endif |
| 294 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 295 | #ifdef WLAN_FEATURE_FILS_SK |
| 296 | /** |
| 297 | * pe_delete_fils_info: API to delete fils session info |
| 298 | * @session: pe session |
| 299 | * |
| 300 | * Return: void |
| 301 | */ |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 302 | void pe_delete_fils_info(tpPESession session) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 303 | { |
| 304 | struct pe_fils_session *fils_info; |
| 305 | |
| 306 | if (!session || (session && !session->valid)) { |
| 307 | QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 308 | FL("session is not valid")); |
| 309 | return; |
| 310 | } |
| 311 | fils_info = session->fils_info; |
| 312 | if (!fils_info) { |
| 313 | QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 314 | FL("fils info not found")); |
| 315 | return; |
| 316 | } |
| 317 | if (fils_info->keyname_nai_data) |
| 318 | qdf_mem_free(fils_info->keyname_nai_data); |
| 319 | if (fils_info->fils_erp_reauth_pkt) |
| 320 | qdf_mem_free(fils_info->fils_erp_reauth_pkt); |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 321 | if (fils_info->fils_rrk) |
| 322 | qdf_mem_free(fils_info->fils_rrk); |
| 323 | if (fils_info->fils_rik) |
| 324 | qdf_mem_free(fils_info->fils_rik); |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 325 | if (fils_info->fils_eap_finish_pkt) |
| 326 | qdf_mem_free(fils_info->fils_eap_finish_pkt); |
| 327 | if (fils_info->fils_rmsk) |
| 328 | qdf_mem_free(fils_info->fils_rmsk); |
| 329 | if (fils_info->fils_pmk) |
| 330 | qdf_mem_free(fils_info->fils_pmk); |
| 331 | if (fils_info->auth_info.keyname) |
| 332 | qdf_mem_free(fils_info->auth_info.keyname); |
| 333 | if (fils_info->auth_info.domain_name) |
| 334 | qdf_mem_free(fils_info->auth_info.domain_name); |
Vignesh Viswanathan | a1bb092 | 2017-09-15 12:58:48 +0530 | [diff] [blame] | 335 | if (fils_info->hlp_data) |
| 336 | qdf_mem_free(fils_info->hlp_data); |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 337 | qdf_mem_free(fils_info); |
| 338 | session->fils_info = NULL; |
| 339 | } |
| 340 | /** |
| 341 | * pe_init_fils_info: API to initialize fils session info elements to null |
| 342 | * @session: pe session |
| 343 | * |
| 344 | * Return: void |
| 345 | */ |
| 346 | static void pe_init_fils_info(tpPESession session) |
| 347 | { |
| 348 | struct pe_fils_session *fils_info; |
| 349 | |
| 350 | if (!session || (session && !session->valid)) { |
| 351 | QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 352 | FL("session is not valid")); |
| 353 | return; |
| 354 | } |
| 355 | session->fils_info = qdf_mem_malloc(sizeof(struct pe_fils_session)); |
| 356 | fils_info = session->fils_info; |
| 357 | if (!fils_info) { |
| 358 | QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 359 | FL("fils info not found")); |
| 360 | return; |
| 361 | } |
| 362 | fils_info->keyname_nai_data = NULL; |
| 363 | fils_info->fils_erp_reauth_pkt = NULL; |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 364 | fils_info->fils_rrk = NULL; |
| 365 | fils_info->fils_rik = NULL; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 366 | fils_info->fils_eap_finish_pkt = NULL; |
| 367 | fils_info->fils_rmsk = NULL; |
| 368 | fils_info->fils_pmk = NULL; |
| 369 | fils_info->auth_info.keyname = NULL; |
| 370 | fils_info->auth_info.domain_name = NULL; |
| 371 | } |
| 372 | #else |
| 373 | static void pe_delete_fils_info(tpPESession session) { } |
| 374 | static void pe_init_fils_info(tpPESession session) { } |
| 375 | #endif |
| 376 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 377 | /** |
Abhishek Singh | 4788860 | 2017-05-10 12:50:50 +0530 | [diff] [blame] | 378 | * lim_get_peer_idxpool_size: get number of peer idx pool size |
| 379 | * @num_sta: Max number of STA |
| 380 | * @bss_type: BSS type |
| 381 | * |
| 382 | * The peer index start from 1 and thus index 0 is not used, so |
| 383 | * add 1 to the max sta. For STA if TDLS is enabled add 2 as |
| 384 | * index 1 is reserved for peer BSS. |
| 385 | * |
| 386 | * Return: number of peer idx pool size |
| 387 | */ |
| 388 | #ifdef FEATURE_WLAN_TDLS |
| 389 | static inline uint8_t |
| 390 | lim_get_peer_idxpool_size(uint16_t num_sta, tSirBssType bss_type) |
| 391 | { |
| 392 | /* |
| 393 | * In station role, index 1 is reserved for peer |
| 394 | * corresponding to AP. For TDLS the index should |
| 395 | * start from 2 |
| 396 | */ |
| 397 | if (bss_type == eSIR_INFRASTRUCTURE_MODE) |
| 398 | return num_sta + 2; |
| 399 | else |
| 400 | return num_sta + 1; |
| 401 | |
| 402 | } |
| 403 | #else |
| 404 | static inline uint8_t |
| 405 | lim_get_peer_idxpool_size(uint16_t num_sta, tSirBssType bss_type) |
| 406 | { |
| 407 | return num_sta + 1; |
| 408 | } |
| 409 | #endif |
| 410 | |
Vignesh Viswanathan | b3dbbc8 | 2018-04-06 00:06:27 +0530 | [diff] [blame] | 411 | void lim_set_bcn_probe_filter(tpAniSirGlobal mac_ctx, |
| 412 | tpPESession session, |
| 413 | tSirMacSSid *ibss_ssid, |
| 414 | uint8_t sap_channel) |
| 415 | { |
| 416 | struct mgmt_beacon_probe_filter *filter; |
| 417 | tSirBssType bss_type; |
| 418 | uint8_t session_id; |
| 419 | tSirMacAddr *bssid; |
| 420 | |
| 421 | if (!session) { |
| 422 | pe_err("Invalid session pointer"); |
| 423 | return; |
| 424 | } |
| 425 | |
| 426 | bss_type = session->bssType; |
| 427 | session_id = session->peSessionId; |
| 428 | bssid = &session->bssId; |
| 429 | |
| 430 | if (session_id >= SIR_MAX_SUPPORTED_BSS) { |
| 431 | pe_err("Invalid session_id %d of type %d", |
| 432 | session_id, bss_type); |
| 433 | return; |
| 434 | } |
| 435 | |
| 436 | filter = &mac_ctx->bcn_filter; |
| 437 | |
| 438 | if (eSIR_INFRASTRUCTURE_MODE == bss_type) { |
| 439 | filter->num_sta_sessions++; |
| 440 | sir_copy_mac_addr(filter->sta_bssid[session_id], *bssid); |
| 441 | pe_debug("Set filter for STA Session %d bssid "MAC_ADDRESS_STR, |
| 442 | session_id, MAC_ADDR_ARRAY(*bssid)); |
| 443 | } else if (eSIR_IBSS_MODE == bss_type) { |
| 444 | if (!ibss_ssid) { |
| 445 | pe_err("IBSS Type with NULL SSID"); |
| 446 | goto done; |
| 447 | } |
| 448 | filter->num_ibss_sessions++; |
| 449 | filter->ibss_ssid[session_id].length = ibss_ssid->length; |
| 450 | qdf_mem_copy(&filter->ibss_ssid[session_id].length, |
| 451 | ibss_ssid->ssId, |
| 452 | ibss_ssid->length); |
| 453 | pe_debug("Set filter for IBSS session %d ssid %s", |
| 454 | session_id, ibss_ssid->ssId); |
| 455 | } else if (eSIR_INFRA_AP_MODE == bss_type) { |
| 456 | if (!sap_channel) { |
| 457 | pe_err("SAP Type with invalid channel"); |
| 458 | goto done; |
| 459 | } |
| 460 | filter->num_sap_sessions++; |
| 461 | filter->sap_channel[session_id] = sap_channel; |
| 462 | pe_debug("Set filter for SAP session %d channel %d", |
| 463 | session_id, sap_channel); |
| 464 | } |
| 465 | |
| 466 | done: |
| 467 | pe_debug("sta %d ibss %d sap %d", |
| 468 | filter->num_sta_sessions, filter->num_ibss_sessions, |
| 469 | filter->num_sap_sessions); |
| 470 | } |
| 471 | |
| 472 | void lim_reset_bcn_probe_filter(tpAniSirGlobal mac_ctx, |
| 473 | tpPESession session) |
| 474 | { |
| 475 | struct mgmt_beacon_probe_filter *filter; |
| 476 | tSirBssType bss_type; |
| 477 | uint8_t session_id; |
| 478 | |
| 479 | if (!session) { |
| 480 | pe_err("Invalid session pointer"); |
| 481 | return; |
| 482 | } |
| 483 | |
| 484 | bss_type = session->bssType; |
| 485 | session_id = session->peSessionId; |
| 486 | |
| 487 | if (session_id >= SIR_MAX_SUPPORTED_BSS) { |
| 488 | pe_err("Invalid session_id %d of type %d", |
| 489 | session_id, bss_type); |
| 490 | return; |
| 491 | } |
| 492 | |
| 493 | filter = &mac_ctx->bcn_filter; |
| 494 | |
| 495 | if (eSIR_INFRASTRUCTURE_MODE == bss_type) { |
| 496 | if (filter->num_sta_sessions) |
| 497 | filter->num_sta_sessions--; |
| 498 | qdf_mem_set(&filter->sta_bssid[session_id], |
| 499 | sizeof(tSirMacAddr), 0); |
| 500 | pe_debug("Cleared STA Filter for session %d", session_id); |
| 501 | } else if (eSIR_IBSS_MODE == bss_type) { |
| 502 | if (filter->num_ibss_sessions) |
| 503 | filter->num_ibss_sessions--; |
| 504 | filter->ibss_ssid[session_id].length = 0; |
| 505 | qdf_mem_set(&filter->ibss_ssid[session_id].ssId, |
| 506 | SIR_MAC_MAX_SSID_LENGTH, 0); |
| 507 | pe_debug("Cleared IBSS Filter for session %d", session_id); |
| 508 | } else if (eSIR_INFRA_AP_MODE == bss_type) { |
| 509 | if (filter->num_sap_sessions) |
| 510 | filter->num_sap_sessions--; |
| 511 | filter->sap_channel[session_id] = 0; |
| 512 | pe_debug("Cleared SAP Filter for session %d", session_id); |
| 513 | } |
| 514 | |
| 515 | pe_debug("sta %d ibss %d sap %d", |
| 516 | filter->num_sta_sessions, filter->num_ibss_sessions, |
| 517 | filter->num_sap_sessions); |
| 518 | } |
| 519 | |
| 520 | void lim_update_bcn_probe_filter(tpAniSirGlobal mac_ctx, |
| 521 | tpPESession session) |
| 522 | { |
| 523 | struct mgmt_beacon_probe_filter *filter; |
| 524 | tSirBssType bss_type; |
| 525 | uint8_t session_id; |
| 526 | |
| 527 | if (!session) { |
| 528 | pe_err("Invalid session pointer"); |
| 529 | return; |
| 530 | } |
| 531 | |
| 532 | bss_type = session->bssType; |
| 533 | session_id = session->peSessionId; |
| 534 | |
| 535 | if (session_id >= SIR_MAX_SUPPORTED_BSS) { |
| 536 | pe_err("Invalid session_id %d of type %d", |
| 537 | session_id, bss_type); |
| 538 | return; |
| 539 | } |
| 540 | |
| 541 | filter = &mac_ctx->bcn_filter; |
| 542 | |
| 543 | if (eSIR_INFRA_AP_MODE == bss_type) { |
| 544 | filter->sap_channel[session_id] = session->currentOperChannel; |
| 545 | pe_debug("Updated SAP Filter for session %d channel %d", |
| 546 | session_id, filter->sap_channel[session_id]); |
| 547 | } else { |
| 548 | pe_debug("Invalid session type %d session id %d", |
| 549 | bss_type, session_id); |
| 550 | } |
| 551 | |
| 552 | pe_debug("sta %d ibss %d sap %d", |
| 553 | filter->num_sta_sessions, filter->num_ibss_sessions, |
| 554 | filter->num_sap_sessions); |
| 555 | } |
| 556 | |
Abhishek Singh | 4788860 | 2017-05-10 12:50:50 +0530 | [diff] [blame] | 557 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 558 | * pe_create_session() creates a new PE session given the BSSID |
| 559 | * @param pMac: pointer to global adapter context |
| 560 | * @param bssid: BSSID of the new session |
| 561 | * @param sessionId: session ID is returned here, if session is created. |
| 562 | * @param bssType: station or a |
| 563 | * |
| 564 | * This function returns the session context and the session ID if the session |
| 565 | * corresponding to the passed BSSID is found in the PE session table. |
| 566 | * |
| 567 | * Return: tpPESession: pointer to the session context or NULL if session |
| 568 | * can not be created. |
| 569 | */ |
| 570 | |
| 571 | tpPESession |
| 572 | pe_create_session(tpAniSirGlobal pMac, uint8_t *bssid, uint8_t *sessionId, |
| 573 | uint16_t numSta, tSirBssType bssType) |
| 574 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 575 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 576 | uint8_t i; |
| 577 | tpPESession session_ptr; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 578 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 579 | for (i = 0; i < pMac->lim.maxBssId; i++) { |
| 580 | /* Find first free room in session table */ |
| 581 | if (pMac->lim.gpSession[i].valid == true) |
| 582 | continue; |
| 583 | break; |
| 584 | } |
| 585 | |
| 586 | if (i == pMac->lim.maxBssId) { |
Nishank Aggarwal | c7c6592 | 2017-03-24 19:56:23 +0530 | [diff] [blame] | 587 | pe_err("Session can't be created. Reached max sessions"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 588 | return NULL; |
| 589 | } |
| 590 | |
| 591 | session_ptr = &pMac->lim.gpSession[i]; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 592 | qdf_mem_set((void *)session_ptr, sizeof(tPESession), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 593 | /* Allocate space for Station Table for this session. */ |
| 594 | session_ptr->dph.dphHashTable.pHashTable = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 595 | qdf_mem_malloc(sizeof(tpDphHashNode) * (numSta + 1)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 596 | if (NULL == session_ptr->dph.dphHashTable.pHashTable) { |
Nishank Aggarwal | c7c6592 | 2017-03-24 19:56:23 +0530 | [diff] [blame] | 597 | pe_err("memory allocate failed!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 598 | return NULL; |
| 599 | } |
| 600 | |
Qiwei Cai | 50a2108 | 2018-08-07 14:30:09 +0800 | [diff] [blame^] | 601 | session_ptr->dph.dphHashTable.pDphNodeArray = |
| 602 | pe_get_session_dph_node_array(i); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 603 | session_ptr->dph.dphHashTable.size = numSta + 1; |
| 604 | dph_hash_table_class_init(pMac, &session_ptr->dph.dphHashTable); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 605 | session_ptr->gpLimPeerIdxpool = qdf_mem_malloc( |
Abhishek Singh | 4788860 | 2017-05-10 12:50:50 +0530 | [diff] [blame] | 606 | sizeof(*(session_ptr->gpLimPeerIdxpool)) * |
| 607 | lim_get_peer_idxpool_size(numSta, bssType)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 608 | if (NULL == session_ptr->gpLimPeerIdxpool) { |
Nishank Aggarwal | c7c6592 | 2017-03-24 19:56:23 +0530 | [diff] [blame] | 609 | pe_err("memory allocate failed!"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 610 | qdf_mem_free(session_ptr->dph.dphHashTable.pHashTable); |
Naveen Rawat | b0c5b6b | 2017-11-27 17:37:40 -0800 | [diff] [blame] | 611 | qdf_mem_zero(session_ptr->dph.dphHashTable.pDphNodeArray, |
| 612 | sizeof(struct sDphHashNode) * |
| 613 | (SIR_SAP_MAX_NUM_PEERS + 1)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 614 | session_ptr->dph.dphHashTable.pHashTable = NULL; |
| 615 | session_ptr->dph.dphHashTable.pDphNodeArray = NULL; |
| 616 | return NULL; |
| 617 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 618 | session_ptr->freePeerIdxHead = 0; |
| 619 | session_ptr->freePeerIdxTail = 0; |
| 620 | session_ptr->gLimNumOfCurrentSTAs = 0; |
| 621 | /* Copy the BSSID to the session table */ |
| 622 | sir_copy_mac_addr(session_ptr->bssId, bssid); |
Manjunathappa Prakash | 0e6e6b5 | 2016-04-21 11:48:48 -0700 | [diff] [blame] | 623 | if (bssType == eSIR_MONITOR_MODE) |
| 624 | sir_copy_mac_addr(pMac->lim.gpSession[i].selfMacAddr, bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 625 | session_ptr->valid = true; |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 626 | /* Initialize the SME and MLM states to IDLE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 627 | session_ptr->limMlmState = eLIM_MLM_IDLE_STATE; |
| 628 | session_ptr->limSmeState = eLIM_SME_IDLE_STATE; |
| 629 | session_ptr->limCurrentAuthType = eSIR_OPEN_SYSTEM; |
| 630 | pe_init_beacon_params(pMac, &pMac->lim.gpSession[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 631 | session_ptr->is11Rconnection = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 632 | #ifdef FEATURE_WLAN_ESE |
| 633 | session_ptr->isESEconnection = false; |
| 634 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 635 | session_ptr->isFastTransitionEnabled = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 636 | session_ptr->isFastRoamIniFeatureEnabled = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 637 | *sessionId = i; |
Vignesh Viswanathan | b3dbbc8 | 2018-04-06 00:06:27 +0530 | [diff] [blame] | 638 | session_ptr->peSessionId = i; |
| 639 | session_ptr->bssType = bssType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 640 | session_ptr->gLimPhyMode = WNI_CFG_PHY_MODE_11G; |
| 641 | /* Initialize CB mode variables when session is created */ |
| 642 | session_ptr->htSupportedChannelWidthSet = 0; |
| 643 | session_ptr->htRecommendedTxWidthSet = 0; |
| 644 | session_ptr->htSecondaryChannelOffset = 0; |
| 645 | #ifdef FEATURE_WLAN_TDLS |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 646 | qdf_mem_set(session_ptr->peerAIDBitmap, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 647 | sizeof(session_ptr->peerAIDBitmap), 0); |
| 648 | session_ptr->tdls_prohibited = false; |
| 649 | session_ptr->tdls_chan_swit_prohibited = false; |
| 650 | #endif |
| 651 | session_ptr->fWaitForProbeRsp = 0; |
| 652 | session_ptr->fIgnoreCapsChange = 0; |
Selvaraj, Sridhar | 5b5a065 | 2017-05-04 11:23:07 +0530 | [diff] [blame] | 653 | session_ptr->ignore_assoc_disallowed = pMac->ignore_assoc_disallowed; |
Arif Hussain | 05fb487 | 2018-01-03 16:02:55 -0800 | [diff] [blame] | 654 | session_ptr->is_session_obss_color_collision_det_enabled = |
| 655 | pMac->lim.global_obss_color_collision_det_offload; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 656 | |
Nishank Aggarwal | c7c6592 | 2017-03-24 19:56:23 +0530 | [diff] [blame] | 657 | pe_debug("Create a new PE session: %d BSSID: "MAC_ADDRESS_STR" Max No of STA: %d", |
Kapil Gupta | bf4943c | 2016-10-13 12:15:39 +0530 | [diff] [blame] | 658 | *sessionId, MAC_ADDR_ARRAY(bssid), numSta); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 659 | |
Rajeev Kumar | cf835a0 | 2016-04-15 15:01:31 -0700 | [diff] [blame] | 660 | if (eSIR_INFRA_AP_MODE == bssType || eSIR_IBSS_MODE == bssType) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 661 | session_ptr->pSchProbeRspTemplate = |
Abhinav Kumar | 6883422 | 2018-07-18 19:06:14 +0530 | [diff] [blame] | 662 | qdf_mem_malloc(SIR_MAX_PROBE_RESP_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 663 | session_ptr->pSchBeaconFrameBegin = |
Abhinav Kumar | 6883422 | 2018-07-18 19:06:14 +0530 | [diff] [blame] | 664 | qdf_mem_malloc(SIR_MAX_BEACON_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 665 | session_ptr->pSchBeaconFrameEnd = |
Abhinav Kumar | 6883422 | 2018-07-18 19:06:14 +0530 | [diff] [blame] | 666 | qdf_mem_malloc(SIR_MAX_BEACON_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 667 | if ((NULL == session_ptr->pSchProbeRspTemplate) |
| 668 | || (NULL == session_ptr->pSchBeaconFrameBegin) |
| 669 | || (NULL == session_ptr->pSchBeaconFrameEnd)) { |
Nishank Aggarwal | c7c6592 | 2017-03-24 19:56:23 +0530 | [diff] [blame] | 670 | pe_err("memory allocate failed!"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 671 | qdf_mem_free(session_ptr->dph.dphHashTable.pHashTable); |
Naveen Rawat | b0c5b6b | 2017-11-27 17:37:40 -0800 | [diff] [blame] | 672 | qdf_mem_zero( |
| 673 | session_ptr->dph.dphHashTable.pDphNodeArray, |
| 674 | sizeof(struct sDphHashNode) * |
| 675 | (SIR_SAP_MAX_NUM_PEERS + 1)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 676 | qdf_mem_free(session_ptr->gpLimPeerIdxpool); |
| 677 | qdf_mem_free(session_ptr->pSchProbeRspTemplate); |
| 678 | qdf_mem_free(session_ptr->pSchBeaconFrameBegin); |
| 679 | qdf_mem_free(session_ptr->pSchBeaconFrameEnd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 680 | |
| 681 | session_ptr->dph.dphHashTable.pHashTable = NULL; |
| 682 | session_ptr->dph.dphHashTable.pDphNodeArray = NULL; |
| 683 | session_ptr->gpLimPeerIdxpool = NULL; |
| 684 | session_ptr->pSchProbeRspTemplate = NULL; |
| 685 | session_ptr->pSchBeaconFrameBegin = NULL; |
| 686 | session_ptr->pSchBeaconFrameEnd = NULL; |
| 687 | return NULL; |
| 688 | } |
| 689 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 690 | if (eSIR_INFRASTRUCTURE_MODE == bssType) |
| 691 | lim_ft_open(pMac, &pMac->lim.gpSession[i]); |
Manjunathappa Prakash | 0e6e6b5 | 2016-04-21 11:48:48 -0700 | [diff] [blame] | 692 | |
| 693 | if (eSIR_MONITOR_MODE == bssType) |
| 694 | lim_ft_open(pMac, &pMac->lim.gpSession[i]); |
| 695 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 696 | if (eSIR_INFRA_AP_MODE == bssType) { |
| 697 | session_ptr->old_protection_state = 0; |
Arif Hussain | 1513cb2 | 2018-01-05 19:56:31 -0800 | [diff] [blame] | 698 | session_ptr->is_session_obss_offload_enabled = false; |
| 699 | session_ptr->is_obss_reset_timer_initialized = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 700 | session_ptr->mac_ctx = (void *)pMac; |
Arif Hussain | 1513cb2 | 2018-01-05 19:56:31 -0800 | [diff] [blame] | 701 | |
| 702 | status = qdf_mc_timer_init(&session_ptr-> |
| 703 | protection_fields_reset_timer, |
| 704 | QDF_TIMER_TYPE_SW, |
| 705 | pe_reset_protection_callback, |
| 706 | (void *)&pMac->lim.gpSession[i]); |
| 707 | |
| 708 | if (QDF_IS_STATUS_ERROR(status)) |
| 709 | pe_err("cannot create protection fields reset timer"); |
| 710 | else |
| 711 | session_ptr->is_obss_reset_timer_initialized = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 712 | } |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 713 | pe_init_fils_info(session_ptr); |
Abhishek Singh | cfb4448 | 2017-03-10 12:42:37 +0530 | [diff] [blame] | 714 | pe_init_pmf_comeback_timer(pMac, session_ptr, *sessionId); |
Tushnim Bhattacharyya | 3d17def | 2017-06-19 11:13:43 -0700 | [diff] [blame] | 715 | session_ptr->ht_client_cnt = 0; |
Naveen Rawat | 6fc3c50 | 2017-09-06 16:14:11 -0700 | [diff] [blame] | 716 | /* following is invalid value since seq number is 12 bit */ |
| 717 | session_ptr->prev_auth_seq_num = 0xFFFF; |
Krishna Kumaar Natarajan | 48de7de | 2015-12-08 14:43:13 -0800 | [diff] [blame] | 718 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 719 | return &pMac->lim.gpSession[i]; |
| 720 | } |
| 721 | |
| 722 | /*-------------------------------------------------------------------------- |
| 723 | \brief pe_find_session_by_bssid() - looks up the PE session given the BSSID. |
| 724 | |
| 725 | This function returns the session context and the session ID if the session |
| 726 | corresponding to the given BSSID is found in the PE session table. |
| 727 | |
| 728 | \param pMac - pointer to global adapter context |
| 729 | \param bssid - BSSID of the session |
| 730 | \param sessionId -session ID is returned here, if session is found. |
| 731 | |
| 732 | \return tpPESession - pointer to the session context or NULL if session is not found. |
| 733 | |
| 734 | \sa |
| 735 | --------------------------------------------------------------------------*/ |
| 736 | tpPESession pe_find_session_by_bssid(tpAniSirGlobal pMac, uint8_t *bssid, |
| 737 | uint8_t *sessionId) |
| 738 | { |
| 739 | uint8_t i; |
| 740 | |
| 741 | for (i = 0; i < pMac->lim.maxBssId; i++) { |
| 742 | /* If BSSID matches return corresponding tables address */ |
| 743 | if ((pMac->lim.gpSession[i].valid) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 744 | && (sir_compare_mac_addr(pMac->lim.gpSession[i].bssId, |
| 745 | bssid))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 746 | *sessionId = i; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 747 | return &pMac->lim.gpSession[i]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 748 | } |
| 749 | } |
| 750 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 751 | return NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 752 | |
| 753 | } |
| 754 | |
| 755 | /*-------------------------------------------------------------------------- |
| 756 | \brief pe_find_session_by_bss_idx() - looks up the PE session given the bssIdx. |
| 757 | |
| 758 | This function returns the session context if the session |
| 759 | corresponding to the given bssIdx is found in the PE session table. |
| 760 | \param pMac - pointer to global adapter context |
| 761 | \param bssIdx - bss index of the session |
| 762 | \return tpPESession - pointer to the session context or NULL if session is not found. |
| 763 | \sa |
| 764 | --------------------------------------------------------------------------*/ |
| 765 | tpPESession pe_find_session_by_bss_idx(tpAniSirGlobal pMac, uint8_t bssIdx) |
| 766 | { |
| 767 | uint8_t i; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 768 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 769 | for (i = 0; i < pMac->lim.maxBssId; i++) { |
| 770 | /* If BSSID matches return corresponding tables address */ |
| 771 | if ((pMac->lim.gpSession[i].valid) |
| 772 | && (pMac->lim.gpSession[i].bssIdx == bssIdx)) { |
| 773 | return &pMac->lim.gpSession[i]; |
| 774 | } |
| 775 | } |
Nishank Aggarwal | c7c6592 | 2017-03-24 19:56:23 +0530 | [diff] [blame] | 776 | pe_debug("Session lookup fails for bssIdx: %d", bssIdx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 777 | return NULL; |
| 778 | } |
| 779 | |
| 780 | /*-------------------------------------------------------------------------- |
| 781 | \brief pe_find_session_by_session_id() - looks up the PE session given the session ID. |
| 782 | |
| 783 | This function returns the session context if the session |
| 784 | corresponding to the given session ID is found in the PE session table. |
| 785 | |
| 786 | \param pMac - pointer to global adapter context |
| 787 | \param sessionId -session ID for which session context needs to be looked up. |
| 788 | |
| 789 | \return tpPESession - pointer to the session context or NULL if session is not found. |
| 790 | |
| 791 | \sa |
| 792 | --------------------------------------------------------------------------*/ |
Srinivas Girigowda | f326dfe | 2017-08-03 11:28:32 -0700 | [diff] [blame] | 793 | tpPESession pe_find_session_by_session_id(tpAniSirGlobal pMac, |
| 794 | uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 795 | { |
| 796 | if (sessionId >= pMac->lim.maxBssId) { |
Nishank Aggarwal | c7c6592 | 2017-03-24 19:56:23 +0530 | [diff] [blame] | 797 | pe_err("Invalid sessionId: %d", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 798 | return NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 799 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 800 | |
Srinivas Girigowda | f326dfe | 2017-08-03 11:28:32 -0700 | [diff] [blame] | 801 | if (pMac->lim.gpSession[sessionId].valid) |
| 802 | return &pMac->lim.gpSession[sessionId]; |
| 803 | |
| 804 | return NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 805 | } |
| 806 | |
| 807 | /** |
| 808 | * pe_find_session_by_sta_id() - looks up the PE session given staid. |
| 809 | * @mac_ctx: pointer to global adapter context |
| 810 | * @staid: StaId of the session |
| 811 | * @session_id: session ID is returned here, if session is found. |
| 812 | * |
| 813 | * This function returns the session context and the session ID if the session |
| 814 | * corresponding to the given StaId is found in the PE session table. |
| 815 | * |
| 816 | * Return: session pointer |
| 817 | */ |
| 818 | tpPESession |
| 819 | pe_find_session_by_sta_id(tpAniSirGlobal mac_ctx, |
| 820 | uint8_t staid, |
| 821 | uint8_t *session_id) |
| 822 | { |
| 823 | uint8_t i, j; |
| 824 | tpPESession session_ptr; |
| 825 | dphHashTableClass *dph_ptr; |
| 826 | |
| 827 | for (i = 0; i < mac_ctx->lim.maxBssId; i++) { |
| 828 | if (!mac_ctx->lim.gpSession[i].valid) |
| 829 | continue; |
| 830 | session_ptr = &mac_ctx->lim.gpSession[i]; |
| 831 | dph_ptr = &session_ptr->dph.dphHashTable; |
| 832 | for (j = 0; j < dph_ptr->size; j++) { |
| 833 | if (dph_ptr->pDphNodeArray[j].valid |
| 834 | && dph_ptr->pDphNodeArray[j].added |
| 835 | && staid == dph_ptr->pDphNodeArray[j].staIndex) { |
| 836 | *session_id = i; |
| 837 | return session_ptr; |
| 838 | } |
| 839 | } |
| 840 | } |
| 841 | |
Nishank Aggarwal | c7c6592 | 2017-03-24 19:56:23 +0530 | [diff] [blame] | 842 | pe_debug("Session lookup fails for StaId: %d", staid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 843 | return NULL; |
| 844 | } |
| 845 | |
| 846 | /** |
| 847 | * pe_delete_session() - deletes the PE session given the session ID. |
| 848 | * @mac_ctx: pointer to global adapter context |
| 849 | * @session: session to be deleted. |
| 850 | * |
| 851 | * Deletes the given PE session |
| 852 | * |
| 853 | * Return: void |
| 854 | */ |
| 855 | void pe_delete_session(tpAniSirGlobal mac_ctx, tpPESession session) |
| 856 | { |
| 857 | uint16_t i = 0; |
| 858 | uint16_t n; |
| 859 | TX_TIMER *timer_ptr; |
| 860 | |
Krishna Kumaar Natarajan | 03cc386 | 2015-12-15 17:51:19 -0800 | [diff] [blame] | 861 | if (!session || (session && !session->valid)) { |
Nishank Aggarwal | c7c6592 | 2017-03-24 19:56:23 +0530 | [diff] [blame] | 862 | pe_err("session is not valid"); |
Krishna Kumaar Natarajan | 03cc386 | 2015-12-15 17:51:19 -0800 | [diff] [blame] | 863 | return; |
| 864 | } |
| 865 | |
Nishank Aggarwal | c7c6592 | 2017-03-24 19:56:23 +0530 | [diff] [blame] | 866 | pe_debug("Trying to delete PE session: %d Opmode: %d BssIdx: %d BSSID: "MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 867 | session->peSessionId, session->operMode, |
| 868 | session->bssIdx, |
| 869 | MAC_ADDR_ARRAY(session->bssId)); |
Vignesh Viswanathan | b3dbbc8 | 2018-04-06 00:06:27 +0530 | [diff] [blame] | 870 | |
| 871 | lim_reset_bcn_probe_filter(mac_ctx, session); |
| 872 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 873 | for (n = 0; n < (mac_ctx->lim.maxStation + 1); n++) { |
| 874 | timer_ptr = &mac_ctx->lim.limTimers.gpLimCnfWaitTimer[n]; |
| 875 | if (session->peSessionId == timer_ptr->sessionId) |
| 876 | if (true == tx_timer_running(timer_ptr)) |
| 877 | tx_timer_deactivate(timer_ptr); |
| 878 | } |
| 879 | |
Karthick S | 7a17a71 | 2015-10-14 16:12:48 +0530 | [diff] [blame] | 880 | if (LIM_IS_AP_ROLE(session)) { |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 881 | qdf_mc_timer_stop(&session->protection_fields_reset_timer); |
| 882 | qdf_mc_timer_destroy(&session->protection_fields_reset_timer); |
Krunal Soni | 6de1b21 | 2017-10-30 23:29:20 -0700 | [diff] [blame] | 883 | lim_del_pmf_sa_query_timer(mac_ctx, session); |
Karthick S | 7a17a71 | 2015-10-14 16:12:48 +0530 | [diff] [blame] | 884 | } |
| 885 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 886 | /* Delete FT related information */ |
| 887 | lim_ft_cleanup(mac_ctx, session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 888 | if (session->pLimStartBssReq != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 889 | qdf_mem_free(session->pLimStartBssReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 890 | session->pLimStartBssReq = NULL; |
| 891 | } |
| 892 | |
| 893 | if (session->pLimJoinReq != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 894 | qdf_mem_free(session->pLimJoinReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 895 | session->pLimJoinReq = NULL; |
| 896 | } |
| 897 | |
| 898 | if (session->pLimReAssocReq != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 899 | qdf_mem_free(session->pLimReAssocReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 900 | session->pLimReAssocReq = NULL; |
| 901 | } |
| 902 | |
| 903 | if (session->pLimMlmJoinReq != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 904 | qdf_mem_free(session->pLimMlmJoinReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 905 | session->pLimMlmJoinReq = NULL; |
| 906 | } |
| 907 | |
| 908 | if (session->dph.dphHashTable.pHashTable != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 909 | qdf_mem_free(session->dph.dphHashTable.pHashTable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 910 | session->dph.dphHashTable.pHashTable = NULL; |
| 911 | } |
| 912 | |
| 913 | if (session->dph.dphHashTable.pDphNodeArray != NULL) { |
Naveen Rawat | b0c5b6b | 2017-11-27 17:37:40 -0800 | [diff] [blame] | 914 | qdf_mem_zero(session->dph.dphHashTable.pDphNodeArray, |
| 915 | sizeof(struct sDphHashNode) * |
| 916 | (SIR_SAP_MAX_NUM_PEERS + 1)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 917 | session->dph.dphHashTable.pDphNodeArray = NULL; |
| 918 | } |
| 919 | |
| 920 | if (session->gpLimPeerIdxpool != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 921 | qdf_mem_free(session->gpLimPeerIdxpool); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 922 | session->gpLimPeerIdxpool = NULL; |
| 923 | } |
| 924 | |
| 925 | if (session->beacon != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 926 | qdf_mem_free(session->beacon); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 927 | session->beacon = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 928 | session->bcnLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 929 | } |
| 930 | |
| 931 | if (session->assocReq != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 932 | qdf_mem_free(session->assocReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 933 | session->assocReq = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 934 | session->assocReqLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 935 | } |
| 936 | |
| 937 | if (session->assocRsp != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 938 | qdf_mem_free(session->assocRsp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 939 | session->assocRsp = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 940 | session->assocRspLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 941 | } |
| 942 | |
| 943 | if (session->parsedAssocReq != NULL) { |
| 944 | tpSirAssocReq tmp_ptr = NULL; |
| 945 | /* Cleanup the individual allocation first */ |
| 946 | for (i = 0; i < session->dph.dphHashTable.size; i++) { |
| 947 | if (session->parsedAssocReq[i] == NULL) |
| 948 | continue; |
| 949 | tmp_ptr = ((tpSirAssocReq) |
| 950 | (session->parsedAssocReq[i])); |
| 951 | if (tmp_ptr->assocReqFrame) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 952 | qdf_mem_free(tmp_ptr->assocReqFrame); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 953 | tmp_ptr->assocReqFrame = NULL; |
| 954 | tmp_ptr->assocReqFrameLength = 0; |
| 955 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 956 | qdf_mem_free(session->parsedAssocReq[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 957 | session->parsedAssocReq[i] = NULL; |
| 958 | } |
| 959 | /* Cleanup the whole block */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 960 | qdf_mem_free(session->parsedAssocReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 961 | session->parsedAssocReq = NULL; |
| 962 | } |
| 963 | if (NULL != session->limAssocResponseData) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 964 | qdf_mem_free(session->limAssocResponseData); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 965 | session->limAssocResponseData = NULL; |
| 966 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 967 | if (NULL != session->pLimMlmReassocRetryReq) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 968 | qdf_mem_free(session->pLimMlmReassocRetryReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 969 | session->pLimMlmReassocRetryReq = NULL; |
| 970 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 971 | if (NULL != session->pLimMlmReassocReq) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 972 | qdf_mem_free(session->pLimMlmReassocReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 973 | session->pLimMlmReassocReq = NULL; |
| 974 | } |
| 975 | |
| 976 | if (NULL != session->pSchProbeRspTemplate) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 977 | qdf_mem_free(session->pSchProbeRspTemplate); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 978 | session->pSchProbeRspTemplate = NULL; |
| 979 | } |
| 980 | |
| 981 | if (NULL != session->pSchBeaconFrameBegin) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 982 | qdf_mem_free(session->pSchBeaconFrameBegin); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 983 | session->pSchBeaconFrameBegin = NULL; |
| 984 | } |
| 985 | |
| 986 | if (NULL != session->pSchBeaconFrameEnd) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 987 | qdf_mem_free(session->pSchBeaconFrameEnd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 988 | session->pSchBeaconFrameEnd = NULL; |
| 989 | } |
| 990 | |
| 991 | /* Must free the buffer before peSession invalid */ |
| 992 | if (NULL != session->addIeParams.probeRespData_buff) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 993 | qdf_mem_free(session->addIeParams.probeRespData_buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 994 | session->addIeParams.probeRespData_buff = NULL; |
| 995 | session->addIeParams.probeRespDataLen = 0; |
| 996 | } |
| 997 | if (NULL != session->addIeParams.assocRespData_buff) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 998 | qdf_mem_free(session->addIeParams.assocRespData_buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 999 | session->addIeParams.assocRespData_buff = NULL; |
| 1000 | session->addIeParams.assocRespDataLen = 0; |
| 1001 | } |
| 1002 | if (NULL != session->addIeParams.probeRespBCNData_buff) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1003 | qdf_mem_free(session->addIeParams.probeRespBCNData_buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1004 | session->addIeParams.probeRespBCNData_buff = NULL; |
| 1005 | session->addIeParams.probeRespBCNDataLen = 0; |
| 1006 | } |
| 1007 | #ifdef WLAN_FEATURE_11W |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 1008 | if (QDF_TIMER_STATE_RUNNING == |
| 1009 | qdf_mc_timer_get_current_state(&session->pmfComebackTimer)) |
| 1010 | qdf_mc_timer_stop(&session->pmfComebackTimer); |
| 1011 | qdf_mc_timer_destroy(&session->pmfComebackTimer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1012 | #endif |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 1013 | pe_delete_fils_info(session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1014 | session->valid = false; |
| 1015 | |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 1016 | if (session->access_policy_vendor_ie) |
| 1017 | qdf_mem_free(session->access_policy_vendor_ie); |
| 1018 | |
| 1019 | session->access_policy_vendor_ie = NULL; |
| 1020 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1021 | if (LIM_IS_AP_ROLE(session)) |
| 1022 | lim_check_and_reset_protection_params(mac_ctx); |
| 1023 | |
| 1024 | return; |
| 1025 | } |
| 1026 | |
| 1027 | /*-------------------------------------------------------------------------- |
| 1028 | \brief pe_find_session_by_peer_sta() - looks up the PE session given the Station Address. |
| 1029 | |
| 1030 | This function returns the session context and the session ID if the session |
| 1031 | corresponding to the given station address is found in the PE session table. |
| 1032 | |
| 1033 | \param pMac - pointer to global adapter context |
| 1034 | \param sa - Peer STA Address of the session |
| 1035 | \param sessionId -session ID is returned here, if session is found. |
| 1036 | |
| 1037 | \return tpPESession - pointer to the session context or NULL if session is not found. |
| 1038 | |
| 1039 | \sa |
| 1040 | --------------------------------------------------------------------------*/ |
| 1041 | |
| 1042 | tpPESession pe_find_session_by_peer_sta(tpAniSirGlobal pMac, uint8_t *sa, |
| 1043 | uint8_t *sessionId) |
| 1044 | { |
| 1045 | uint8_t i; |
| 1046 | tpDphHashNode pSta; |
| 1047 | uint16_t aid; |
| 1048 | |
| 1049 | for (i = 0; i < pMac->lim.maxBssId; i++) { |
| 1050 | if ((pMac->lim.gpSession[i].valid)) { |
| 1051 | pSta = |
| 1052 | dph_lookup_hash_entry(pMac, sa, &aid, |
| 1053 | &pMac->lim.gpSession[i].dph. |
| 1054 | dphHashTable); |
| 1055 | if (pSta != NULL) { |
| 1056 | *sessionId = i; |
| 1057 | return &pMac->lim.gpSession[i]; |
| 1058 | } |
| 1059 | } |
| 1060 | } |
| 1061 | |
Nishank Aggarwal | c7c6592 | 2017-03-24 19:56:23 +0530 | [diff] [blame] | 1062 | pe_debug("Session lookup fails for Peer StaId:"); |
| 1063 | lim_print_mac_addr(pMac, sa, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1064 | return NULL; |
| 1065 | } |
| 1066 | |
| 1067 | /** |
| 1068 | * pe_find_session_by_sme_session_id() - looks up the PE session for given sme |
| 1069 | * session id |
| 1070 | * @mac_ctx: pointer to global adapter context |
| 1071 | * @sme_session_id: sme session id |
| 1072 | * |
| 1073 | * looks up the PE session for given sme session id |
| 1074 | * |
| 1075 | * Return: pe session entry for given sme session if found else NULL |
| 1076 | */ |
| 1077 | tpPESession pe_find_session_by_sme_session_id(tpAniSirGlobal mac_ctx, |
| 1078 | uint8_t sme_session_id) |
| 1079 | { |
| 1080 | uint8_t i; |
Srinivas Girigowda | 2b5d47c | 2017-03-29 00:28:46 -0700 | [diff] [blame] | 1081 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1082 | for (i = 0; i < mac_ctx->lim.maxBssId; i++) { |
| 1083 | if ((mac_ctx->lim.gpSession[i].valid) && |
| 1084 | (mac_ctx->lim.gpSession[i].smeSessionId == |
| 1085 | sme_session_id)) { |
| 1086 | return &mac_ctx->lim.gpSession[i]; |
| 1087 | } |
| 1088 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1089 | return NULL; |
| 1090 | } |
| 1091 | |
| 1092 | /** |
| 1093 | * pe_get_active_session_count() - function to return active pe session count |
| 1094 | * |
| 1095 | * @mac_ctx: pointer to global mac structure |
| 1096 | * |
| 1097 | * returns number of active pe session count |
| 1098 | * |
| 1099 | * Return: 0 if there are no active sessions else return number of active |
| 1100 | * sessions |
| 1101 | */ |
| 1102 | uint8_t pe_get_active_session_count(tpAniSirGlobal mac_ctx) |
| 1103 | { |
| 1104 | uint8_t i, active_session_count = 0; |
| 1105 | |
| 1106 | for (i = 0; i < mac_ctx->lim.maxBssId; i++) |
| 1107 | if (mac_ctx->lim.gpSession[i].valid) |
| 1108 | active_session_count++; |
| 1109 | |
| 1110 | return active_session_count; |
| 1111 | } |