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