Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Himanshu Agarwal | 8612c3b | 2017-12-14 14:37:08 +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 | |
| 19 | /* |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 20 | * This file lim_api.cc contains the functions that are |
| 21 | * exported by LIM to other modules. |
| 22 | * |
| 23 | * Author: Chandra Modumudi |
| 24 | * Date: 02/11/02 |
| 25 | * History:- |
| 26 | * Date Modified by Modification Information |
| 27 | * -------------------------------------------------------------------- |
| 28 | * |
| 29 | */ |
| 30 | #include "cds_api.h" |
| 31 | #include "wni_cfg.h" |
| 32 | #include "wni_api.h" |
| 33 | #include "sir_common.h" |
| 34 | #include "sir_debug.h" |
| 35 | #include "cfg_api.h" |
| 36 | |
| 37 | #include "sch_api.h" |
| 38 | #include "utils_api.h" |
| 39 | #include "lim_api.h" |
| 40 | #include "lim_global.h" |
| 41 | #include "lim_types.h" |
| 42 | #include "lim_utils.h" |
| 43 | #include "lim_assoc_utils.h" |
| 44 | #include "lim_prop_exts_utils.h" |
| 45 | #include "lim_ser_des_utils.h" |
| 46 | #include "lim_ibss_peer_mgmt.h" |
| 47 | #include "lim_admit_control.h" |
| 48 | #include "lim_send_sme_rsp_messages.h" |
Krunal Soni | 05c914f | 2018-08-06 12:23:58 -0700 | [diff] [blame] | 49 | #include "lim_security_utils.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 50 | #include "wmm_apsd.h" |
| 51 | #include "lim_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 52 | #include "lim_ft_defs.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 53 | #include "lim_session.h" |
| 54 | #include "wma_types.h" |
| 55 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 56 | #include "rrm_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 57 | |
| 58 | #include <lim_ft.h> |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 59 | #include "qdf_types.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 60 | #include "cds_packet.h" |
| 61 | #include "cds_utils.h" |
| 62 | #include "sys_startup.h" |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 63 | #include "cds_api.h" |
Tushnim Bhattacharyya | 66348bd | 2017-03-09 15:02:10 -0800 | [diff] [blame] | 64 | #include "wlan_policy_mgr_api.h" |
Naveen Rawat | 0fc3f69 | 2016-06-22 14:30:54 -0700 | [diff] [blame] | 65 | #include "nan_datapath.h" |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 66 | #include "wma.h" |
| 67 | #include "wlan_mgmt_txrx_utils_api.h" |
| 68 | #include "wlan_objmgr_psoc_obj.h" |
Naveen Rawat | 37f62c8 | 2017-03-26 22:24:43 -0700 | [diff] [blame] | 69 | #include "os_if_nan.h" |
Paul Zhang | 2f1077c | 2017-11-30 12:06:09 +0800 | [diff] [blame] | 70 | #include <wlan_scan_ucfg_api.h> |
Liangwei Dong | c26be33 | 2018-01-19 00:31:31 -0500 | [diff] [blame] | 71 | #include <wlan_p2p_ucfg_api.h> |
Vignesh Viswanathan | b3dbbc8 | 2018-04-06 00:06:27 +0530 | [diff] [blame] | 72 | #include "wlan_utility.h" |
Wu Gao | 3365e78 | 2018-07-27 18:19:35 +0800 | [diff] [blame] | 73 | #include <wlan_tdls_cfg_api.h> |
Vignesh Viswanathan | 21c58cb | 2018-05-24 15:53:58 +0530 | [diff] [blame^] | 74 | #include "cfg_ucfg_api.h" |
| 75 | #include "wlan_mlme_public_struct.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 76 | |
| 77 | static void __lim_init_scan_vars(tpAniSirGlobal pMac) |
| 78 | { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 79 | qdf_mem_set(&pMac->lim.dfschannelList, sizeof(tSirDFSChannelList), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | static void __lim_init_bss_vars(tpAniSirGlobal pMac) |
| 83 | { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 84 | qdf_mem_set((void *)pMac->lim.gpSession, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 85 | sizeof(*pMac->lim.gpSession) * pMac->lim.maxBssId, 0); |
| 86 | |
| 87 | /* This is for testing purposes only, be default should always be off */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 88 | pMac->lim.gpLimMlmSetKeysReq = NULL; |
| 89 | } |
| 90 | |
| 91 | static void __lim_init_stats_vars(tpAniSirGlobal pMac) |
| 92 | { |
| 93 | pMac->lim.gLimNumBeaconsRcvd = 0; |
| 94 | pMac->lim.gLimNumBeaconsIgnored = 0; |
| 95 | |
| 96 | pMac->lim.gLimNumDeferredMsgs = 0; |
| 97 | |
| 98 | /* / Variable to keep track of number of currently associated STAs */ |
| 99 | pMac->lim.gLimNumOfAniSTAs = 0; /* count of ANI peers */ |
| 100 | |
| 101 | /* Heart-Beat interval value */ |
| 102 | pMac->lim.gLimHeartBeatCount = 0; |
| 103 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 104 | qdf_mem_zero(pMac->lim.gLimHeartBeatApMac[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 105 | sizeof(tSirMacAddr)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 106 | qdf_mem_zero(pMac->lim.gLimHeartBeatApMac[1], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 107 | sizeof(tSirMacAddr)); |
| 108 | pMac->lim.gLimHeartBeatApMacIndex = 0; |
| 109 | |
| 110 | /* Statistics to keep track of no. beacons rcvd in heart beat interval */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 111 | qdf_mem_set(pMac->lim.gLimHeartBeatBeaconStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 112 | sizeof(pMac->lim.gLimHeartBeatBeaconStats), 0); |
| 113 | |
| 114 | #ifdef WLAN_DEBUG |
| 115 | /* Debug counters */ |
| 116 | pMac->lim.numTot = 0; |
| 117 | pMac->lim.numBbt = 0; |
| 118 | pMac->lim.numProtErr = 0; |
| 119 | pMac->lim.numLearn = 0; |
| 120 | pMac->lim.numLearnIgnore = 0; |
| 121 | pMac->lim.numSme = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 122 | qdf_mem_set(pMac->lim.numMAC, sizeof(pMac->lim.numMAC), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 123 | pMac->lim.gLimNumAssocReqDropInvldState = 0; |
| 124 | pMac->lim.gLimNumAssocReqDropACRejectTS = 0; |
| 125 | pMac->lim.gLimNumAssocReqDropACRejectSta = 0; |
| 126 | pMac->lim.gLimNumReassocReqDropInvldState = 0; |
| 127 | pMac->lim.gLimNumHashMissIgnored = 0; |
| 128 | pMac->lim.gLimUnexpBcnCnt = 0; |
| 129 | pMac->lim.gLimBcnSSIDMismatchCnt = 0; |
| 130 | pMac->lim.gLimNumLinkEsts = 0; |
| 131 | pMac->lim.gLimNumRxCleanup = 0; |
| 132 | pMac->lim.gLim11bStaAssocRejectCount = 0; |
| 133 | #endif |
| 134 | } |
| 135 | |
| 136 | static void __lim_init_states(tpAniSirGlobal pMac) |
| 137 | { |
| 138 | /* Counts Heartbeat failures */ |
| 139 | pMac->lim.gLimHBfailureCntInLinkEstState = 0; |
| 140 | pMac->lim.gLimProbeFailureAfterHBfailedCnt = 0; |
| 141 | pMac->lim.gLimHBfailureCntInOtherStates = 0; |
| 142 | pMac->lim.gLimRspReqd = 0; |
| 143 | pMac->lim.gLimPrevSmeState = eLIM_SME_OFFLINE_STATE; |
| 144 | |
| 145 | /* / MLM State visible across all Sirius modules */ |
| 146 | MTRACE(mac_trace |
| 147 | (pMac, TRACE_CODE_MLM_STATE, NO_SESSION, eLIM_MLM_IDLE_STATE)); |
| 148 | pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE; |
| 149 | |
| 150 | /* / Previous MLM State */ |
| 151 | pMac->lim.gLimPrevMlmState = eLIM_MLM_OFFLINE_STATE; |
| 152 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 153 | /** |
| 154 | * Initialize state to eLIM_SME_OFFLINE_STATE |
| 155 | */ |
| 156 | pMac->lim.gLimSmeState = eLIM_SME_OFFLINE_STATE; |
| 157 | |
| 158 | /** |
| 159 | * By default assume 'unknown' role. This will be updated |
| 160 | * when SME_START_BSS_REQ is received. |
| 161 | */ |
| 162 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 163 | qdf_mem_set(&pMac->lim.gLimNoShortParams, sizeof(tLimNoShortParams), 0); |
| 164 | qdf_mem_set(&pMac->lim.gLimNoShortSlotParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 165 | sizeof(tLimNoShortSlotParams), 0); |
| 166 | |
| 167 | pMac->lim.gLimPhyMode = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 168 | pMac->lim.gLimProbeRespDisableFlag = 0; /* control over probe resp */ |
| 169 | } |
| 170 | |
| 171 | static void __lim_init_vars(tpAniSirGlobal pMac) |
| 172 | { |
| 173 | /* Place holder for Measurement Req/Rsp/Ind related info */ |
| 174 | |
| 175 | |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 176 | /* Deferred Queue Parameters */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 177 | qdf_mem_set(&pMac->lim.gLimDeferredMsgQ, sizeof(tSirAddtsReq), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 178 | |
| 179 | /* addts request if any - only one can be outstanding at any time */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 180 | qdf_mem_set(&pMac->lim.gLimAddtsReq, sizeof(tSirAddtsReq), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 181 | pMac->lim.gLimAddtsSent = 0; |
| 182 | pMac->lim.gLimAddtsRspTimerCount = 0; |
| 183 | |
| 184 | /* protection related config cache */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 185 | qdf_mem_set(&pMac->lim.cfgProtection, sizeof(tCfgProtection), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 186 | pMac->lim.gLimProtectionControl = 0; |
| 187 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 188 | |
| 189 | /* WMM Related Flag */ |
| 190 | pMac->lim.gUapsdEnable = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 191 | |
| 192 | /* QoS-AC Downgrade: Initially, no AC is admitted */ |
| 193 | pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] = 0; |
| 194 | pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] = 0; |
| 195 | |
| 196 | /* dialogue token List head/tail for Action frames request sent. */ |
| 197 | pMac->lim.pDialogueTokenHead = NULL; |
| 198 | pMac->lim.pDialogueTokenTail = NULL; |
| 199 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 200 | qdf_mem_set(&pMac->lim.tspecInfo, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 201 | sizeof(tLimTspecInfo) * LIM_NUM_TSPEC_MAX, 0); |
| 202 | |
| 203 | /* admission control policy information */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 204 | qdf_mem_set(&pMac->lim.admitPolicyInfo, sizeof(tLimAdmitPolicyInfo), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 205 | } |
| 206 | |
| 207 | static void __lim_init_assoc_vars(tpAniSirGlobal pMac) |
| 208 | { |
Jiachao Wu | e6485d4 | 2017-12-12 10:54:54 +0800 | [diff] [blame] | 209 | pMac->lim.gLimAssocStaLimit = 0; |
| 210 | pMac->lim.gLimIbssStaLimit = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 211 | /* Place holder for current authentication request */ |
| 212 | /* being handled */ |
| 213 | pMac->lim.gpLimMlmAuthReq = NULL; |
| 214 | |
| 215 | /* / MAC level Pre-authentication related globals */ |
| 216 | pMac->lim.gLimPreAuthChannelNumber = 0; |
| 217 | pMac->lim.gLimPreAuthType = eSIR_OPEN_SYSTEM; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 218 | qdf_mem_set(&pMac->lim.gLimPreAuthPeerAddr, sizeof(tSirMacAddr), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 219 | pMac->lim.gLimNumPreAuthContexts = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 220 | qdf_mem_set(&pMac->lim.gLimPreAuthTimerTable, sizeof(tLimPreAuthTable), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 221 | 0); |
| 222 | |
| 223 | /* Placed holder to deauth reason */ |
| 224 | pMac->lim.gLimDeauthReasonCode = 0; |
| 225 | |
| 226 | /* Place holder for Pre-authentication node list */ |
| 227 | pMac->lim.pLimPreAuthList = NULL; |
| 228 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 229 | /* One cache for each overlap and associated case. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 230 | qdf_mem_set(pMac->lim.protStaOverlapCache, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 231 | sizeof(tCacheParams) * LIM_PROT_STA_OVERLAP_CACHE_SIZE, 0); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 232 | qdf_mem_set(pMac->lim.protStaCache, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 233 | sizeof(tCacheParams) * LIM_PROT_STA_CACHE_SIZE, 0); |
| 234 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 235 | pMac->lim.pSessionEntry = NULL; |
| 236 | pMac->lim.reAssocRetryAttempt = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 237 | |
| 238 | } |
| 239 | |
| 240 | static void __lim_init_ht_vars(tpAniSirGlobal pMac) |
| 241 | { |
| 242 | pMac->lim.htCapabilityPresentInBeacon = 0; |
| 243 | pMac->lim.gHTGreenfield = 0; |
| 244 | pMac->lim.gHTShortGI40Mhz = 0; |
| 245 | pMac->lim.gHTShortGI20Mhz = 0; |
| 246 | pMac->lim.gHTMaxAmsduLength = 0; |
| 247 | pMac->lim.gHTDsssCckRate40MHzSupport = 0; |
| 248 | pMac->lim.gHTPSMPSupport = 0; |
| 249 | pMac->lim.gHTLsigTXOPProtection = 0; |
| 250 | pMac->lim.gHTMIMOPSState = eSIR_HT_MIMO_PS_STATIC; |
| 251 | pMac->lim.gHTAMpduDensity = 0; |
| 252 | |
| 253 | pMac->lim.gMaxAmsduSizeEnabled = false; |
| 254 | pMac->lim.gHTMaxRxAMpduFactor = 0; |
| 255 | pMac->lim.gHTServiceIntervalGranularity = 0; |
| 256 | pMac->lim.gHTControlledAccessOnly = 0; |
| 257 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE; |
| 258 | pMac->lim.gHTPCOActive = 0; |
| 259 | |
| 260 | pMac->lim.gHTPCOPhase = 0; |
| 261 | pMac->lim.gHTSecondaryBeacon = 0; |
| 262 | pMac->lim.gHTDualCTSProtection = 0; |
| 263 | pMac->lim.gHTSTBCBasicMCS = 0; |
| 264 | } |
| 265 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 266 | static QDF_STATUS __lim_init_config(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 267 | { |
| 268 | uint32_t val1, val2, val3; |
| 269 | uint16_t val16; |
| 270 | uint8_t val8; |
Wu Gao | 3365e78 | 2018-07-27 18:19:35 +0800 | [diff] [blame] | 271 | bool valb; |
Vignesh Viswanathan | 21c58cb | 2018-05-24 15:53:58 +0530 | [diff] [blame^] | 272 | struct mlme_ht_capabilities_info *ht_cap_info; |
Wu Gao | 3365e78 | 2018-07-27 18:19:35 +0800 | [diff] [blame] | 273 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 274 | tSirMacHTInfoField1 *pHTInfoField1; |
| 275 | tSirMacHTParametersInfo *pAmpduParamInfo; |
| 276 | |
| 277 | /* Read all the CFGs here that were updated before pe_start is called */ |
| 278 | /* All these CFG READS/WRITES are only allowed in init, at start when there is no session |
| 279 | * and they will be used throughout when there is no session |
| 280 | */ |
| 281 | |
Jiachao Wu | e6485d4 | 2017-12-12 10:54:54 +0800 | [diff] [blame] | 282 | if (wlan_cfg_get_int(pMac, WNI_CFG_ASSOC_STA_LIMIT, &val1) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 283 | != QDF_STATUS_SUCCESS){ |
Jiachao Wu | e6485d4 | 2017-12-12 10:54:54 +0800 | [diff] [blame] | 284 | pe_err("cfg get assoc sta limit failed"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 285 | return QDF_STATUS_E_FAILURE; |
Jiachao Wu | e6485d4 | 2017-12-12 10:54:54 +0800 | [diff] [blame] | 286 | } |
| 287 | |
| 288 | pMac->lim.gLimAssocStaLimit = val1; |
| 289 | pMac->lim.gLimIbssStaLimit = val1; |
Vignesh Viswanathan | 21c58cb | 2018-05-24 15:53:58 +0530 | [diff] [blame^] | 290 | ht_cap_info = &pMac->mlme_cfg->ht_caps.ht_cap_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 291 | |
| 292 | if (wlan_cfg_get_int(pMac, WNI_CFG_CHANNEL_BONDING_MODE, &val2) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 293 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 294 | pe_err("could not retrieve Channel Bonding CFG"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 295 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 296 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 297 | |
| 298 | /* channel bonding mode could be set to anything from 0 to 4(Titan had these */ |
| 299 | /* modes But for Taurus we have only two modes: enable(>0) or disable(=0) */ |
Vignesh Viswanathan | 21c58cb | 2018-05-24 15:53:58 +0530 | [diff] [blame^] | 300 | ht_cap_info->supportedChannelWidthSet = val2 ? |
| 301 | WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : |
| 302 | WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 303 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 304 | if (wlan_cfg_get_int(pMac, WNI_CFG_HT_INFO_FIELD1, &val1) != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 305 | pe_err("could not retrieve HT INFO Field1 CFG"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 306 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 307 | } |
| 308 | |
| 309 | val8 = (uint8_t) val1; |
| 310 | pHTInfoField1 = (tSirMacHTInfoField1 *) &val8; |
| 311 | pHTInfoField1->recommendedTxWidthSet = |
Vignesh Viswanathan | 21c58cb | 2018-05-24 15:53:58 +0530 | [diff] [blame^] | 312 | ht_cap_info->supportedChannelWidthSet; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 313 | if (cfg_set_int(pMac, WNI_CFG_HT_INFO_FIELD1, *(uint8_t *) pHTInfoField1) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 314 | != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 315 | pe_err("could not update HT Info Field"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 316 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 317 | } |
| 318 | |
| 319 | /* WNI_CFG_HEART_BEAT_THRESHOLD */ |
| 320 | |
| 321 | if (wlan_cfg_get_int(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 322 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 323 | pe_err("could not retrieve WNI_CFG_HEART_BEAT_THRESHOLD CFG"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 324 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 325 | } |
| 326 | if (!val1) { |
| 327 | pMac->sys.gSysEnableLinkMonitorMode = 0; |
| 328 | } else { |
| 329 | /* No need to activate the timer during init time. */ |
| 330 | pMac->sys.gSysEnableLinkMonitorMode = 1; |
| 331 | } |
| 332 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 333 | /* WNI_CFG_MAX_RX_AMPDU_FACTOR */ |
| 334 | |
| 335 | if (wlan_cfg_get_int(pMac, WNI_CFG_HT_AMPDU_PARAMS, &val1) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 336 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 337 | pe_err("could not retrieve HT AMPDU Param"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 338 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 339 | } |
| 340 | if (wlan_cfg_get_int(pMac, WNI_CFG_MAX_RX_AMPDU_FACTOR, &val2) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 341 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 342 | pe_err("could not retrieve AMPDU Factor CFG"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 343 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 344 | } |
Krishna Kumaar Natarajan | 22b59a7 | 2015-11-23 18:54:58 -0800 | [diff] [blame] | 345 | if (wlan_cfg_get_int(pMac, WNI_CFG_MPDU_DENSITY, &val3) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 346 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 347 | pe_err("could not retrieve MPDU Density CFG"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 348 | return QDF_STATUS_E_FAILURE; |
Krishna Kumaar Natarajan | 22b59a7 | 2015-11-23 18:54:58 -0800 | [diff] [blame] | 349 | } |
| 350 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 351 | val16 = (uint16_t) val1; |
| 352 | pAmpduParamInfo = (tSirMacHTParametersInfo *) &val16; |
| 353 | pAmpduParamInfo->maxRxAMPDUFactor = (uint8_t) val2; |
Krishna Kumaar Natarajan | 22b59a7 | 2015-11-23 18:54:58 -0800 | [diff] [blame] | 354 | pAmpduParamInfo->mpduDensity = (uint8_t)val3; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 355 | if (cfg_set_int |
| 356 | (pMac, WNI_CFG_HT_AMPDU_PARAMS, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 357 | *(uint8_t *) pAmpduParamInfo) != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 358 | pe_err("cfg get short preamble failed"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 359 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 360 | } |
| 361 | |
| 362 | /* WNI_CFG_SHORT_PREAMBLE - this one is not updated in |
| 363 | lim_handle_cf_gparam_update do we want to update this? */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 364 | if (wlan_cfg_get_int(pMac, WNI_CFG_SHORT_PREAMBLE, &val1) != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 365 | pe_err("cfg get short preamble failed"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 366 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 367 | } |
| 368 | |
| 369 | /* WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA - not needed */ |
| 370 | |
| 371 | /* This was initially done after resume notification from HAL. Now, DAL is |
| 372 | started before PE so this can be done here */ |
| 373 | handle_ht_capabilityand_ht_info(pMac, NULL); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 374 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 375 | wlan_cfg_get_int(pMac, WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP, |
| 376 | (uint32_t *) &pMac->lim.disableLDPCWithTxbfAP)) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 377 | pe_err("cfg get disableLDPCWithTxbfAP failed"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 378 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 379 | } |
| 380 | #ifdef FEATURE_WLAN_TDLS |
Wu Gao | 3365e78 | 2018-07-27 18:19:35 +0800 | [diff] [blame] | 381 | status = cfg_tdls_get_buffer_sta_enable(pMac->psoc, &valb); |
| 382 | if (QDF_STATUS_SUCCESS != status) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 383 | pe_err("cfg get LimTDLSBufStaEnabled failed"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 384 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 385 | } |
Wu Gao | 3365e78 | 2018-07-27 18:19:35 +0800 | [diff] [blame] | 386 | pMac->lim.gLimTDLSBufStaEnabled = (uint8_t)valb; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 387 | |
Wu Gao | 3365e78 | 2018-07-27 18:19:35 +0800 | [diff] [blame] | 388 | status = cfg_tdls_get_uapsd_mask(pMac->psoc, &val1); |
| 389 | if (QDF_STATUS_SUCCESS != status) { |
| 390 | pe_err("cfg get LimTDLSUapsdMask failed"); |
| 391 | return QDF_STATUS_E_FAILURE; |
| 392 | } |
| 393 | pMac->lim.gLimTDLSUapsdMask = (uint8_t)val1; |
| 394 | |
| 395 | status = cfg_tdls_get_off_channel_enable(pMac->psoc, &valb); |
| 396 | if (QDF_STATUS_SUCCESS != status) { |
| 397 | pe_err("cfg get LimTDLSUapsdMask failed"); |
| 398 | return QDF_STATUS_E_FAILURE; |
| 399 | } |
| 400 | pMac->lim.gLimTDLSOffChannelEnabled = (uint8_t)valb; |
| 401 | |
| 402 | status = cfg_tdls_get_wmm_mode_enable(pMac->psoc, &valb); |
| 403 | if (QDF_STATUS_SUCCESS != status) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 404 | pe_err("cfg get LimTDLSWmmMode failed"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 405 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 406 | } |
Wu Gao | 3365e78 | 2018-07-27 18:19:35 +0800 | [diff] [blame] | 407 | pMac->lim.gLimTDLSWmmMode = (uint8_t)valb; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 408 | #endif |
Arif Hussain | ee10f90 | 2017-12-27 16:30:17 -0800 | [diff] [blame] | 409 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 410 | if (QDF_STATUS_SUCCESS != wlan_cfg_get_int(pMac, |
Arif Hussain | ee10f90 | 2017-12-27 16:30:17 -0800 | [diff] [blame] | 411 | WNI_CFG_OBSS_DETECTION_OFFLOAD, |
| 412 | (uint32_t *)&pMac->lim. |
Arif Hussain | 1513cb2 | 2018-01-05 19:56:31 -0800 | [diff] [blame] | 413 | global_obss_offload_enabled)) { |
Arif Hussain | ee10f90 | 2017-12-27 16:30:17 -0800 | [diff] [blame] | 414 | pe_err("cfg get obss_detection_offloaded failed"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 415 | return QDF_STATUS_E_FAILURE; |
Arif Hussain | ee10f90 | 2017-12-27 16:30:17 -0800 | [diff] [blame] | 416 | } |
| 417 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 418 | if (QDF_STATUS_SUCCESS != |
Arif Hussain | 05fb487 | 2018-01-03 16:02:55 -0800 | [diff] [blame] | 419 | wlan_cfg_get_int(pMac, WNI_CFG_OBSS_COLOR_COLLISION_OFFLOAD, |
| 420 | (uint32_t *) &pMac->lim. |
| 421 | global_obss_color_collision_det_offload)) { |
| 422 | pe_err("cfg get obss_color_collision_offload failed"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 423 | return QDF_STATUS_E_FAILURE; |
Arif Hussain | 05fb487 | 2018-01-03 16:02:55 -0800 | [diff] [blame] | 424 | } |
| 425 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 426 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 427 | } |
| 428 | |
| 429 | /* |
| 430 | lim_start |
| 431 | This function is to replace the __lim_process_sme_start_req since there is no |
| 432 | eWNI_SME_START_REQ post to PE. |
| 433 | */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 434 | QDF_STATUS lim_start(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 435 | { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 436 | QDF_STATUS retCode = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 437 | |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 438 | pe_debug("enter"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 439 | |
| 440 | if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) { |
| 441 | pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE; |
| 442 | |
| 443 | MTRACE(mac_trace |
| 444 | (pMac, TRACE_CODE_SME_STATE, NO_SESSION, |
| 445 | pMac->lim.gLimSmeState)); |
| 446 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 447 | /* Initialize MLM state machine */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 448 | if (QDF_STATUS_SUCCESS != lim_init_mlm(pMac)) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 449 | pe_err("Init MLM failed"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 450 | return QDF_STATUS_E_FAILURE; |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 451 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 452 | } else { |
| 453 | /** |
| 454 | * Should not have received eWNI_SME_START_REQ in states |
| 455 | * other than OFFLINE. Return response to host and |
| 456 | * log error |
| 457 | */ |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 458 | pe_warn("Invalid SME state: %X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 459 | pMac->lim.gLimSmeState); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 460 | retCode = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 461 | } |
| 462 | |
Paul Zhang | 2f1077c | 2017-11-30 12:06:09 +0800 | [diff] [blame] | 463 | pMac->lim.req_id = |
| 464 | ucfg_scan_register_requester(pMac->psoc, |
| 465 | "LIM", |
| 466 | lim_process_rx_scan_handler, |
| 467 | pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 468 | return retCode; |
| 469 | } |
| 470 | |
| 471 | /** |
| 472 | * lim_initialize() |
| 473 | * |
| 474 | ***FUNCTION: |
| 475 | * This function is called from LIM thread entry function. |
| 476 | * LIM related global data structures are initialized in this function. |
| 477 | * |
| 478 | ***LOGIC: |
| 479 | * NA |
| 480 | * |
| 481 | ***ASSUMPTIONS: |
| 482 | * NA |
| 483 | * |
| 484 | ***NOTE: |
| 485 | * NA |
| 486 | * |
| 487 | * @param pMac - Pointer to global MAC structure |
| 488 | * @return None |
| 489 | */ |
| 490 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 491 | QDF_STATUS lim_initialize(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 492 | { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 493 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 494 | |
Jiachao Wu | e6485d4 | 2017-12-12 10:54:54 +0800 | [diff] [blame] | 495 | pMac->lim.mgmtFrameSessionId = NO_SESSION; |
| 496 | pMac->lim.tdls_frm_session_id = NO_SESSION; |
| 497 | pMac->lim.deferredMsgCnt = 0; |
| 498 | pMac->lim.retry_packet_cnt = 0; |
| 499 | pMac->lim.ibss_retry_cnt = 0; |
| 500 | pMac->lim.deauthMsgCnt = 0; |
| 501 | pMac->lim.disassocMsgCnt = 0; |
| 502 | |
| 503 | if (QDF_IS_STATUS_ERROR(qdf_mutex_create( |
| 504 | &pMac->lim.lkPeGlobalLock))) { |
| 505 | pe_err("lim lock init failed!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 506 | return QDF_STATUS_E_FAILURE; |
Jiachao Wu | e6485d4 | 2017-12-12 10:54:54 +0800 | [diff] [blame] | 507 | } |
| 508 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 509 | __lim_init_assoc_vars(pMac); |
| 510 | __lim_init_vars(pMac); |
| 511 | __lim_init_states(pMac); |
| 512 | __lim_init_stats_vars(pMac); |
| 513 | __lim_init_bss_vars(pMac); |
| 514 | __lim_init_scan_vars(pMac); |
| 515 | __lim_init_ht_vars(pMac); |
| 516 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 517 | /* Initializations for maintaining peers in IBSS */ |
| 518 | lim_ibss_init(pMac); |
| 519 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 520 | rrm_initialize(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 521 | |
Jiachao Wu | e6485d4 | 2017-12-12 10:54:54 +0800 | [diff] [blame] | 522 | if (QDF_IS_STATUS_ERROR(qdf_mutex_create( |
| 523 | &pMac->lim.lim_frame_register_lock))) { |
| 524 | pe_err("lim lock init failed!"); |
| 525 | qdf_mutex_destroy(&pMac->lim.lkPeGlobalLock); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 526 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 527 | } |
Jiachao Wu | e6485d4 | 2017-12-12 10:54:54 +0800 | [diff] [blame] | 528 | |
| 529 | qdf_list_create(&pMac->lim.gLimMgmtFrameRegistratinQueue, 0); |
| 530 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 531 | /* initialize the TSPEC admission control table. */ |
| 532 | /* Note that this was initially done after resume notification from HAL. */ |
| 533 | /* Now, DAL is started before PE so this can be done here */ |
| 534 | lim_admit_control_init(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 535 | return status; |
| 536 | |
| 537 | } /*** end lim_initialize() ***/ |
| 538 | |
| 539 | /** |
| 540 | * lim_cleanup() |
| 541 | * |
| 542 | ***FUNCTION: |
| 543 | * This function is called upon reset or persona change |
| 544 | * to cleanup LIM state |
| 545 | * |
| 546 | ***LOGIC: |
| 547 | * NA |
| 548 | * |
| 549 | ***ASSUMPTIONS: |
| 550 | * NA |
| 551 | * |
| 552 | ***NOTE: |
| 553 | * NA |
| 554 | * |
| 555 | * @param pMac - Pointer to Global MAC structure |
| 556 | * @return None |
| 557 | */ |
| 558 | |
| 559 | void lim_cleanup(tpAniSirGlobal pMac) |
| 560 | { |
Naveen Rawat | 2546093 | 2016-02-05 16:56:08 -0800 | [diff] [blame] | 561 | uint8_t i; |
Jiachao Wu | e6485d4 | 2017-12-12 10:54:54 +0800 | [diff] [blame] | 562 | qdf_list_node_t *lst_node; |
| 563 | |
| 564 | /* |
| 565 | * Before destroying the list making sure all the nodes have been |
| 566 | * deleted |
| 567 | */ |
| 568 | while (qdf_list_remove_front( |
| 569 | &pMac->lim.gLimMgmtFrameRegistratinQueue, |
| 570 | &lst_node) == QDF_STATUS_SUCCESS) { |
| 571 | qdf_mem_free(lst_node); |
| 572 | } |
| 573 | qdf_list_destroy(&pMac->lim.gLimMgmtFrameRegistratinQueue); |
| 574 | qdf_mutex_destroy(&pMac->lim.lim_frame_register_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 575 | |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 576 | pe_deregister_mgmt_rx_frm_callback(pMac); |
| 577 | |
Naveen Rawat | 4b1aab9 | 2017-05-23 11:37:09 -0700 | [diff] [blame] | 578 | qdf_mem_free(pMac->lim.gpLimRemainOnChanReq); |
| 579 | pMac->lim.gpLimRemainOnChanReq = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 580 | |
| 581 | /* free up preAuth table */ |
| 582 | if (pMac->lim.gLimPreAuthTimerTable.pTable != NULL) { |
Naveen Rawat | 2546093 | 2016-02-05 16:56:08 -0800 | [diff] [blame] | 583 | for (i = 0; i < pMac->lim.gLimPreAuthTimerTable.numEntry; i++) |
| 584 | qdf_mem_free(pMac->lim.gLimPreAuthTimerTable.pTable[i]); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 585 | qdf_mem_free(pMac->lim.gLimPreAuthTimerTable.pTable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 586 | pMac->lim.gLimPreAuthTimerTable.pTable = NULL; |
| 587 | pMac->lim.gLimPreAuthTimerTable.numEntry = 0; |
| 588 | } |
| 589 | |
| 590 | if (NULL != pMac->lim.pDialogueTokenHead) { |
| 591 | lim_delete_dialogue_token_list(pMac); |
| 592 | } |
| 593 | |
| 594 | if (NULL != pMac->lim.pDialogueTokenTail) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 595 | qdf_mem_free(pMac->lim.pDialogueTokenTail); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 596 | pMac->lim.pDialogueTokenTail = NULL; |
| 597 | } |
| 598 | |
| 599 | if (pMac->lim.gpLimMlmSetKeysReq != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 600 | qdf_mem_free(pMac->lim.gpLimMlmSetKeysReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 601 | pMac->lim.gpLimMlmSetKeysReq = NULL; |
| 602 | } |
| 603 | |
| 604 | if (pMac->lim.gpLimMlmAuthReq != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 605 | qdf_mem_free(pMac->lim.gpLimMlmAuthReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 606 | pMac->lim.gpLimMlmAuthReq = NULL; |
| 607 | } |
| 608 | |
Vignesh Viswanathan | a842b94 | 2018-02-16 16:02:50 +0530 | [diff] [blame] | 609 | if (pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq) { |
| 610 | qdf_mem_free(pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq); |
| 611 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 612 | } |
| 613 | |
| 614 | if (pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq) { |
| 615 | qdf_mem_free(pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq); |
| 616 | pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
| 617 | } |
| 618 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 619 | /* Now, finally reset the deferred message queue pointers */ |
| 620 | lim_reset_deferred_msg_q(pMac); |
| 621 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 622 | rrm_cleanup(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 623 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 624 | lim_ft_cleanup_all_ft_sessions(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 625 | |
Paul Zhang | 2f1077c | 2017-11-30 12:06:09 +0800 | [diff] [blame] | 626 | ucfg_scan_unregister_requester(pMac->psoc, pMac->lim.req_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 627 | } /*** end lim_cleanup() ***/ |
| 628 | |
Wen Gong | 3f00338 | 2018-05-14 14:26:37 +0800 | [diff] [blame] | 629 | #ifdef WLAN_FEATURE_MEMDUMP_ENABLE |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 630 | /** |
| 631 | * lim_state_info_dump() - print state information of lim layer |
| 632 | * @buf: buffer pointer |
| 633 | * @size: size of buffer to be filled |
| 634 | * |
| 635 | * This function is used to print state information of lim layer |
| 636 | * |
| 637 | * Return: None |
| 638 | */ |
| 639 | static void lim_state_info_dump(char **buf_ptr, uint16_t *size) |
| 640 | { |
| 641 | tHalHandle hal; |
| 642 | tpAniSirGlobal mac; |
| 643 | uint16_t len = 0; |
| 644 | char *buf = *buf_ptr; |
| 645 | |
| 646 | hal = cds_get_context(QDF_MODULE_ID_PE); |
| 647 | if (hal == NULL) { |
| 648 | QDF_ASSERT(0); |
| 649 | return; |
| 650 | } |
| 651 | |
| 652 | mac = PMAC_STRUCT(hal); |
| 653 | |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 654 | pe_debug("size of buffer: %d", *size); |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 655 | |
| 656 | len += qdf_scnprintf(buf + len, *size - len, |
| 657 | "\n SmeState: %d", mac->lim.gLimSmeState); |
| 658 | len += qdf_scnprintf(buf + len, *size - len, |
| 659 | "\n PrevSmeState: %d", mac->lim.gLimPrevSmeState); |
| 660 | len += qdf_scnprintf(buf + len, *size - len, |
| 661 | "\n MlmState: %d", mac->lim.gLimMlmState); |
| 662 | len += qdf_scnprintf(buf + len, *size - len, |
| 663 | "\n PrevMlmState: %d", mac->lim.gLimPrevMlmState); |
| 664 | len += qdf_scnprintf(buf + len, *size - len, |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 665 | "\n ProcessDefdMsgs: %d", mac->lim.gLimProcessDefdMsgs); |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 666 | |
| 667 | *size -= len; |
| 668 | *buf_ptr += len; |
| 669 | } |
| 670 | |
| 671 | /** |
| 672 | * lim_register_debug_callback() - registration function for lim layer |
| 673 | * to print lim state information |
| 674 | * |
| 675 | * Return: None |
| 676 | */ |
| 677 | static void lim_register_debug_callback(void) |
| 678 | { |
| 679 | qdf_register_debug_callback(QDF_MODULE_ID_PE, &lim_state_info_dump); |
| 680 | } |
Wen Gong | 3f00338 | 2018-05-14 14:26:37 +0800 | [diff] [blame] | 681 | #else /* WLAN_FEATURE_MEMDUMP_ENABLE */ |
Wen Gong | aa6d55d | 2018-04-26 16:33:21 +0800 | [diff] [blame] | 682 | static void lim_register_debug_callback(void) |
| 683 | { |
| 684 | } |
Wen Gong | 3f00338 | 2018-05-14 14:26:37 +0800 | [diff] [blame] | 685 | #endif /* WLAN_FEATURE_MEMDUMP_ENABLE */ |
Naveen Rawat | 37f62c8 | 2017-03-26 22:24:43 -0700 | [diff] [blame] | 686 | static void lim_nan_register_callbacks(tpAniSirGlobal mac_ctx) |
| 687 | { |
| 688 | struct nan_callbacks cb_obj = {0}; |
| 689 | |
| 690 | cb_obj.add_ndi_peer = lim_add_ndi_peer_converged; |
Naveen Rawat | b3143ea | 2017-03-26 22:25:46 -0700 | [diff] [blame] | 691 | cb_obj.ndp_delete_peers = lim_ndp_delete_peers_converged; |
| 692 | cb_obj.delete_peers_by_addr = lim_ndp_delete_peers_by_addr_converged; |
Naveen Rawat | 37f62c8 | 2017-03-26 22:24:43 -0700 | [diff] [blame] | 693 | |
| 694 | ucfg_nan_register_lim_callbacks(mac_ctx->psoc, &cb_obj); |
| 695 | } |
Naveen Rawat | 37f62c8 | 2017-03-26 22:24:43 -0700 | [diff] [blame] | 696 | |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 697 | /* |
| 698 | * pe_shutdown_notifier_cb - Shutdown notifier callback |
| 699 | * @ctx: Pointer to Global MAC structure |
| 700 | * |
| 701 | * Return: None |
| 702 | */ |
| 703 | static void pe_shutdown_notifier_cb(void *ctx) |
| 704 | { |
| 705 | tpAniSirGlobal mac_ctx = (tpAniSirGlobal)ctx; |
| 706 | tpPESession session; |
| 707 | uint8_t i; |
| 708 | |
yeshwanth sriram guntuka | fde0d52 | 2017-08-17 19:52:11 +0530 | [diff] [blame] | 709 | lim_deactivate_timers(mac_ctx); |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 710 | for (i = 0; i < mac_ctx->lim.maxBssId; i++) { |
| 711 | session = &mac_ctx->lim.gpSession[i]; |
| 712 | if (session->valid == true) { |
| 713 | if (LIM_IS_AP_ROLE(session)) |
| 714 | qdf_mc_timer_stop(&session-> |
| 715 | protection_fields_reset_timer); |
| 716 | #ifdef WLAN_FEATURE_11W |
| 717 | qdf_mc_timer_stop(&session->pmfComebackTimer); |
| 718 | #endif |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 719 | } |
| 720 | } |
| 721 | } |
| 722 | |
Liangwei Dong | c26be33 | 2018-01-19 00:31:31 -0500 | [diff] [blame] | 723 | #ifdef WLAN_FEATURE_11W |
| 724 | /** |
| 725 | * is_mgmt_protected - check RMF enabled for the peer |
| 726 | * @vdev_id: vdev id |
| 727 | * @peer_mac_addr: peer mac address |
| 728 | * |
| 729 | * The function check the mgmt frame protection enabled or not |
| 730 | * for station mode and AP mode |
| 731 | * |
| 732 | * Return: true, if the connection is RMF enabled. |
| 733 | */ |
| 734 | static bool is_mgmt_protected(uint32_t vdev_id, |
| 735 | const uint8_t *peer_mac_addr) |
| 736 | { |
| 737 | uint16_t aid; |
| 738 | tpDphHashNode sta_ds; |
| 739 | tpPESession session; |
| 740 | bool protected = false; |
| 741 | tpAniSirGlobal mac_ctx = cds_get_context(QDF_MODULE_ID_PE); |
| 742 | |
| 743 | if (!mac_ctx) |
| 744 | return false; |
| 745 | |
| 746 | session = pe_find_session_by_sme_session_id(mac_ctx, |
| 747 | vdev_id); |
| 748 | if (!session) { |
| 749 | /* couldn't find session */ |
| 750 | pe_err("Session not found for vdev_id: %d", vdev_id); |
| 751 | return false; |
| 752 | } |
| 753 | |
| 754 | if (LIM_IS_AP_ROLE(session)) { |
| 755 | sta_ds = dph_lookup_hash_entry(mac_ctx, |
| 756 | (uint8_t *)peer_mac_addr, &aid, |
| 757 | &session->dph.dphHashTable); |
| 758 | if (sta_ds) { |
| 759 | /* rmfenabled will be set at the time of addbss. |
| 760 | * but sometimes EAP auth fails and keys are not |
| 761 | * installed then if we send any management frame |
| 762 | * like deauth/disassoc with this bit set then |
| 763 | * firmware crashes. so check for keys are |
| 764 | * installed or not also before setting the bit |
| 765 | */ |
| 766 | if (sta_ds->rmfEnabled && sta_ds->is_key_installed) |
| 767 | protected = true; |
| 768 | } |
| 769 | } else if (session->limRmfEnabled && |
| 770 | session->is_key_installed) { |
| 771 | protected = true; |
| 772 | } |
| 773 | |
| 774 | return protected; |
| 775 | } |
| 776 | #else |
| 777 | /** |
| 778 | * is_mgmt_protected - check RMF enabled for the peer |
| 779 | * @vdev_id: vdev id |
| 780 | * @peer_mac_addr: peer mac address |
| 781 | * |
| 782 | * The function check the mgmt frame protection enabled or not |
| 783 | * for station mode and AP mode |
| 784 | * |
| 785 | * Return: true, if the connection is RMF enabled. |
| 786 | */ |
| 787 | static bool is_mgmt_protected(uint32_t vdev_id, |
| 788 | const uint8_t *peer_mac_addr) |
| 789 | { |
| 790 | return false; |
| 791 | } |
| 792 | #endif |
| 793 | |
| 794 | static void p2p_register_callbacks(tpAniSirGlobal mac_ctx) |
| 795 | { |
| 796 | struct p2p_protocol_callbacks p2p_cb = {0}; |
| 797 | |
| 798 | p2p_cb.is_mgmt_protected = is_mgmt_protected; |
| 799 | ucfg_p2p_register_callbacks(mac_ctx->psoc, &p2p_cb); |
| 800 | } |
| 801 | |
Vignesh Viswanathan | 153ae93 | 2018-04-11 14:24:13 +0530 | [diff] [blame] | 802 | /* |
| 803 | * lim_register_sap_bcn_callback(): Register a callback with scan module for SAP |
| 804 | * @mac_ctx: pointer to the global mac context |
| 805 | * |
| 806 | * Registers the function lim_handle_sap_beacon as callback with the Scan |
| 807 | * module to handle beacon frames for SAP sessions |
| 808 | * |
| 809 | * Return: QDF Status |
| 810 | */ |
| 811 | static QDF_STATUS lim_register_sap_bcn_callback(tpAniSirGlobal mac_ctx) |
| 812 | { |
| 813 | QDF_STATUS status; |
| 814 | |
| 815 | status = ucfg_scan_register_bcn_cb(mac_ctx->psoc, |
| 816 | lim_handle_sap_beacon, |
| 817 | SCAN_CB_TYPE_UPDATE_BCN); |
| 818 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 819 | pe_err("failed with status code %08d [x%08x]", |
| 820 | status, status); |
| 821 | } |
| 822 | |
| 823 | return status; |
| 824 | } |
| 825 | |
| 826 | /* |
| 827 | * lim_unregister_sap_bcn_callback(): Unregister the callback with scan module |
| 828 | * @mac_ctx: pointer to the global mac context |
| 829 | * |
| 830 | * Unregisters the callback registered with the Scan |
| 831 | * module to handle beacon frames for SAP sessions |
| 832 | * |
| 833 | * Return: QDF Status |
| 834 | */ |
| 835 | static QDF_STATUS lim_unregister_sap_bcn_callback(tpAniSirGlobal mac_ctx) |
| 836 | { |
| 837 | QDF_STATUS status; |
| 838 | |
| 839 | status = ucfg_scan_register_bcn_cb(mac_ctx->psoc, |
| 840 | NULL, SCAN_CB_TYPE_UPDATE_BCN); |
| 841 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 842 | pe_err("failed with status code %08d [x%08x]", |
| 843 | status, status); |
| 844 | } |
| 845 | |
| 846 | return status; |
| 847 | } |
| 848 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 849 | /** ------------------------------------------------------------- |
| 850 | \fn pe_open |
| 851 | \brief will be called in Open sequence from mac_open |
| 852 | \param tpAniSirGlobal pMac |
| 853 | \param tHalOpenParameters *pHalOpenParam |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 854 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 855 | -------------------------------------------------------------*/ |
| 856 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 857 | QDF_STATUS pe_open(tpAniSirGlobal pMac, struct cds_config_info *cds_cfg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 858 | { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 859 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 860 | |
Srinivas Girigowda | 35b0031 | 2017-06-27 21:52:03 -0700 | [diff] [blame] | 861 | if (QDF_DRIVER_TYPE_MFG == cds_cfg->driver_type) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 862 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 863 | |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 864 | pMac->lim.maxBssId = cds_cfg->max_bssid; |
| 865 | pMac->lim.maxStation = cds_cfg->max_station; |
Sreelakshmi Konamki | 6d478cd | 2017-03-28 11:59:25 +0530 | [diff] [blame] | 866 | qdf_spinlock_create(&pMac->sys.bbt_mgmt_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 867 | |
| 868 | if ((pMac->lim.maxBssId == 0) || (pMac->lim.maxStation == 0)) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 869 | pe_err("max number of Bssid or Stations cannot be zero!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 870 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 871 | } |
| 872 | |
Qiwei Cai | 50a2108 | 2018-08-07 14:30:09 +0800 | [diff] [blame] | 873 | if (!QDF_IS_STATUS_SUCCESS(pe_allocate_dph_node_array_buffer())) { |
| 874 | pe_err("g_dph_node_array memory allocate failed!"); |
| 875 | return QDF_STATUS_E_NOMEM; |
| 876 | } |
| 877 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 878 | pMac->lim.limTimers.gpLimCnfWaitTimer = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 879 | qdf_mem_malloc(sizeof(TX_TIMER) * (pMac->lim.maxStation + 1)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 880 | if (NULL == pMac->lim.limTimers.gpLimCnfWaitTimer) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 881 | pe_err("gpLimCnfWaitTimer memory allocate failed!"); |
Qiwei Cai | 50a2108 | 2018-08-07 14:30:09 +0800 | [diff] [blame] | 882 | status = QDF_STATUS_E_NOMEM; |
| 883 | goto pe_open_timer_fail; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 884 | } |
| 885 | |
| 886 | pMac->lim.gpSession = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 887 | qdf_mem_malloc(sizeof(tPESession) * pMac->lim.maxBssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 888 | if (NULL == pMac->lim.gpSession) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 889 | pe_err("gpSession memory allocate failed!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 890 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 891 | goto pe_open_psession_fail; |
| 892 | } |
| 893 | |
Jiachao Wu | e6485d4 | 2017-12-12 10:54:54 +0800 | [diff] [blame] | 894 | status = lim_initialize(pMac); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 895 | if (QDF_STATUS_SUCCESS != status) { |
Jiachao Wu | e6485d4 | 2017-12-12 10:54:54 +0800 | [diff] [blame] | 896 | pe_err("lim_initialize failed!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 897 | status = QDF_STATUS_E_FAILURE; |
Jiachao Wu | e6485d4 | 2017-12-12 10:54:54 +0800 | [diff] [blame] | 898 | goto pe_open_lock_fail; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 899 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 900 | |
| 901 | /* |
| 902 | * pe_open is successful by now, so it is right time to initialize |
| 903 | * MTRACE for PE module. if LIM_TRACE_RECORD is not defined in build |
| 904 | * file then nothing will be logged for PE module. |
| 905 | */ |
| 906 | #ifdef LIM_TRACE_RECORD |
| 907 | MTRACE(lim_trace_init(pMac)); |
| 908 | #endif |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 909 | lim_register_debug_callback(); |
Naveen Rawat | 37f62c8 | 2017-03-26 22:24:43 -0700 | [diff] [blame] | 910 | lim_nan_register_callbacks(pMac); |
Liangwei Dong | c26be33 | 2018-01-19 00:31:31 -0500 | [diff] [blame] | 911 | p2p_register_callbacks(pMac); |
Vignesh Viswanathan | 153ae93 | 2018-04-11 14:24:13 +0530 | [diff] [blame] | 912 | lim_register_sap_bcn_callback(pMac); |
Padma, Santhosh Kumar | 9aba02f | 2016-08-11 16:30:25 +0530 | [diff] [blame] | 913 | |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 914 | if (!QDF_IS_STATUS_SUCCESS( |
| 915 | cds_shutdown_notifier_register(pe_shutdown_notifier_cb, pMac))) { |
| 916 | pe_err("%s: Shutdown notifier register failed", __func__); |
| 917 | } |
| 918 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 919 | return status; /* status here will be QDF_STATUS_SUCCESS */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 920 | |
Jiachao Wu | e6485d4 | 2017-12-12 10:54:54 +0800 | [diff] [blame] | 921 | pe_open_lock_fail: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 922 | qdf_mem_free(pMac->lim.gpSession); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 923 | pMac->lim.gpSession = NULL; |
| 924 | pe_open_psession_fail: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 925 | qdf_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 926 | pMac->lim.limTimers.gpLimCnfWaitTimer = NULL; |
Qiwei Cai | 50a2108 | 2018-08-07 14:30:09 +0800 | [diff] [blame] | 927 | pe_open_timer_fail: |
| 928 | pe_free_dph_node_array_buffer(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 929 | |
| 930 | return status; |
| 931 | } |
| 932 | |
| 933 | /** ------------------------------------------------------------- |
| 934 | \fn pe_close |
| 935 | \brief will be called in close sequence from mac_close |
| 936 | \param tpAniSirGlobal pMac |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 937 | \return QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 938 | -------------------------------------------------------------*/ |
| 939 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 940 | QDF_STATUS pe_close(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 941 | { |
| 942 | uint8_t i; |
| 943 | |
Srinivas Girigowda | 35b0031 | 2017-06-27 21:52:03 -0700 | [diff] [blame] | 944 | if (ANI_DRIVER_TYPE(pMac) == QDF_DRIVER_TYPE_MFG) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 945 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 946 | |
Jiachao Wu | e6485d4 | 2017-12-12 10:54:54 +0800 | [diff] [blame] | 947 | lim_cleanup(pMac); |
Vignesh Viswanathan | 153ae93 | 2018-04-11 14:24:13 +0530 | [diff] [blame] | 948 | lim_unregister_sap_bcn_callback(pMac); |
Abhishek Singh | 51e048e | 2017-11-14 14:46:51 +0530 | [diff] [blame] | 949 | |
Himanshu Agarwal | 8612c3b | 2017-12-14 14:37:08 +0530 | [diff] [blame] | 950 | if (pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq) { |
| 951 | qdf_mem_free(pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq); |
| 952 | pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
| 953 | } |
| 954 | |
Sreelakshmi Konamki | 6d478cd | 2017-03-28 11:59:25 +0530 | [diff] [blame] | 955 | qdf_spinlock_destroy(&pMac->sys.bbt_mgmt_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 956 | for (i = 0; i < pMac->lim.maxBssId; i++) { |
Krunal Soni | 6de1b21 | 2017-10-30 23:29:20 -0700 | [diff] [blame] | 957 | if (pMac->lim.gpSession[i].valid == true) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 958 | pe_delete_session(pMac, &pMac->lim.gpSession[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 959 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 960 | qdf_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 961 | pMac->lim.limTimers.gpLimCnfWaitTimer = NULL; |
| 962 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 963 | qdf_mem_free(pMac->lim.gpSession); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 964 | pMac->lim.gpSession = NULL; |
Qiwei Cai | 50a2108 | 2018-08-07 14:30:09 +0800 | [diff] [blame] | 965 | |
| 966 | pe_free_dph_node_array_buffer(); |
| 967 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 968 | if (!QDF_IS_STATUS_SUCCESS |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 969 | (qdf_mutex_destroy(&pMac->lim.lkPeGlobalLock))) { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 970 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 971 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 972 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 973 | } |
| 974 | |
| 975 | /** ------------------------------------------------------------- |
| 976 | \fn pe_start |
| 977 | \brief will be called in start sequence from mac_start |
| 978 | \param tpAniSirGlobal pMac |
Jeff Johnson | d9e0351 | 2018-06-29 12:04:03 -0700 | [diff] [blame] | 979 | \return QDF_STATUS_SUCCESS on success, other QDF_STATUS on error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 980 | -------------------------------------------------------------*/ |
| 981 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 982 | QDF_STATUS pe_start(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 983 | { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 984 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Jiachao Wu | e6485d4 | 2017-12-12 10:54:54 +0800 | [diff] [blame] | 985 | status = lim_start(pMac); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 986 | if (QDF_STATUS_SUCCESS != status) { |
Jiachao Wu | e6485d4 | 2017-12-12 10:54:54 +0800 | [diff] [blame] | 987 | pe_err("lim_start failed!"); |
| 988 | return status; |
| 989 | } |
| 990 | /* Initialize the configurations needed by PE */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 991 | if (QDF_STATUS_E_FAILURE == __lim_init_config(pMac)) { |
Jiachao Wu | e6485d4 | 2017-12-12 10:54:54 +0800 | [diff] [blame] | 992 | pe_err("lim init config failed!"); |
| 993 | /* We need to undo everything in lim_start */ |
| 994 | lim_cleanup_mlm(pMac); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 995 | return QDF_STATUS_E_FAILURE; |
Jiachao Wu | e6485d4 | 2017-12-12 10:54:54 +0800 | [diff] [blame] | 996 | } |
| 997 | /* Initialize the configurations needed by PE */ |
| 998 | lim_register_hal_ind_call_back(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 999 | return status; |
| 1000 | } |
| 1001 | |
| 1002 | /** ------------------------------------------------------------- |
| 1003 | \fn pe_stop |
| 1004 | \brief will be called in stop sequence from mac_stop |
| 1005 | \param tpAniSirGlobal pMac |
| 1006 | \return none |
| 1007 | -------------------------------------------------------------*/ |
| 1008 | |
| 1009 | void pe_stop(tpAniSirGlobal pMac) |
| 1010 | { |
Jiachao Wu | e6485d4 | 2017-12-12 10:54:54 +0800 | [diff] [blame] | 1011 | lim_cleanup_mlm(pMac); |
Pragaspathi Thilagaraj | 210362a | 2018-07-31 19:08:19 +0530 | [diff] [blame] | 1012 | pe_debug(" PE STOP: Set LIM state to eLIM_MLM_OFFLINE_STATE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1013 | SET_LIM_MLM_STATE(pMac, eLIM_MLM_OFFLINE_STATE); |
| 1014 | return; |
| 1015 | } |
| 1016 | |
Rajeev Kumar | 69ddd85 | 2018-02-20 13:58:08 -0800 | [diff] [blame] | 1017 | static void pe_free_nested_messages(struct scheduler_msg *msg) |
| 1018 | { |
| 1019 | switch (msg->type) { |
| 1020 | case WMA_SET_LINK_STATE_RSP: |
Pragaspathi Thilagaraj | 210362a | 2018-07-31 19:08:19 +0530 | [diff] [blame] | 1021 | pe_debug("pe_free_nested_messages: WMA_SET_LINK_STATE_RSP"); |
Rajeev Kumar | 69ddd85 | 2018-02-20 13:58:08 -0800 | [diff] [blame] | 1022 | qdf_mem_free(((tpLinkStateParams) msg->bodyptr)->callbackArg); |
| 1023 | break; |
| 1024 | default: |
| 1025 | break; |
| 1026 | } |
| 1027 | } |
| 1028 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1029 | /** ------------------------------------------------------------- |
| 1030 | \fn pe_free_msg |
| 1031 | \brief Called by CDS scheduler (function cds_sched_flush_mc_mqs) |
| 1032 | \ to free a given PE message on the TX and MC thread. |
| 1033 | \ This happens when there are messages pending in the PE |
| 1034 | \ queue when system is being stopped and reset. |
| 1035 | \param tpAniSirGlobal pMac |
Rajeev Kumar | 416b73f | 2017-01-21 16:45:21 -0800 | [diff] [blame] | 1036 | \param struct scheduler_msg pMsg |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1037 | \return none |
| 1038 | -----------------------------------------------------------------*/ |
Rajeev Kumar | 416b73f | 2017-01-21 16:45:21 -0800 | [diff] [blame] | 1039 | void pe_free_msg(tpAniSirGlobal pMac, struct scheduler_msg *pMsg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1040 | { |
| 1041 | if (pMsg != NULL) { |
| 1042 | if (NULL != pMsg->bodyptr) { |
| 1043 | if (SIR_BB_XPORT_MGMT_MSG == pMsg->type) { |
| 1044 | cds_pkt_return_packet((cds_pkt_t *) pMsg-> |
| 1045 | bodyptr); |
| 1046 | } else { |
Rajeev Kumar | 69ddd85 | 2018-02-20 13:58:08 -0800 | [diff] [blame] | 1047 | pe_free_nested_messages(pMsg); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1048 | qdf_mem_free((void *)pMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1049 | } |
| 1050 | } |
| 1051 | pMsg->bodyptr = 0; |
| 1052 | pMsg->bodyval = 0; |
| 1053 | pMsg->type = 0; |
| 1054 | } |
| 1055 | return; |
| 1056 | } |
| 1057 | |
Jeff Johnson | c9f4462 | 2018-06-29 14:18:53 -0700 | [diff] [blame] | 1058 | QDF_STATUS lim_post_msg_api(tpAniSirGlobal mac, struct scheduler_msg *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1059 | { |
Jeff Johnson | c9f4462 | 2018-06-29 14:18:53 -0700 | [diff] [blame] | 1060 | return scheduler_post_msg(QDF_MODULE_ID_PE, msg); |
| 1061 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1062 | |
Jeff Johnson | c9f4462 | 2018-06-29 14:18:53 -0700 | [diff] [blame] | 1063 | QDF_STATUS lim_post_msg_high_priority(tpAniSirGlobal mac, |
| 1064 | struct scheduler_msg *msg) |
Padma, Santhosh Kumar | 9509135 | 2016-08-16 15:23:31 +0530 | [diff] [blame] | 1065 | { |
Rajeev Kumar | f7d8442 | 2017-01-21 15:45:44 -0800 | [diff] [blame] | 1066 | return scheduler_post_msg_by_priority(QDF_MODULE_ID_PE, |
Rajeev Kumar | 1497871 | 2017-01-30 16:57:07 -0800 | [diff] [blame] | 1067 | msg, true); |
Padma, Santhosh Kumar | 9509135 | 2016-08-16 15:23:31 +0530 | [diff] [blame] | 1068 | } |
| 1069 | |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 1070 | QDF_STATUS pe_mc_process_handler(struct scheduler_msg *msg) |
| 1071 | { |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 1072 | tpAniSirGlobal mac_ctx = cds_get_context(QDF_MODULE_ID_PE); |
| 1073 | |
| 1074 | if (mac_ctx == NULL) |
| 1075 | return QDF_STATUS_E_FAILURE; |
| 1076 | |
Jeff Johnson | edfaf0b | 2018-06-29 12:47:11 -0700 | [diff] [blame] | 1077 | if (ANI_DRIVER_TYPE(mac_ctx) == QDF_DRIVER_TYPE_MFG) |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 1078 | return QDF_STATUS_SUCCESS; |
| 1079 | |
Jeff Johnson | edfaf0b | 2018-06-29 12:47:11 -0700 | [diff] [blame] | 1080 | /* |
| 1081 | * If the Message to be handled is for CFG Module call the CFG Msg |
| 1082 | * Handler and for all the other cases post it to LIM |
| 1083 | */ |
| 1084 | if (SIR_CFG_PARAM_UPDATE_IND != msg->type && IS_CFG_MSG(msg->type)) |
| 1085 | cfg_process_mb_msg(mac_ctx, msg->bodyptr); |
| 1086 | else |
| 1087 | lim_message_processor(mac_ctx, msg); |
| 1088 | |
| 1089 | return QDF_STATUS_SUCCESS; |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 1090 | } |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame] | 1091 | |
Sreelakshmi Konamki | 6d478cd | 2017-03-28 11:59:25 +0530 | [diff] [blame] | 1092 | /** |
| 1093 | * pe_drop_pending_rx_mgmt_frames: To drop pending RX mgmt frames |
| 1094 | * @mac_ctx: Pointer to global MAC structure |
| 1095 | * @hdr: Management header |
| 1096 | * @cds_pkt: Packet |
| 1097 | * |
| 1098 | * This function is used to drop RX pending mgmt frames if pe mgmt queue |
| 1099 | * reaches threshold |
| 1100 | * |
| 1101 | * Return: QDF_STATUS_SUCCESS on success or QDF_STATUS_E_FAILURE on failure |
| 1102 | */ |
| 1103 | static QDF_STATUS pe_drop_pending_rx_mgmt_frames(tpAniSirGlobal mac_ctx, |
| 1104 | tpSirMacMgmtHdr hdr, cds_pkt_t *cds_pkt) |
| 1105 | { |
| 1106 | qdf_spin_lock(&mac_ctx->sys.bbt_mgmt_lock); |
| 1107 | if (mac_ctx->sys.sys_bbt_pending_mgmt_count >= |
| 1108 | MGMT_RX_PACKETS_THRESHOLD) { |
| 1109 | qdf_spin_unlock(&mac_ctx->sys.bbt_mgmt_lock); |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1110 | pe_debug("No.of pending RX management frames reaches to threshold, dropping management frames"); |
Sreelakshmi Konamki | 6d478cd | 2017-03-28 11:59:25 +0530 | [diff] [blame] | 1111 | cds_pkt_return_packet(cds_pkt); |
| 1112 | cds_pkt = NULL; |
Sreelakshmi Konamki | 0e9fb9a | 2017-04-05 18:57:15 +0530 | [diff] [blame] | 1113 | mac_ctx->rx_packet_drop_counter++; |
Sreelakshmi Konamki | 6d478cd | 2017-03-28 11:59:25 +0530 | [diff] [blame] | 1114 | return QDF_STATUS_E_FAILURE; |
| 1115 | } else if (mac_ctx->sys.sys_bbt_pending_mgmt_count > |
| 1116 | (MGMT_RX_PACKETS_THRESHOLD / 2)) { |
| 1117 | /* drop all probereq, proberesp and beacons */ |
| 1118 | if (hdr->fc.subType == SIR_MAC_MGMT_BEACON || |
| 1119 | hdr->fc.subType == SIR_MAC_MGMT_PROBE_REQ || |
| 1120 | hdr->fc.subType == SIR_MAC_MGMT_PROBE_RSP) { |
| 1121 | qdf_spin_unlock(&mac_ctx->sys.bbt_mgmt_lock); |
Sreelakshmi Konamki | 0e9fb9a | 2017-04-05 18:57:15 +0530 | [diff] [blame] | 1122 | if (!(mac_ctx->rx_packet_drop_counter % 100)) |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1123 | pe_debug("No.of pending RX mgmt frames reaches 1/2 thresh, dropping frame subtype: %d rx_packet_drop_counter: %d", |
Sreelakshmi Konamki | 0e9fb9a | 2017-04-05 18:57:15 +0530 | [diff] [blame] | 1124 | hdr->fc.subType, |
| 1125 | mac_ctx->rx_packet_drop_counter); |
| 1126 | mac_ctx->rx_packet_drop_counter++; |
Sreelakshmi Konamki | 6d478cd | 2017-03-28 11:59:25 +0530 | [diff] [blame] | 1127 | cds_pkt_return_packet(cds_pkt); |
| 1128 | cds_pkt = NULL; |
| 1129 | return QDF_STATUS_E_FAILURE; |
| 1130 | } |
| 1131 | } |
| 1132 | mac_ctx->sys.sys_bbt_pending_mgmt_count++; |
| 1133 | qdf_spin_unlock(&mac_ctx->sys.bbt_mgmt_lock); |
| 1134 | if (mac_ctx->sys.sys_bbt_pending_mgmt_count == |
Sreelakshmi Konamki | 0e9fb9a | 2017-04-05 18:57:15 +0530 | [diff] [blame] | 1135 | (MGMT_RX_PACKETS_THRESHOLD / 4)) { |
| 1136 | if (!(mac_ctx->rx_packet_drop_counter % 100)) |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1137 | pe_debug("No.of pending RX management frames reaches to 1/4th of threshold, rx_packet_drop_counter: %d", |
Sreelakshmi Konamki | 0e9fb9a | 2017-04-05 18:57:15 +0530 | [diff] [blame] | 1138 | mac_ctx->rx_packet_drop_counter); |
| 1139 | mac_ctx->rx_packet_drop_counter++; |
| 1140 | } |
Sreelakshmi Konamki | 6d478cd | 2017-03-28 11:59:25 +0530 | [diff] [blame] | 1141 | return QDF_STATUS_SUCCESS; |
| 1142 | } |
| 1143 | |
Vignesh Viswanathan | b3dbbc8 | 2018-04-06 00:06:27 +0530 | [diff] [blame] | 1144 | /** |
Vignesh Viswanathan | 48b7ed9 | 2018-04-11 19:01:59 +0530 | [diff] [blame] | 1145 | * pe_is_ext_scan_bcn - Check if the beacon is from Ext or EPNO scan |
| 1146 | * |
| 1147 | * @hdr: pointer to the 802.11 header of the frame |
| 1148 | * @rx_pkt_info: pointer to the rx packet meta |
| 1149 | * |
| 1150 | * Checks if the beacon is from Ext Scan or EPNO scan |
| 1151 | * |
| 1152 | * Return: true or false |
| 1153 | */ |
| 1154 | #ifdef FEATURE_WLAN_EXTSCAN |
| 1155 | static inline bool pe_is_ext_scan_bcn(tpSirMacMgmtHdr hdr, |
| 1156 | uint8_t *rx_pkt_info) |
| 1157 | { |
| 1158 | if ((hdr->fc.subType == SIR_MAC_MGMT_BEACON) && |
| 1159 | (WMA_IS_EXTSCAN_SCAN_SRC(rx_pkt_info) || |
| 1160 | WMA_IS_EPNO_SCAN_SRC(rx_pkt_info))) |
| 1161 | return true; |
| 1162 | |
| 1163 | return false; |
| 1164 | } |
| 1165 | #else |
| 1166 | static inline bool pe_is_ext_scan_bcn(tpSirMacMgmtHdr hdr, |
| 1167 | uint8_t *rx_pkt_info) |
| 1168 | { |
| 1169 | return false; |
| 1170 | } |
| 1171 | #endif |
| 1172 | |
| 1173 | /** |
Vignesh Viswanathan | b3dbbc8 | 2018-04-06 00:06:27 +0530 | [diff] [blame] | 1174 | * pe_filter_drop_bcn_probe_frame - Apply filter on the received frame |
| 1175 | * |
| 1176 | * @mac_ctx: pointer to the global mac context |
| 1177 | * @hdr: pointer to the 802.11 header of the frame |
| 1178 | * @rx_pkt_info: pointer to the rx packet meta |
| 1179 | * |
| 1180 | * Applies the filter from global mac context on the received beacon/ |
| 1181 | * probe response frame before posting it to the PE queue |
| 1182 | * |
| 1183 | * Return: true if frame is allowed, false if frame is to be dropped. |
| 1184 | */ |
| 1185 | static bool pe_filter_bcn_probe_frame(tpAniSirGlobal mac_ctx, |
| 1186 | tpSirMacMgmtHdr hdr, |
| 1187 | uint8_t *rx_pkt_info) |
| 1188 | { |
| 1189 | uint8_t session_id; |
| 1190 | uint8_t *body; |
| 1191 | const uint8_t *ssid_ie; |
| 1192 | uint16_t frame_len; |
| 1193 | struct mgmt_beacon_probe_filter *filter; |
| 1194 | tpSirMacCapabilityInfo bcn_caps; |
| 1195 | tSirMacSSid bcn_ssid; |
| 1196 | |
Vignesh Viswanathan | 48b7ed9 | 2018-04-11 19:01:59 +0530 | [diff] [blame] | 1197 | if (pe_is_ext_scan_bcn(hdr, rx_pkt_info)) |
| 1198 | return true; |
| 1199 | |
Vignesh Viswanathan | b3dbbc8 | 2018-04-06 00:06:27 +0530 | [diff] [blame] | 1200 | filter = &mac_ctx->bcn_filter; |
| 1201 | |
| 1202 | /* |
| 1203 | * If any STA session exists and beacon source matches any of the |
| 1204 | * STA BSSIDs, allow the frame |
| 1205 | */ |
| 1206 | if (filter->num_sta_sessions) { |
| 1207 | for (session_id = 0; session_id < SIR_MAX_SUPPORTED_BSS; |
| 1208 | session_id++) { |
| 1209 | if (sir_compare_mac_addr(filter->sta_bssid[session_id], |
| 1210 | hdr->bssId)) { |
| 1211 | return true; |
| 1212 | } |
| 1213 | } |
| 1214 | } |
| 1215 | |
| 1216 | /* |
| 1217 | * If any IBSS session exists and beacon is has IBSS capability set |
| 1218 | * and SSID matches the IBSS SSID, allow the frame |
| 1219 | */ |
| 1220 | if (filter->num_ibss_sessions) { |
| 1221 | body = WMA_GET_RX_MPDU_DATA(rx_pkt_info); |
| 1222 | frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info); |
| 1223 | if (frame_len < SIR_MAC_B_PR_SSID_OFFSET) |
| 1224 | return false; |
| 1225 | |
| 1226 | bcn_caps = (tpSirMacCapabilityInfo) |
| 1227 | (body + SIR_MAC_B_PR_CAPAB_OFFSET); |
| 1228 | if (!bcn_caps->ibss) |
| 1229 | return false; |
| 1230 | |
| 1231 | ssid_ie = wlan_get_ie_ptr_from_eid(SIR_MAC_SSID_EID, |
| 1232 | body + SIR_MAC_B_PR_SSID_OFFSET, |
| 1233 | frame_len); |
| 1234 | |
| 1235 | if (!ssid_ie) |
| 1236 | return false; |
| 1237 | |
| 1238 | bcn_ssid.length = ssid_ie[1]; |
| 1239 | qdf_mem_copy(&bcn_ssid.ssId, |
| 1240 | &ssid_ie[2], |
| 1241 | bcn_ssid.length); |
| 1242 | |
| 1243 | for (session_id = 0; session_id < SIR_MAX_SUPPORTED_BSS; |
| 1244 | session_id++) { |
| 1245 | if (filter->ibss_ssid[session_id].length == |
| 1246 | bcn_ssid.length && |
| 1247 | (!qdf_mem_cmp(filter->ibss_ssid[session_id].ssId, |
| 1248 | bcn_ssid.ssId, bcn_ssid.length))) { |
| 1249 | return true; |
| 1250 | } |
| 1251 | } |
| 1252 | } |
| 1253 | |
| 1254 | return false; |
| 1255 | } |
| 1256 | |
Vignesh Viswanathan | 18eb2b2 | 2018-05-08 19:34:56 +0530 | [diff] [blame] | 1257 | static QDF_STATUS pe_handle_probe_req_frames(tpAniSirGlobal mac_ctx, |
| 1258 | cds_pkt_t *pkt) |
| 1259 | { |
| 1260 | QDF_STATUS status; |
| 1261 | struct scheduler_msg msg = {0}; |
| 1262 | |
| 1263 | /* Forward to MAC via mesg = SIR_BB_XPORT_MGMT_MSG */ |
| 1264 | msg.type = SIR_BB_XPORT_MGMT_MSG; |
| 1265 | msg.bodyptr = pkt; |
| 1266 | msg.bodyval = 0; |
| 1267 | msg.callback = pe_mc_process_handler; |
| 1268 | |
| 1269 | status = scheduler_post_msg(QDF_MODULE_ID_SCAN, &msg); |
| 1270 | |
| 1271 | if (!QDF_IS_STATUS_SUCCESS(status)) |
| 1272 | pe_err_rl("Failed to post probe req frame to Scan Queue"); |
| 1273 | |
| 1274 | return status; |
| 1275 | } |
| 1276 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1277 | /* --------------------------------------------------------------------------- */ |
| 1278 | /** |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 1279 | * pe_handle_mgmt_frame() - Process the Management frames from TXRX |
| 1280 | * @psoc: psoc context |
| 1281 | * @peer: peer |
| 1282 | * @buf: buffer |
| 1283 | * @mgmt_rx_params; rx event params |
| 1284 | * @frm_type: frame type |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1285 | * |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 1286 | * This function handles the mgmt rx frame from mgmt txrx component and forms |
| 1287 | * a cds packet and schedule it in controller thread for further processing. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1288 | * |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 1289 | * Return: QDF_STATUS_SUCCESS - in case of success |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1290 | */ |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 1291 | static QDF_STATUS pe_handle_mgmt_frame(struct wlan_objmgr_psoc *psoc, |
| 1292 | struct wlan_objmgr_peer *peer, qdf_nbuf_t buf, |
Himanshu Agarwal | d2e6cde | 2017-01-10 14:47:04 +0530 | [diff] [blame] | 1293 | struct mgmt_rx_event_params *mgmt_rx_params, |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 1294 | uint32_t frm_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1295 | { |
| 1296 | tpAniSirGlobal pMac; |
| 1297 | tpSirMacMgmtHdr mHdr; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 1298 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1299 | cds_pkt_t *pVosPkt; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1300 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1301 | uint8_t *pRxPacketInfo; |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 1302 | int ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1303 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1304 | pMac = cds_get_context(QDF_MODULE_ID_PE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1305 | if (NULL == pMac) { |
| 1306 | /* cannot log a failure without a valid pMac */ |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 1307 | qdf_nbuf_free(buf); |
| 1308 | return QDF_STATUS_E_FAILURE; |
| 1309 | } |
| 1310 | |
| 1311 | pVosPkt = qdf_mem_malloc(sizeof(*pVosPkt)); |
| 1312 | if (!pVosPkt) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1313 | pe_err("Failed to allocate rx packet"); |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 1314 | qdf_nbuf_free(buf); |
| 1315 | return QDF_STATUS_E_NOMEM; |
| 1316 | } |
| 1317 | |
| 1318 | ret = wma_form_rx_packet(buf, mgmt_rx_params, pVosPkt); |
| 1319 | if (ret) { |
Dustin Brown | 897dae4 | 2018-03-13 17:08:47 -0700 | [diff] [blame] | 1320 | pe_err_rl("Failed to fill cds packet from event buffer"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1321 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1322 | } |
| 1323 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1324 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1325 | wma_ds_peek_rx_packet_info(pVosPkt, (void *)&pRxPacketInfo, false); |
| 1326 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1327 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1328 | cds_pkt_return_packet(pVosPkt); |
| 1329 | pVosPkt = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1330 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1331 | } |
| 1332 | |
| 1333 | /* |
| 1334 | * The MPDU header is now present at a certain "offset" in |
| 1335 | * the BD and is specified in the BD itself |
| 1336 | */ |
| 1337 | |
| 1338 | mHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1339 | |
Vignesh Viswanathan | b3dbbc8 | 2018-04-06 00:06:27 +0530 | [diff] [blame] | 1340 | /* |
| 1341 | * Filter the beacon/probe response frames before posting it |
| 1342 | * on the PE queue |
| 1343 | */ |
| 1344 | if ((mHdr->fc.subType == SIR_MAC_MGMT_BEACON || |
| 1345 | mHdr->fc.subType == SIR_MAC_MGMT_PROBE_RSP) && |
| 1346 | !pe_filter_bcn_probe_frame(pMac, mHdr, pRxPacketInfo)) { |
| 1347 | cds_pkt_return_packet(pVosPkt); |
| 1348 | pVosPkt = NULL; |
| 1349 | return QDF_STATUS_SUCCESS; |
| 1350 | } |
| 1351 | |
Vignesh Viswanathan | 18eb2b2 | 2018-05-08 19:34:56 +0530 | [diff] [blame] | 1352 | /* |
| 1353 | * Post Probe Req frames to Scan queue and return |
| 1354 | */ |
| 1355 | if (mHdr->fc.subType == SIR_MAC_MGMT_PROBE_REQ) { |
| 1356 | qdf_status = pe_handle_probe_req_frames(pMac, pVosPkt); |
| 1357 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 1358 | cds_pkt_return_packet(pVosPkt); |
| 1359 | pVosPkt = NULL; |
| 1360 | } |
| 1361 | return qdf_status; |
| 1362 | } |
| 1363 | |
Sreelakshmi Konamki | 6d478cd | 2017-03-28 11:59:25 +0530 | [diff] [blame] | 1364 | if (QDF_STATUS_SUCCESS != |
| 1365 | pe_drop_pending_rx_mgmt_frames(pMac, mHdr, pVosPkt)) |
| 1366 | return QDF_STATUS_E_FAILURE; |
| 1367 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1368 | /* Forward to MAC via mesg = SIR_BB_XPORT_MGMT_MSG */ |
| 1369 | msg.type = SIR_BB_XPORT_MGMT_MSG; |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 1370 | msg.bodyptr = pVosPkt; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1371 | msg.bodyval = 0; |
| 1372 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1373 | if (QDF_STATUS_SUCCESS != sys_bbt_process_message_core(pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1374 | &msg, |
| 1375 | mHdr->fc.type, |
| 1376 | mHdr->fc.subType)) { |
| 1377 | cds_pkt_return_packet(pVosPkt); |
| 1378 | pVosPkt = NULL; |
Sreelakshmi Konamki | 6d478cd | 2017-03-28 11:59:25 +0530 | [diff] [blame] | 1379 | /* |
| 1380 | * Decrement sys_bbt_pending_mgmt_count if packet |
| 1381 | * is dropped before posting to LIM |
| 1382 | */ |
| 1383 | lim_decrement_pending_mgmt_count(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1384 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1385 | } |
| 1386 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1387 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1388 | } |
| 1389 | |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 1390 | void pe_register_mgmt_rx_frm_callback(tpAniSirGlobal mac_ctx) |
| 1391 | { |
| 1392 | QDF_STATUS status; |
| 1393 | struct mgmt_txrx_mgmt_frame_cb_info frm_cb_info; |
| 1394 | |
| 1395 | frm_cb_info.frm_type = MGMT_FRAME_TYPE_ALL; |
| 1396 | frm_cb_info.mgmt_rx_cb = (mgmt_frame_rx_callback) |
| 1397 | pe_handle_mgmt_frame; |
| 1398 | |
| 1399 | status = wlan_mgmt_txrx_register_rx_cb(mac_ctx->psoc, |
| 1400 | WLAN_UMAC_COMP_MLME, &frm_cb_info, 1); |
| 1401 | if (status != QDF_STATUS_SUCCESS) |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1402 | pe_err("Registering the PE Handle with MGMT TXRX layer has failed"); |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 1403 | |
| 1404 | wma_register_mgmt_frm_client(); |
| 1405 | } |
| 1406 | |
| 1407 | void pe_deregister_mgmt_rx_frm_callback(tpAniSirGlobal mac_ctx) |
| 1408 | { |
| 1409 | QDF_STATUS status; |
| 1410 | struct mgmt_txrx_mgmt_frame_cb_info frm_cb_info; |
| 1411 | |
| 1412 | frm_cb_info.frm_type = MGMT_FRAME_TYPE_ALL; |
| 1413 | frm_cb_info.mgmt_rx_cb = (mgmt_frame_rx_callback) |
| 1414 | pe_handle_mgmt_frame; |
| 1415 | |
| 1416 | status = wlan_mgmt_txrx_deregister_rx_cb(mac_ctx->psoc, |
| 1417 | WLAN_UMAC_COMP_MLME, &frm_cb_info, 1); |
| 1418 | if (status != QDF_STATUS_SUCCESS) |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1419 | pe_err("Deregistering the PE Handle with MGMT TXRX layer has failed"); |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 1420 | |
| 1421 | wma_de_register_mgmt_frm_client(); |
| 1422 | } |
| 1423 | |
| 1424 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1425 | /** |
Naveen Rawat | 0fc3f69 | 2016-06-22 14:30:54 -0700 | [diff] [blame] | 1426 | * pe_register_callbacks_with_wma() - register SME and PE callback functions to |
| 1427 | * WMA. |
Jeff Johnson | 82b0c62 | 2016-10-07 07:53:55 -0700 | [diff] [blame] | 1428 | * (function documentation in lim_api.h) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1429 | */ |
Naveen Rawat | 0fc3f69 | 2016-06-22 14:30:54 -0700 | [diff] [blame] | 1430 | void pe_register_callbacks_with_wma(tpAniSirGlobal pMac, |
| 1431 | tSirSmeReadyReq *ready_req) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1432 | { |
Jeff Johnson | a9b6657 | 2017-09-02 12:41:21 -0700 | [diff] [blame] | 1433 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1434 | |
Jeff Johnson | a9b6657 | 2017-09-02 12:41:21 -0700 | [diff] [blame] | 1435 | status = wma_register_roaming_callbacks( |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 1436 | ready_req->csr_roam_synch_cb, |
| 1437 | ready_req->pe_roam_synch_cb); |
Jeff Johnson | a9b6657 | 2017-09-02 12:41:21 -0700 | [diff] [blame] | 1438 | if (status != QDF_STATUS_SUCCESS) |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 1439 | pe_err("Registering roaming callbacks with WMA failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1440 | } |
| 1441 | |
| 1442 | /** |
| 1443 | * lim_is_system_in_scan_state() |
| 1444 | * |
| 1445 | ***FUNCTION: |
| 1446 | * This function is called by various MAC software modules to |
| 1447 | * determine if System is in Scan/Learn state |
| 1448 | * |
| 1449 | ***LOGIC: |
| 1450 | * NA |
| 1451 | * |
| 1452 | ***ASSUMPTIONS: |
| 1453 | * NA |
| 1454 | * |
| 1455 | ***NOTE: |
| 1456 | * |
| 1457 | * @param pMac - Pointer to Global MAC structure |
| 1458 | * @return true - System is in Scan/Learn state |
| 1459 | * false - System is NOT in Scan/Learn state |
| 1460 | */ |
| 1461 | |
| 1462 | uint8_t lim_is_system_in_scan_state(tpAniSirGlobal pMac) |
| 1463 | { |
| 1464 | switch (pMac->lim.gLimSmeState) { |
| 1465 | case eLIM_SME_CHANNEL_SCAN_STATE: |
| 1466 | case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE: |
| 1467 | case eLIM_SME_LINK_EST_WT_SCAN_STATE: |
| 1468 | case eLIM_SME_WT_SCAN_STATE: |
| 1469 | /* System is in Learn mode */ |
| 1470 | return true; |
| 1471 | |
| 1472 | default: |
| 1473 | /* System is NOT in Learn mode */ |
| 1474 | return false; |
| 1475 | } |
| 1476 | } /*** end lim_is_system_in_scan_state() ***/ |
| 1477 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1478 | /** |
| 1479 | *\brief lim_received_hb_handler() |
| 1480 | * |
| 1481 | * This function is called by sch_beacon_process() upon |
| 1482 | * receiving a Beacon on STA. This also gets called upon |
| 1483 | * receiving Probe Response after heat beat failure is |
| 1484 | * detected. |
| 1485 | * |
| 1486 | * param pMac - global mac structure |
| 1487 | * param channel - channel number indicated in Beacon, Probe Response |
| 1488 | * return - none |
| 1489 | */ |
| 1490 | |
| 1491 | void |
| 1492 | lim_received_hb_handler(tpAniSirGlobal pMac, uint8_t channelId, |
| 1493 | tpPESession psessionEntry) |
| 1494 | { |
| 1495 | if ((channelId == 0) |
| 1496 | || (channelId == psessionEntry->currentOperChannel)) |
| 1497 | psessionEntry->LimRxedBeaconCntDuringHB++; |
| 1498 | |
| 1499 | psessionEntry->pmmOffloadInfo.bcnmiss = false; |
| 1500 | } /*** lim_init_wds_info_params() ***/ |
| 1501 | |
| 1502 | /** ------------------------------------------------------------- |
| 1503 | \fn lim_update_overlap_sta_param |
| 1504 | \brief Updates overlap cache and param data structure |
| 1505 | \param tpAniSirGlobal pMac |
| 1506 | \param tSirMacAddr bssId |
| 1507 | \param tpLimProtStaParams pStaParams |
| 1508 | \return None |
| 1509 | -------------------------------------------------------------*/ |
| 1510 | void |
| 1511 | lim_update_overlap_sta_param(tpAniSirGlobal pMac, tSirMacAddr bssId, |
| 1512 | tpLimProtStaParams pStaParams) |
| 1513 | { |
| 1514 | int i; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 1515 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1516 | if (!pStaParams->numSta) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1517 | qdf_mem_copy(pMac->lim.protStaOverlapCache[0].addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1518 | bssId, sizeof(tSirMacAddr)); |
| 1519 | pMac->lim.protStaOverlapCache[0].active = true; |
| 1520 | |
| 1521 | pStaParams->numSta = 1; |
| 1522 | |
| 1523 | return; |
| 1524 | } |
| 1525 | |
| 1526 | for (i = 0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++) { |
| 1527 | if (pMac->lim.protStaOverlapCache[i].active) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1528 | if (!qdf_mem_cmp |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1529 | (pMac->lim.protStaOverlapCache[i].addr, bssId, |
| 1530 | sizeof(tSirMacAddr))) { |
| 1531 | return; |
| 1532 | } |
| 1533 | } else |
| 1534 | break; |
| 1535 | } |
| 1536 | |
| 1537 | if (i == LIM_PROT_STA_OVERLAP_CACHE_SIZE) { |
Abhishek Singh | e156ea3 | 2017-05-02 17:07:30 +0530 | [diff] [blame] | 1538 | pe_debug("Overlap cache is full"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1539 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1540 | qdf_mem_copy(pMac->lim.protStaOverlapCache[i].addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1541 | bssId, sizeof(tSirMacAddr)); |
| 1542 | pMac->lim.protStaOverlapCache[i].active = true; |
| 1543 | |
| 1544 | pStaParams->numSta++; |
| 1545 | } |
| 1546 | } |
| 1547 | |
| 1548 | /** |
| 1549 | * lim_ibss_enc_type_matched |
| 1550 | * |
| 1551 | ***FUNCTION: |
| 1552 | * This function compares the encryption type of the peer with self |
| 1553 | * while operating in IBSS mode and detects mismatch. |
| 1554 | * |
| 1555 | ***LOGIC: |
| 1556 | * |
| 1557 | ***ASSUMPTIONS: |
| 1558 | * |
| 1559 | ***NOTE: |
| 1560 | * |
| 1561 | * @param pBeacon - Parsed Beacon Frame structure |
| 1562 | * @param pSession - Pointer to the PE session |
| 1563 | * |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 1564 | * @return true if encryption type is matched; false otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1565 | */ |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 1566 | static bool lim_ibss_enc_type_matched(tpSchBeaconStruct pBeacon, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1567 | tpPESession pSession) |
| 1568 | { |
| 1569 | if (!pBeacon || !pSession) |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 1570 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1571 | |
| 1572 | /* Open case */ |
| 1573 | if (pBeacon->capabilityInfo.privacy == 0 |
| 1574 | && pSession->encryptType == eSIR_ED_NONE) |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 1575 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1576 | |
| 1577 | /* WEP case */ |
| 1578 | if (pBeacon->capabilityInfo.privacy == 1 && pBeacon->wpaPresent == 0 |
| 1579 | && pBeacon->rsnPresent == 0 |
| 1580 | && (pSession->encryptType == eSIR_ED_WEP40 |
| 1581 | || pSession->encryptType == eSIR_ED_WEP104)) |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 1582 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1583 | |
| 1584 | /* WPA-None case */ |
| 1585 | if (pBeacon->capabilityInfo.privacy == 1 && pBeacon->wpaPresent == 1 |
| 1586 | && pBeacon->rsnPresent == 0 |
| 1587 | && ((pSession->encryptType == eSIR_ED_CCMP) || |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 1588 | (pSession->encryptType == eSIR_ED_GCMP) || |
| 1589 | (pSession->encryptType == eSIR_ED_GCMP_256) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1590 | (pSession->encryptType == eSIR_ED_TKIP))) |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 1591 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1592 | |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 1593 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1594 | } |
| 1595 | |
| 1596 | /** |
| 1597 | * lim_handle_ibs_scoalescing() |
| 1598 | * |
| 1599 | ***FUNCTION: |
| 1600 | * This function is called upon receiving Beacon/Probe Response |
| 1601 | * while operating in IBSS mode. |
| 1602 | * |
| 1603 | ***LOGIC: |
| 1604 | * |
| 1605 | ***ASSUMPTIONS: |
| 1606 | * |
| 1607 | ***NOTE: |
| 1608 | * |
| 1609 | * @param pMac - Pointer to Global MAC structure |
| 1610 | * @param pBeacon - Parsed Beacon Frame structure |
| 1611 | * @param pRxPacketInfo - Pointer to RX packet info structure |
| 1612 | * |
| 1613 | * @return Status whether to process or ignore received Beacon Frame |
| 1614 | */ |
| 1615 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1616 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1617 | lim_handle_ibss_coalescing(tpAniSirGlobal pMac, |
| 1618 | tpSchBeaconStruct pBeacon, |
| 1619 | uint8_t *pRxPacketInfo, tpPESession psessionEntry) |
| 1620 | { |
| 1621 | tpSirMacMgmtHdr pHdr; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1622 | QDF_STATUS retCode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1623 | |
| 1624 | pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 1625 | |
| 1626 | /* Ignore the beacon when any of the conditions below is met: |
| 1627 | 1. The beacon claims no IBSS network |
| 1628 | 2. SSID in the beacon does not match SSID of self station |
| 1629 | 3. Operational channel in the beacon does not match self station |
| 1630 | 4. Encyption type in the beacon does not match with self station |
| 1631 | */ |
| 1632 | if ((!pBeacon->capabilityInfo.ibss) || |
Ankit Gupta | d66a881 | 2016-09-15 11:00:16 -0700 | [diff] [blame] | 1633 | lim_cmp_ssid(&pBeacon->ssId, psessionEntry) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1634 | (psessionEntry->currentOperChannel != pBeacon->channelNumber)) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1635 | retCode = QDF_STATUS_E_INVAL; |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 1636 | else if (lim_ibss_enc_type_matched(pBeacon, psessionEntry) != true) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 1637 | pe_debug("peer privacy: %d peer wpa: %d peer rsn: %d self encType: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1638 | pBeacon->capabilityInfo.privacy, |
| 1639 | pBeacon->wpaPresent, pBeacon->rsnPresent, |
| 1640 | psessionEntry->encryptType); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1641 | retCode = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1642 | } else { |
| 1643 | uint32_t ieLen; |
| 1644 | uint16_t tsfLater; |
| 1645 | uint8_t *pIEs; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 1646 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1647 | ieLen = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
| 1648 | tsfLater = WMA_GET_RX_TSF_LATER(pRxPacketInfo); |
| 1649 | pIEs = WMA_GET_RX_MPDU_DATA(pRxPacketInfo); |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 1650 | pe_debug("BEFORE Coalescing tsfLater val: %d", tsfLater); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1651 | retCode = |
| 1652 | lim_ibss_coalesce(pMac, pHdr, pBeacon, pIEs, ieLen, tsfLater, |
| 1653 | psessionEntry); |
| 1654 | } |
| 1655 | return retCode; |
| 1656 | } /*** end lim_handle_ibs_scoalescing() ***/ |
| 1657 | |
| 1658 | /** |
| 1659 | * lim_enc_type_matched() - matches security type of incoming beracon with |
| 1660 | * current |
| 1661 | * @mac_ctx Pointer to Global MAC structure |
| 1662 | * @bcn Pointer to parsed Beacon structure |
| 1663 | * @session PE session entry |
| 1664 | * |
| 1665 | * This function matches security type of incoming beracon with current |
| 1666 | * |
| 1667 | * @return true if matched, false otherwise |
| 1668 | */ |
| 1669 | static bool |
| 1670 | lim_enc_type_matched(tpAniSirGlobal mac_ctx, |
| 1671 | tpSchBeaconStruct bcn, |
| 1672 | tpPESession session) |
| 1673 | { |
| 1674 | if (!bcn || !session) |
| 1675 | return false; |
| 1676 | |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 1677 | pe_debug("Beacon/Probe:: Privacy: %d WPA Present: %d RSN Present: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1678 | bcn->capabilityInfo.privacy, bcn->wpaPresent, bcn->rsnPresent); |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 1679 | pe_debug("session:: Privacy: %d EncyptionType: %d OSEN: %d WPS: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1680 | SIR_MAC_GET_PRIVACY(session->limCurrentBssCaps), |
Abhishek Singh | f78bd2d | 2016-04-27 16:47:56 +0530 | [diff] [blame] | 1681 | session->encryptType, session->isOSENConnection, |
| 1682 | session->wps_registration); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1683 | |
| 1684 | /* |
| 1685 | * This is handled by sending probe req due to IOT issues so |
| 1686 | * return TRUE |
| 1687 | */ |
| 1688 | if ((bcn->capabilityInfo.privacy) != |
| 1689 | SIR_MAC_GET_PRIVACY(session->limCurrentBssCaps)) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 1690 | pe_warn("Privacy bit miss match"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1691 | return true; |
| 1692 | } |
| 1693 | |
| 1694 | /* Open */ |
| 1695 | if ((bcn->capabilityInfo.privacy == 0) && |
| 1696 | (session->encryptType == eSIR_ED_NONE)) |
| 1697 | return true; |
| 1698 | |
| 1699 | /* WEP */ |
| 1700 | if ((bcn->capabilityInfo.privacy == 1) && |
| 1701 | (bcn->wpaPresent == 0) && (bcn->rsnPresent == 0) && |
| 1702 | ((session->encryptType == eSIR_ED_WEP40) || |
| 1703 | (session->encryptType == eSIR_ED_WEP104) |
| 1704 | #ifdef FEATURE_WLAN_WAPI |
| 1705 | || (session->encryptType == eSIR_ED_WPI) |
| 1706 | #endif |
| 1707 | )) |
| 1708 | return true; |
| 1709 | |
| 1710 | /* WPA OR RSN*/ |
| 1711 | if ((bcn->capabilityInfo.privacy == 1) && |
| 1712 | ((bcn->wpaPresent == 1) || (bcn->rsnPresent == 1)) && |
| 1713 | ((session->encryptType == eSIR_ED_TKIP) || |
| 1714 | (session->encryptType == eSIR_ED_CCMP) || |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 1715 | (session->encryptType == eSIR_ED_GCMP) || |
| 1716 | (session->encryptType == eSIR_ED_GCMP_256) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1717 | (session->encryptType == eSIR_ED_AES_128_CMAC))) |
| 1718 | return true; |
| 1719 | |
Abhishek Singh | f78bd2d | 2016-04-27 16:47:56 +0530 | [diff] [blame] | 1720 | /* |
| 1721 | * For HS2.0, RSN ie is not present |
Abhishek Singh | 4560fa0 | 2016-08-29 12:45:38 +0530 | [diff] [blame] | 1722 | * in beacon. Therefore no need to |
| 1723 | * check for security type in case |
| 1724 | * OSEN session. |
Abhishek Singh | f78bd2d | 2016-04-27 16:47:56 +0530 | [diff] [blame] | 1725 | * For WPS registration session no need to detect |
| 1726 | * detect security mismatch as it wont match and |
| 1727 | * driver may end up sending probe request without |
| 1728 | * WPS IE during WPS registration process. |
Abhishek Singh | 4560fa0 | 2016-08-29 12:45:38 +0530 | [diff] [blame] | 1729 | */ |
Abhishek Singh | f78bd2d | 2016-04-27 16:47:56 +0530 | [diff] [blame] | 1730 | if (session->isOSENConnection || |
| 1731 | session->wps_registration) |
Abhishek Singh | 4560fa0 | 2016-08-29 12:45:38 +0530 | [diff] [blame] | 1732 | return true; |
| 1733 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1734 | return false; |
| 1735 | } |
| 1736 | |
| 1737 | /** |
| 1738 | * lim_detect_change_in_ap_capabilities() |
| 1739 | * |
| 1740 | ***FUNCTION: |
| 1741 | * This function is called while SCH is processing |
| 1742 | * received Beacon from AP on STA to detect any |
| 1743 | * change in AP's capabilities. If there any change |
| 1744 | * is detected, Roaming is informed of such change |
| 1745 | * so that it can trigger reassociation. |
| 1746 | * |
| 1747 | ***LOGIC: |
| 1748 | * |
| 1749 | ***ASSUMPTIONS: |
| 1750 | * |
| 1751 | ***NOTE: |
| 1752 | * Notification is enabled for STA product only since |
| 1753 | * it is not a requirement on BP side. |
| 1754 | * |
| 1755 | * @param pMac Pointer to Global MAC structure |
| 1756 | * @param pBeacon Pointer to parsed Beacon structure |
| 1757 | * @return None |
| 1758 | */ |
| 1759 | |
| 1760 | void |
| 1761 | lim_detect_change_in_ap_capabilities(tpAniSirGlobal pMac, |
| 1762 | tpSirProbeRespBeacon pBeacon, |
| 1763 | tpPESession psessionEntry) |
| 1764 | { |
| 1765 | uint8_t len; |
| 1766 | tSirSmeApNewCaps apNewCaps; |
| 1767 | uint8_t newChannel; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1768 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1769 | bool security_caps_matched = true; |
| 1770 | |
| 1771 | apNewCaps.capabilityInfo = |
| 1772 | lim_get_u16((uint8_t *) &pBeacon->capabilityInfo); |
| 1773 | newChannel = (uint8_t) pBeacon->channelNumber; |
| 1774 | |
| 1775 | security_caps_matched = lim_enc_type_matched(pMac, pBeacon, |
| 1776 | psessionEntry); |
| 1777 | if ((false == psessionEntry->limSentCapsChangeNtf) && |
| 1778 | (((!lim_is_null_ssid(&pBeacon->ssId)) && |
Ankit Gupta | d66a881 | 2016-09-15 11:00:16 -0700 | [diff] [blame] | 1779 | lim_cmp_ssid(&pBeacon->ssId, psessionEntry)) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1780 | ((SIR_MAC_GET_ESS(apNewCaps.capabilityInfo) != |
| 1781 | SIR_MAC_GET_ESS(psessionEntry->limCurrentBssCaps)) || |
| 1782 | (SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) != |
| 1783 | SIR_MAC_GET_PRIVACY(psessionEntry->limCurrentBssCaps)) || |
| 1784 | (SIR_MAC_GET_SHORT_PREAMBLE(apNewCaps.capabilityInfo) != |
| 1785 | SIR_MAC_GET_SHORT_PREAMBLE(psessionEntry->limCurrentBssCaps)) || |
| 1786 | (SIR_MAC_GET_QOS(apNewCaps.capabilityInfo) != |
| 1787 | SIR_MAC_GET_QOS(psessionEntry->limCurrentBssCaps)) || |
| 1788 | ((newChannel != psessionEntry->currentOperChannel) && |
| 1789 | (newChannel != 0)) || |
| 1790 | (false == security_caps_matched) |
| 1791 | ))) { |
| 1792 | if (false == psessionEntry->fWaitForProbeRsp) { |
| 1793 | /* If Beacon capabilities is not matching with the current capability, |
| 1794 | * then send unicast probe request to AP and take decision after |
| 1795 | * receiving probe response */ |
| 1796 | if (true == psessionEntry->fIgnoreCapsChange) { |
Arif Hussain | 458ad46 | 2018-05-11 11:14:38 -0700 | [diff] [blame] | 1797 | pe_debug("Ignoring the Capability change as it is false alarm"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1798 | return; |
| 1799 | } |
| 1800 | psessionEntry->fWaitForProbeRsp = true; |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 1801 | pe_warn("AP capabilities are not matching, sending directed probe request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1802 | status = |
| 1803 | lim_send_probe_req_mgmt_frame(pMac, &psessionEntry->ssId, |
Sandeep Puligilla | 06ae890 | 2018-04-16 19:02:47 -0700 | [diff] [blame] | 1804 | psessionEntry->bssId, |
| 1805 | psessionEntry->currentOperChannel, |
| 1806 | psessionEntry->selfMacAddr, |
| 1807 | psessionEntry->dot11mode, |
| 1808 | NULL, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1809 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1810 | if (QDF_STATUS_SUCCESS != status) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 1811 | pe_err("send ProbeReq failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1812 | psessionEntry->fWaitForProbeRsp = false; |
| 1813 | } |
| 1814 | return; |
| 1815 | } |
| 1816 | /** |
| 1817 | * BSS capabilities have changed. |
| 1818 | * Inform Roaming. |
| 1819 | */ |
| 1820 | len = sizeof(tSirMacCapabilityInfo) + sizeof(tSirMacAddr) + sizeof(uint8_t) + 3 * sizeof(uint8_t) + /* reserved fields */ |
| 1821 | pBeacon->ssId.length + 1; |
| 1822 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1823 | qdf_mem_copy(apNewCaps.bssId.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1824 | psessionEntry->bssId, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1825 | if (newChannel != psessionEntry->currentOperChannel) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 1826 | pe_err("Channel Change from %d --> %d Ignoring beacon!", |
Nishank Aggarwal | 8d4c720 | 2017-03-10 13:13:54 +0530 | [diff] [blame] | 1827 | psessionEntry->currentOperChannel, newChannel); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1828 | return; |
| 1829 | } |
| 1830 | |
| 1831 | /** |
| 1832 | * When Cisco 1262 Enterprise APs are configured with WPA2-PSK with |
| 1833 | * AES+TKIP Pairwise ciphers and WEP-40 Group cipher, they do not set |
| 1834 | * the privacy bit in Beacons (wpa/rsnie is still present in beacons), |
| 1835 | * the privacy bit is set in Probe and association responses. |
| 1836 | * Due to this anomaly, we detect a change in |
| 1837 | * AP capabilities when we receive a beacon after association and |
| 1838 | * disconnect from the AP. The following check makes sure that we can |
| 1839 | * connect to such APs |
| 1840 | */ |
| 1841 | else if ((SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) == 0) && |
| 1842 | (pBeacon->rsnPresent || pBeacon->wpaPresent)) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 1843 | pe_err("BSS Caps (Privacy) bit 0 in beacon, but WPA or RSN IE present, Ignore Beacon!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1844 | return; |
| 1845 | } else |
| 1846 | apNewCaps.channelId = psessionEntry->currentOperChannel; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1847 | qdf_mem_copy((uint8_t *) &apNewCaps.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1848 | (uint8_t *) &pBeacon->ssId, |
| 1849 | pBeacon->ssId.length + 1); |
| 1850 | |
| 1851 | psessionEntry->fIgnoreCapsChange = false; |
| 1852 | psessionEntry->fWaitForProbeRsp = false; |
| 1853 | psessionEntry->limSentCapsChangeNtf = true; |
| 1854 | lim_send_sme_wm_status_change_ntf(pMac, eSIR_SME_AP_CAPS_CHANGED, |
| 1855 | (uint32_t *) &apNewCaps, |
| 1856 | len, psessionEntry->smeSessionId); |
| 1857 | } else if (true == psessionEntry->fWaitForProbeRsp) { |
| 1858 | /* Only for probe response frames and matching capabilities the control |
| 1859 | * will come here. If beacon is with broadcast ssid then fWaitForProbeRsp |
| 1860 | * will be false, the control will not come here*/ |
| 1861 | |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 1862 | pe_debug("capabilities in probe response are" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1863 | "matching with the current setting," |
| 1864 | "Ignoring subsequent capability" |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 1865 | "mismatch"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1866 | psessionEntry->fIgnoreCapsChange = true; |
| 1867 | psessionEntry->fWaitForProbeRsp = false; |
| 1868 | } |
| 1869 | |
| 1870 | } /*** lim_detect_change_in_ap_capabilities() ***/ |
| 1871 | |
| 1872 | /* --------------------------------------------------------------------- */ |
| 1873 | /** |
| 1874 | * lim_update_short_slot |
| 1875 | * |
| 1876 | * FUNCTION: |
| 1877 | * Enable/Disable short slot |
| 1878 | * |
| 1879 | * LOGIC: |
| 1880 | * |
| 1881 | * ASSUMPTIONS: |
| 1882 | * |
| 1883 | * NOTE: |
| 1884 | * |
| 1885 | * @param enable Flag to enable/disable short slot |
| 1886 | * @return None |
| 1887 | */ |
| 1888 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1889 | QDF_STATUS lim_update_short_slot(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1890 | tpSirProbeRespBeacon pBeacon, |
| 1891 | tpUpdateBeaconParams pBeaconParams, |
| 1892 | tpPESession psessionEntry) |
| 1893 | { |
| 1894 | |
| 1895 | tSirSmeApNewCaps apNewCaps; |
| 1896 | uint32_t nShortSlot; |
| 1897 | uint32_t val = 0; |
| 1898 | uint32_t phyMode; |
| 1899 | |
| 1900 | /* Check Admin mode first. If it is disabled just return */ |
| 1901 | if (wlan_cfg_get_int(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1902 | != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 1903 | pe_err("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1904 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1905 | } |
| 1906 | if (val == false) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1907 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1908 | |
| 1909 | /* Check for 11a mode or 11b mode. In both cases return since slot time is constant and cannot/should not change in beacon */ |
| 1910 | lim_get_phy_mode(pMac, &phyMode, psessionEntry); |
| 1911 | if ((phyMode == WNI_CFG_PHY_MODE_11A) |
| 1912 | || (phyMode == WNI_CFG_PHY_MODE_11B)) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1913 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1914 | |
| 1915 | apNewCaps.capabilityInfo = |
| 1916 | lim_get_u16((uint8_t *) &pBeacon->capabilityInfo); |
| 1917 | |
| 1918 | /* Earlier implementation: determine the appropriate short slot mode based on AP advertised modes */ |
| 1919 | /* when erp is present, apply short slot always unless, prot=on && shortSlot=off */ |
| 1920 | /* if no erp present, use short slot based on current ap caps */ |
| 1921 | |
| 1922 | /* Issue with earlier implementation : Cisco 1231 BG has shortSlot = 0, erpIEPresent and useProtection = 0 (Case4); */ |
| 1923 | |
| 1924 | /* Resolution : always use the shortSlot setting the capability info to decide slot time. */ |
| 1925 | /* The difference between the earlier implementation and the new one is only Case4. */ |
| 1926 | /* |
| 1927 | ERP IE Present | useProtection | shortSlot = QC STA Short Slot |
| 1928 | Case1 1 1 1 1 //AP should not advertise this combination. |
| 1929 | Case2 1 1 0 0 |
| 1930 | Case3 1 0 1 1 |
| 1931 | Case4 1 0 0 0 |
| 1932 | Case5 0 1 1 1 |
| 1933 | Case6 0 1 0 0 |
| 1934 | Case7 0 0 1 1 |
| 1935 | Case8 0 0 0 0 |
| 1936 | */ |
| 1937 | nShortSlot = SIR_MAC_GET_SHORT_SLOT_TIME(apNewCaps.capabilityInfo); |
| 1938 | |
| 1939 | if (nShortSlot != psessionEntry->shortSlotTimeSupported) { |
| 1940 | /* Short slot time capability of AP has changed. Adopt to it. */ |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 1941 | pe_debug("Shortslot capability of AP changed: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1942 | nShortSlot); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1943 | ((tpSirMacCapabilityInfo) & psessionEntry-> |
| 1944 | limCurrentBssCaps)->shortSlotTime = (uint16_t) nShortSlot; |
| 1945 | psessionEntry->shortSlotTimeSupported = nShortSlot; |
| 1946 | pBeaconParams->fShortSlotTime = (uint8_t) nShortSlot; |
| 1947 | pBeaconParams->paramChangeBitmap |= |
| 1948 | PARAM_SHORT_SLOT_TIME_CHANGED; |
| 1949 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1950 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1951 | } |
| 1952 | |
| 1953 | |
Jeff Johnson | c9f4462 | 2018-06-29 14:18:53 -0700 | [diff] [blame] | 1954 | void lim_send_heart_beat_timeout_ind(tpAniSirGlobal pMac, |
| 1955 | tpPESession psessionEntry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1956 | { |
Jeff Johnson | c9f4462 | 2018-06-29 14:18:53 -0700 | [diff] [blame] | 1957 | QDF_STATUS status; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 1958 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1959 | |
| 1960 | /* Prepare and post message to LIM Message Queue */ |
| 1961 | msg.type = (uint16_t) SIR_LIM_HEART_BEAT_TIMEOUT; |
| 1962 | msg.bodyptr = psessionEntry; |
| 1963 | msg.bodyval = 0; |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 1964 | pe_err("Heartbeat failure from Fw"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1965 | |
Jeff Johnson | c9f4462 | 2018-06-29 14:18:53 -0700 | [diff] [blame] | 1966 | status = lim_post_msg_api(pMac, &msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1967 | |
Jeff Johnson | c9f4462 | 2018-06-29 14:18:53 -0700 | [diff] [blame] | 1968 | if (status != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 1969 | pe_err("posting message: %X to LIM failed, reason: %d", |
Jeff Johnson | c9f4462 | 2018-06-29 14:18:53 -0700 | [diff] [blame] | 1970 | msg.type, status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1971 | } |
| 1972 | } |
| 1973 | |
| 1974 | /** |
| 1975 | * lim_ps_offload_handle_missed_beacon_ind(): handles missed beacon indication |
| 1976 | * @pMac : global mac context |
| 1977 | * @pMsg: message |
| 1978 | * |
| 1979 | * This function process the SIR_HAL_MISSED_BEACON_IND |
| 1980 | * message from HAL, to do active AP probing. |
| 1981 | * |
| 1982 | * Return: void |
| 1983 | */ |
Rajeev Kumar | feb9638 | 2017-01-22 19:42:09 -0800 | [diff] [blame] | 1984 | void lim_ps_offload_handle_missed_beacon_ind(tpAniSirGlobal pMac, |
| 1985 | struct scheduler_msg *pMsg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1986 | { |
| 1987 | tpSirSmeMissedBeaconInd pSirMissedBeaconInd = |
| 1988 | (tpSirSmeMissedBeaconInd) pMsg->bodyptr; |
| 1989 | tpPESession psessionEntry = |
| 1990 | pe_find_session_by_bss_idx(pMac, pSirMissedBeaconInd->bssIdx); |
| 1991 | |
| 1992 | if (!psessionEntry) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 1993 | pe_err("session does not exist for given BSSId"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1994 | return; |
| 1995 | } |
| 1996 | |
| 1997 | /* Set Beacon Miss in Powersave Offload */ |
| 1998 | psessionEntry->pmmOffloadInfo.bcnmiss = true; |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 1999 | pe_err("Received Heart Beat Failure"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2000 | |
| 2001 | /* Do AP probing immediately */ |
| 2002 | lim_send_heart_beat_timeout_ind(pMac, psessionEntry); |
| 2003 | return; |
| 2004 | } |
| 2005 | |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2006 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 2007 | /** |
| 2008 | * lim_fill_join_rsp_ht_caps() - Fill the HT caps in join response |
| 2009 | * @session: PE Session |
| 2010 | * @join_rsp: Join response buffer to be filled up. |
| 2011 | * |
| 2012 | * Return: None |
| 2013 | */ |
| 2014 | void lim_fill_join_rsp_ht_caps(tpPESession session, tpSirSmeJoinRsp join_rsp) |
| 2015 | { |
| 2016 | tSirSmeHTProfile *ht_profile; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 2017 | |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2018 | if (session == NULL) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2019 | pe_err("Invalid Session"); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2020 | return; |
| 2021 | } |
| 2022 | if (join_rsp == NULL) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2023 | pe_err("Invalid Join Response"); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2024 | return; |
| 2025 | } |
Chandrasekaran Manishekar | 068e25e | 2016-03-07 11:51:07 +0530 | [diff] [blame] | 2026 | |
| 2027 | if (session->cc_switch_mode == QDF_MCC_TO_SCC_SWITCH_DISABLE) |
| 2028 | return; |
| 2029 | |
| 2030 | ht_profile = &join_rsp->HTProfile; |
| 2031 | ht_profile->htSupportedChannelWidthSet = |
| 2032 | session->htSupportedChannelWidthSet; |
| 2033 | ht_profile->htRecommendedTxWidthSet = |
| 2034 | session->htRecommendedTxWidthSet; |
| 2035 | ht_profile->htSecondaryChannelOffset = |
| 2036 | session->htSecondaryChannelOffset; |
| 2037 | ht_profile->dot11mode = session->dot11mode; |
| 2038 | ht_profile->htCapability = session->htCapability; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2039 | ht_profile->vhtCapability = session->vhtCapability; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2040 | ht_profile->apCenterChan = session->ch_center_freq_seg0; |
| 2041 | ht_profile->apChanWidth = session->ch_width; |
| 2042 | } |
| 2043 | #endif |
| 2044 | |
Krunal Soni | 4bfecf6 | 2017-06-05 15:26:35 -0700 | [diff] [blame] | 2045 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Selvaraj, Sridhar | 6f97f41 | 2017-05-26 19:32:05 +0530 | [diff] [blame] | 2046 | /** |
| 2047 | * sir_parse_bcn_fixed_fields() - Parse fixed fields in Beacon IE's |
| 2048 | * |
| 2049 | * @mac_ctx: MAC Context |
| 2050 | * @beacon_struct: Beacon/Probe Response structure |
| 2051 | * @buf: Fixed Fields buffer |
| 2052 | */ |
| 2053 | static void sir_parse_bcn_fixed_fields(tpAniSirGlobal mac_ctx, |
| 2054 | tpSirProbeRespBeacon beacon_struct, |
| 2055 | uint8_t *buf) |
| 2056 | { |
| 2057 | tDot11fFfCapabilities dst; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 2058 | |
Selvaraj, Sridhar | 6f97f41 | 2017-05-26 19:32:05 +0530 | [diff] [blame] | 2059 | beacon_struct->timeStamp[0] = lim_get_u32(buf); |
| 2060 | beacon_struct->timeStamp[1] = lim_get_u32(buf + 4); |
| 2061 | buf += 8; |
| 2062 | |
| 2063 | beacon_struct->beaconInterval = lim_get_u16(buf); |
| 2064 | buf += 2; |
| 2065 | |
| 2066 | dot11f_unpack_ff_capabilities(mac_ctx, buf, &dst); |
| 2067 | |
| 2068 | sir_copy_caps_info(mac_ctx, dst, beacon_struct); |
| 2069 | } |
| 2070 | |
Jeff Johnson | 82b0c62 | 2016-10-07 07:53:55 -0700 | [diff] [blame] | 2071 | static QDF_STATUS |
| 2072 | lim_roam_fill_bss_descr(tpAniSirGlobal pMac, |
| 2073 | roam_offload_synch_ind *roam_offload_synch_ind_ptr, |
| 2074 | tpSirBssDescription bss_desc_ptr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2075 | { |
| 2076 | uint32_t ie_len = 0; |
| 2077 | tpSirProbeRespBeacon parsed_frm_ptr; |
| 2078 | tpSirMacMgmtHdr mac_hdr; |
| 2079 | uint8_t *bcn_proberesp_ptr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2080 | |
| 2081 | bcn_proberesp_ptr = (uint8_t *)roam_offload_synch_ind_ptr + |
| 2082 | roam_offload_synch_ind_ptr->beaconProbeRespOffset; |
| 2083 | mac_hdr = (tpSirMacMgmtHdr)bcn_proberesp_ptr; |
| 2084 | parsed_frm_ptr = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2085 | (tpSirProbeRespBeacon) qdf_mem_malloc(sizeof(tSirProbeRespBeacon)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2086 | if (NULL == parsed_frm_ptr) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2087 | pe_err("fail to allocate memory for frame"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2088 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2089 | } |
| 2090 | |
| 2091 | if (roam_offload_synch_ind_ptr->beaconProbeRespLength <= |
| 2092 | SIR_MAC_HDR_LEN_3A) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2093 | pe_err("%s: very few bytes in synchInd beacon / probe resp frame! length: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2094 | __func__, roam_offload_synch_ind_ptr->beaconProbeRespLength); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2095 | qdf_mem_free(parsed_frm_ptr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2096 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2097 | } |
| 2098 | |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2099 | pe_debug("LFR3:Beacon/Prb Rsp: %d", roam_offload_synch_ind_ptr->isBeacon); |
Nishank Aggarwal | 8d4c720 | 2017-03-10 13:13:54 +0530 | [diff] [blame] | 2100 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2101 | bcn_proberesp_ptr, roam_offload_synch_ind_ptr->beaconProbeRespLength); |
| 2102 | if (roam_offload_synch_ind_ptr->isBeacon) { |
| 2103 | if (sir_parse_beacon_ie(pMac, parsed_frm_ptr, |
| 2104 | &bcn_proberesp_ptr[SIR_MAC_HDR_LEN_3A + |
| 2105 | SIR_MAC_B_PR_SSID_OFFSET], |
| 2106 | roam_offload_synch_ind_ptr->beaconProbeRespLength - |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2107 | SIR_MAC_HDR_LEN_3A) != QDF_STATUS_SUCCESS || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2108 | !parsed_frm_ptr->ssidPresent) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2109 | pe_err("Parse error Beacon, length: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2110 | roam_offload_synch_ind_ptr->beaconProbeRespLength); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2111 | qdf_mem_free(parsed_frm_ptr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2112 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2113 | } |
| 2114 | } else { |
| 2115 | if (sir_convert_probe_frame2_struct(pMac, |
| 2116 | &bcn_proberesp_ptr[SIR_MAC_HDR_LEN_3A], |
| 2117 | roam_offload_synch_ind_ptr->beaconProbeRespLength - |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2118 | SIR_MAC_HDR_LEN_3A, parsed_frm_ptr) != QDF_STATUS_SUCCESS || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2119 | !parsed_frm_ptr->ssidPresent) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2120 | pe_err("Parse error ProbeResponse, length: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2121 | roam_offload_synch_ind_ptr->beaconProbeRespLength); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2122 | qdf_mem_free(parsed_frm_ptr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2123 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2124 | } |
| 2125 | } |
Selvaraj, Sridhar | 6f97f41 | 2017-05-26 19:32:05 +0530 | [diff] [blame] | 2126 | |
| 2127 | /* |
| 2128 | * For probe response, unpack core parses beacon interval, capabilities, |
| 2129 | * timestamp. For beacon IEs, these fields are not parsed. |
| 2130 | */ |
| 2131 | if (roam_offload_synch_ind_ptr->isBeacon) |
| 2132 | sir_parse_bcn_fixed_fields(pMac, parsed_frm_ptr, |
| 2133 | &bcn_proberesp_ptr[SIR_MAC_HDR_LEN_3A]); |
| 2134 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2135 | /* 24 byte MAC header and 12 byte to ssid IE */ |
| 2136 | if (roam_offload_synch_ind_ptr->beaconProbeRespLength > |
| 2137 | (SIR_MAC_HDR_LEN_3A + SIR_MAC_B_PR_SSID_OFFSET)) { |
| 2138 | ie_len = roam_offload_synch_ind_ptr->beaconProbeRespLength - |
| 2139 | (SIR_MAC_HDR_LEN_3A + SIR_MAC_B_PR_SSID_OFFSET); |
| 2140 | } |
| 2141 | /* |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2142 | * Length of BSS desription is without length of |
| 2143 | * length itself and length of pointer |
| 2144 | * that holds ieFields |
| 2145 | * |
| 2146 | * tSirBssDescription |
| 2147 | * +--------+---------------------------------+---------------+ |
| 2148 | * | length | other fields | pointer to IEs| |
| 2149 | * +--------+---------------------------------+---------------+ |
| 2150 | * ^ |
| 2151 | * ieFields |
| 2152 | */ |
| 2153 | bss_desc_ptr->length = (uint16_t) (offsetof(tSirBssDescription, |
| 2154 | ieFields[0]) - |
| 2155 | sizeof(bss_desc_ptr->length) + ie_len); |
| 2156 | |
Abhishek Singh | c4a864b | 2017-04-17 17:09:52 +0530 | [diff] [blame] | 2157 | bss_desc_ptr->fProbeRsp = !roam_offload_synch_ind_ptr->isBeacon; |
| 2158 | /* Copy Timestamp */ |
| 2159 | bss_desc_ptr->scansystimensec = qdf_get_monotonic_boottime_ns(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2160 | if (parsed_frm_ptr->dsParamsPresent) { |
| 2161 | bss_desc_ptr->channelId = parsed_frm_ptr->channelNumber; |
| 2162 | } else if (parsed_frm_ptr->HTInfo.present) { |
| 2163 | bss_desc_ptr->channelId = parsed_frm_ptr->HTInfo.primaryChannel; |
| 2164 | } else { |
| 2165 | /* |
| 2166 | * If DS Params or HTIE is not present in the probe resp or |
| 2167 | * beacon, then use the channel frequency provided by firmware |
| 2168 | * to fill the channel in the BSS descriptor.*/ |
| 2169 | bss_desc_ptr->channelId = |
| 2170 | cds_freq_to_chan(roam_offload_synch_ind_ptr->chan_freq); |
| 2171 | } |
| 2172 | bss_desc_ptr->channelIdSelf = bss_desc_ptr->channelId; |
| 2173 | |
Abhishek Singh | 86dc221 | 2017-11-08 13:57:46 +0530 | [diff] [blame] | 2174 | bss_desc_ptr->nwType = lim_get_nw_type(pMac, bss_desc_ptr->channelId, |
| 2175 | SIR_MAC_MGMT_FRAME, |
| 2176 | parsed_frm_ptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2177 | |
| 2178 | bss_desc_ptr->sinr = 0; |
| 2179 | bss_desc_ptr->beaconInterval = parsed_frm_ptr->beaconInterval; |
| 2180 | bss_desc_ptr->timeStamp[0] = parsed_frm_ptr->timeStamp[0]; |
| 2181 | bss_desc_ptr->timeStamp[1] = parsed_frm_ptr->timeStamp[1]; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2182 | qdf_mem_copy(&bss_desc_ptr->capabilityInfo, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2183 | &bcn_proberesp_ptr[SIR_MAC_HDR_LEN_3A + SIR_MAC_B_PR_CAPAB_OFFSET], 2); |
Abhishek Singh | e9a1701 | 2017-07-13 16:38:44 +0530 | [diff] [blame] | 2184 | |
| 2185 | if (qdf_is_macaddr_zero((struct qdf_mac_addr *)mac_hdr->bssId)) { |
| 2186 | pe_debug("bssid is 0 in beacon/probe update it with bssId %pM in sync ind", |
| 2187 | roam_offload_synch_ind_ptr->bssid.bytes); |
| 2188 | qdf_mem_copy(mac_hdr->bssId, |
| 2189 | roam_offload_synch_ind_ptr->bssid.bytes, |
| 2190 | sizeof(tSirMacAddr)); |
| 2191 | } |
| 2192 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2193 | qdf_mem_copy((uint8_t *) &bss_desc_ptr->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2194 | (uint8_t *) mac_hdr->bssId, |
| 2195 | sizeof(tSirMacAddr)); |
Deepthi Gowri | 6acee34 | 2016-10-28 15:00:38 +0530 | [diff] [blame] | 2196 | bss_desc_ptr->received_time = |
| 2197 | (uint64_t)qdf_mc_timer_get_system_time(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2198 | if (parsed_frm_ptr->mdiePresent) { |
| 2199 | bss_desc_ptr->mdiePresent = parsed_frm_ptr->mdiePresent; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2200 | qdf_mem_copy((uint8_t *)bss_desc_ptr->mdie, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2201 | (uint8_t *)parsed_frm_ptr->mdie, |
| 2202 | SIR_MDIE_SIZE); |
| 2203 | } |
Srinivas Girigowda | 6598eea | 2017-07-06 19:26:19 -0700 | [diff] [blame] | 2204 | pe_debug("LFR3: BssDescr Info:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2205 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2206 | bss_desc_ptr->bssId, sizeof(tSirMacAddr)); |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2207 | pe_debug("chan: %d rssi: %d", bss_desc_ptr->channelId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2208 | bss_desc_ptr->rssi); |
| 2209 | if (ie_len) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2210 | qdf_mem_copy(&bss_desc_ptr->ieFields, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2211 | bcn_proberesp_ptr + |
| 2212 | (SIR_MAC_HDR_LEN_3A + SIR_MAC_B_PR_SSID_OFFSET), |
| 2213 | ie_len); |
| 2214 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2215 | qdf_mem_free(parsed_frm_ptr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2216 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2217 | } |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2218 | |
| 2219 | #if defined(WLAN_FEATURE_FILS_SK) |
| 2220 | /** |
| 2221 | * lim_copy_and_free_hlp_data_from_session - Copy HLP info |
| 2222 | * @session_ptr: PE session |
| 2223 | * @roam_sync_ind_ptr: Roam Synch Indication pointer |
| 2224 | * |
| 2225 | * This API is used to copy the parsed HLP info from PE session |
| 2226 | * to roam synch indication data. THe HLP info is expected to be |
| 2227 | * parsed/stored in PE session already from assoc IE's received |
| 2228 | * from fw as part of Roam Synch Indication. |
| 2229 | * |
| 2230 | * Return: None |
| 2231 | */ |
| 2232 | static void lim_copy_and_free_hlp_data_from_session(tpPESession session_ptr, |
| 2233 | roam_offload_synch_ind *roam_sync_ind_ptr) |
| 2234 | { |
| 2235 | if (session_ptr->hlp_data && session_ptr->hlp_data_len) { |
| 2236 | cds_copy_hlp_info(&session_ptr->dst_mac, |
| 2237 | &session_ptr->src_mac, |
| 2238 | session_ptr->hlp_data_len, |
| 2239 | session_ptr->hlp_data, |
| 2240 | &roam_sync_ind_ptr->dst_mac, |
| 2241 | &roam_sync_ind_ptr->src_mac, |
| 2242 | &roam_sync_ind_ptr->hlp_data_len, |
| 2243 | roam_sync_ind_ptr->hlp_data); |
| 2244 | qdf_mem_free(session_ptr->hlp_data); |
| 2245 | session_ptr->hlp_data = NULL; |
| 2246 | session_ptr->hlp_data_len = 0; |
| 2247 | } |
| 2248 | } |
| 2249 | #else |
| 2250 | static inline void lim_copy_and_free_hlp_data_from_session( |
| 2251 | tpPESession session_ptr, |
| 2252 | roam_offload_synch_ind |
| 2253 | *roam_sync_ind_ptr) |
| 2254 | {} |
| 2255 | #endif |
| 2256 | |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2257 | /** |
| 2258 | * pe_roam_synch_callback() - PE level callback for roam synch propagation |
| 2259 | * @mac_ctx: MAC Context |
| 2260 | * @roam_sync_ind_ptr: Roam synch indication buffer pointer |
| 2261 | * @bss_desc: BSS Descriptor pointer |
Varun Reddy Yeturu | b5d858e | 2017-12-15 16:08:13 -0800 | [diff] [blame] | 2262 | * @reason: Reason for calling callback which decides the action to be taken. |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2263 | * |
| 2264 | * This is a PE level callback called from WMA to complete the roam synch |
| 2265 | * propagation at PE level and also fill the BSS descriptor which will be |
| 2266 | * helpful further to complete the roam synch propagation. |
| 2267 | * |
| 2268 | * Return: Success or Failure status |
| 2269 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2270 | QDF_STATUS pe_roam_synch_callback(tpAniSirGlobal mac_ctx, |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2271 | roam_offload_synch_ind *roam_sync_ind_ptr, |
Varun Reddy Yeturu | b5d858e | 2017-12-15 16:08:13 -0800 | [diff] [blame] | 2272 | tpSirBssDescription bss_desc, enum sir_roam_op_code reason) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2273 | { |
| 2274 | tpPESession session_ptr; |
| 2275 | tpPESession ft_session_ptr; |
| 2276 | uint8_t session_id; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2277 | tpDphHashNode curr_sta_ds; |
| 2278 | uint16_t aid; |
| 2279 | tpAddBssParams add_bss_params; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2280 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Kiran Kumar Lokere | ba3b431 | 2016-04-29 16:40:20 -0700 | [diff] [blame] | 2281 | uint16_t join_rsp_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2282 | |
| 2283 | if (!roam_sync_ind_ptr) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2284 | pe_err("LFR3:roam_sync_ind_ptr is NULL"); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2285 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2286 | } |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2287 | session_ptr = pe_find_session_by_sme_session_id(mac_ctx, |
| 2288 | roam_sync_ind_ptr->roamedVdevId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2289 | if (session_ptr == NULL) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2290 | pe_err("LFR3:Unable to find session"); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2291 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2292 | } |
Varun Reddy Yeturu | b5d858e | 2017-12-15 16:08:13 -0800 | [diff] [blame] | 2293 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2294 | if (!LIM_IS_STA_ROLE(session_ptr)) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2295 | pe_err("LFR3:session is not in STA mode"); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2296 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2297 | } |
Varun Reddy Yeturu | b5d858e | 2017-12-15 16:08:13 -0800 | [diff] [blame] | 2298 | |
| 2299 | pe_debug("LFR3: PE callback reason: %d", reason); |
| 2300 | switch (reason) { |
| 2301 | case SIR_ROAMING_START: |
| 2302 | session_ptr->fw_roaming_started = true; |
| 2303 | return QDF_STATUS_SUCCESS; |
| 2304 | case SIR_ROAMING_ABORT: |
| 2305 | session_ptr->fw_roaming_started = false; |
| 2306 | /* |
| 2307 | * If there was a disassoc or deauth that was received |
| 2308 | * during roaming and it was not honored, then we have |
| 2309 | * to internally initiate a disconnect because with |
| 2310 | * ROAM_ABORT we come back to original AP. |
| 2311 | */ |
| 2312 | if (session_ptr->recvd_deauth_while_roaming) |
| 2313 | lim_perform_deauth(mac_ctx, session_ptr, |
| 2314 | session_ptr->deauth_disassoc_rc, |
| 2315 | session_ptr->bssId, 0); |
| 2316 | if (session_ptr->recvd_disassoc_while_roaming) { |
| 2317 | lim_disassoc_tdls_peers(mac_ctx, session_ptr, |
| 2318 | session_ptr->bssId); |
| 2319 | lim_perform_disassoc(mac_ctx, 0, |
| 2320 | session_ptr->deauth_disassoc_rc, |
| 2321 | session_ptr, session_ptr->bssId); |
| 2322 | } |
| 2323 | return QDF_STATUS_SUCCESS; |
| 2324 | case SIR_ROAM_SYNCH_PROPAGATION: |
| 2325 | session_ptr->fw_roaming_started = false; |
| 2326 | break; |
| 2327 | default: |
| 2328 | return status; |
| 2329 | } |
| 2330 | |
| 2331 | pe_debug("LFR3:Received WMA_ROAM_OFFLOAD_SYNCH_IND LFR3:auth: %d vdevId: %d", |
| 2332 | roam_sync_ind_ptr->authStatus, roam_sync_ind_ptr->roamedVdevId); |
| 2333 | lim_print_mac_addr(mac_ctx, roam_sync_ind_ptr->bssid.bytes, |
| 2334 | QDF_TRACE_LEVEL_DEBUG); |
Selvaraj, Sridhar | a6e3eba | 2017-03-14 19:52:39 +0530 | [diff] [blame] | 2335 | /* |
| 2336 | * If deauth from AP already in progress, ignore Roam Synch Indication |
| 2337 | * from firmware. |
| 2338 | */ |
| 2339 | if (session_ptr->limSmeState != eLIM_SME_LINK_EST_STATE) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2340 | pe_err("LFR3: Not in Link est state"); |
Selvaraj, Sridhar | a6e3eba | 2017-03-14 19:52:39 +0530 | [diff] [blame] | 2341 | return status; |
| 2342 | } |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2343 | status = lim_roam_fill_bss_descr(mac_ctx, roam_sync_ind_ptr, bss_desc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2344 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2345 | pe_err("LFR3:Failed to fill Bss Descr"); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2346 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2347 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2348 | status = QDF_STATUS_E_FAILURE; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2349 | ft_session_ptr = pe_create_session(mac_ctx, bss_desc->bssId, |
| 2350 | &session_id, mac_ctx->lim.maxStation, |
| 2351 | eSIR_INFRASTRUCTURE_MODE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2352 | if (ft_session_ptr == NULL) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2353 | pe_err("LFR3:Cannot create PE Session"); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2354 | lim_print_mac_addr(mac_ctx, bss_desc->bssId, LOGE); |
| 2355 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2356 | } |
Vignesh Viswanathan | b3dbbc8 | 2018-04-06 00:06:27 +0530 | [diff] [blame] | 2357 | /* Update the beacon/probe filter in mac_ctx */ |
| 2358 | lim_set_bcn_probe_filter(mac_ctx, ft_session_ptr, NULL, 0); |
| 2359 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2360 | sir_copy_mac_addr(ft_session_ptr->selfMacAddr, session_ptr->selfMacAddr); |
Varun Reddy Yeturu | 28925b4 | 2016-02-08 07:18:50 -0800 | [diff] [blame] | 2361 | sir_copy_mac_addr(roam_sync_ind_ptr->self_mac.bytes, |
| 2362 | session_ptr->selfMacAddr); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2363 | sir_copy_mac_addr(ft_session_ptr->limReAssocbssId, bss_desc->bssId); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2364 | session_ptr->bRoamSynchInProgress = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2365 | ft_session_ptr->bRoamSynchInProgress = true; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2366 | ft_session_ptr->limSystemRole = eLIM_STA_ROLE; |
| 2367 | sir_copy_mac_addr(session_ptr->limReAssocbssId, bss_desc->bssId); |
| 2368 | ft_session_ptr->csaOffloadEnable = session_ptr->csaOffloadEnable; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2369 | |
Deepak Dhamdhere | a7987a2 | 2017-07-26 23:06:38 -0700 | [diff] [blame] | 2370 | /* Assign default configured nss value in the new session */ |
Naveen Rawat | 746a90b | 2017-06-07 15:16:35 -0700 | [diff] [blame] | 2371 | if (IS_5G_CH(ft_session_ptr->currentOperChannel)) |
| 2372 | ft_session_ptr->vdev_nss = mac_ctx->vdev_type_nss_5g.sta; |
| 2373 | else |
| 2374 | ft_session_ptr->vdev_nss = mac_ctx->vdev_type_nss_2g.sta; |
| 2375 | |
| 2376 | ft_session_ptr->nss = ft_session_ptr->vdev_nss; |
| 2377 | |
Deepak Dhamdhere | a7987a2 | 2017-07-26 23:06:38 -0700 | [diff] [blame] | 2378 | /* Next routine will update nss and vdev_nss with AP's capabilities */ |
| 2379 | lim_fill_ft_session(mac_ctx, bss_desc, ft_session_ptr, session_ptr); |
| 2380 | |
| 2381 | /* Next routine may update nss based on dot11Mode */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2382 | lim_ft_prepare_add_bss_req(mac_ctx, false, ft_session_ptr, bss_desc); |
| 2383 | roam_sync_ind_ptr->add_bss_params = |
| 2384 | (tpAddBssParams) ft_session_ptr->ftPEContext.pAddBssReq; |
| 2385 | add_bss_params = ft_session_ptr->ftPEContext.pAddBssReq; |
| 2386 | lim_delete_tdls_peers(mac_ctx, session_ptr); |
| 2387 | curr_sta_ds = dph_lookup_hash_entry(mac_ctx, session_ptr->bssId, |
| 2388 | &aid, &session_ptr->dph.dphHashTable); |
Varun Reddy Yeturu | 3b21c7e | 2016-09-13 15:04:54 -0700 | [diff] [blame] | 2389 | if (curr_sta_ds == NULL) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2390 | pe_err("LFR3:failed to lookup hash entry"); |
Varun Reddy Yeturu | 3b21c7e | 2016-09-13 15:04:54 -0700 | [diff] [blame] | 2391 | ft_session_ptr->bRoamSynchInProgress = false; |
| 2392 | return status; |
| 2393 | } |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2394 | session_ptr->limSmeState = eLIM_SME_IDLE_STATE; |
| 2395 | lim_cleanup_rx_path(mac_ctx, curr_sta_ds, session_ptr); |
| 2396 | lim_delete_dph_hash_entry(mac_ctx, curr_sta_ds->staAddr, |
| 2397 | aid, session_ptr); |
| 2398 | pe_delete_session(mac_ctx, session_ptr); |
| 2399 | session_ptr = NULL; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2400 | curr_sta_ds = dph_add_hash_entry(mac_ctx, |
| 2401 | roam_sync_ind_ptr->bssid.bytes, DPH_STA_HASH_INDEX_PEER, |
| 2402 | &ft_session_ptr->dph.dphHashTable); |
| 2403 | if (curr_sta_ds == NULL) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2404 | pe_err("LFR3:failed to add hash entry for"); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2405 | lim_print_mac_addr(mac_ctx, |
| 2406 | add_bss_params->staContext.staMac, LOGE); |
| 2407 | ft_session_ptr->bRoamSynchInProgress = false; |
| 2408 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2409 | } |
Paul Zhang | fda3a59 | 2017-08-17 17:13:35 +0800 | [diff] [blame] | 2410 | |
| 2411 | add_bss_params->bssIdx = roam_sync_ind_ptr->roamedVdevId; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2412 | ft_session_ptr->bssIdx = (uint8_t) add_bss_params->bssIdx; |
| 2413 | |
| 2414 | curr_sta_ds->bssId = add_bss_params->bssIdx; |
| 2415 | curr_sta_ds->staIndex = |
| 2416 | add_bss_params->staContext.staIdx; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2417 | rrm_cache_mgmt_tx_power(mac_ctx, |
| 2418 | add_bss_params->txMgmtPower, ft_session_ptr); |
| 2419 | mac_ctx->roam.reassocRespLen = roam_sync_ind_ptr->reassocRespLength; |
| 2420 | mac_ctx->roam.pReassocResp = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2421 | qdf_mem_malloc(mac_ctx->roam.reassocRespLen); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2422 | if (NULL == mac_ctx->roam.pReassocResp) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2423 | pe_err("LFR3:assoc resp mem alloc failed"); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2424 | ft_session_ptr->bRoamSynchInProgress = false; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2425 | return QDF_STATUS_E_NOMEM; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2426 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2427 | qdf_mem_copy(mac_ctx->roam.pReassocResp, |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2428 | (uint8_t *)roam_sync_ind_ptr + |
| 2429 | roam_sync_ind_ptr->reassocRespOffset, |
| 2430 | mac_ctx->roam.reassocRespLen); |
| 2431 | |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2432 | pe_debug("LFR3:the reassoc resp frame data:"); |
Nishank Aggarwal | 8d4c720 | 2017-03-10 13:13:54 +0530 | [diff] [blame] | 2433 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2434 | mac_ctx->roam.pReassocResp, |
| 2435 | mac_ctx->roam.reassocRespLen); |
| 2436 | ft_session_ptr->bRoamSynchInProgress = true; |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2437 | |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2438 | lim_process_assoc_rsp_frame(mac_ctx, mac_ctx->roam.pReassocResp, |
| 2439 | LIM_REASSOC, ft_session_ptr); |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2440 | |
| 2441 | lim_copy_and_free_hlp_data_from_session(ft_session_ptr, |
| 2442 | roam_sync_ind_ptr); |
| 2443 | |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2444 | roam_sync_ind_ptr->aid = ft_session_ptr->limAID; |
| 2445 | curr_sta_ds->mlmStaContext.mlmState = |
| 2446 | eLIM_MLM_LINK_ESTABLISHED_STATE; |
Naveen Rawat | 746a90b | 2017-06-07 15:16:35 -0700 | [diff] [blame] | 2447 | curr_sta_ds->nss = ft_session_ptr->nss; |
| 2448 | roam_sync_ind_ptr->nss = ft_session_ptr->nss; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2449 | ft_session_ptr->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE; |
| 2450 | lim_init_tdls_data(mac_ctx, ft_session_ptr); |
Yu Wang | 0477ee3 | 2017-02-10 20:02:03 +0800 | [diff] [blame] | 2451 | join_rsp_len = ft_session_ptr->RICDataLen + |
Sreelakshmi Konamki | 0a942d4 | 2017-01-24 14:46:55 +0530 | [diff] [blame] | 2452 | sizeof(tSirSmeJoinRsp) - sizeof(uint8_t); |
Yu Wang | 0477ee3 | 2017-02-10 20:02:03 +0800 | [diff] [blame] | 2453 | |
| 2454 | #ifdef FEATURE_WLAN_ESE |
| 2455 | join_rsp_len += ft_session_ptr->tspecLen; |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2456 | pe_debug("tspecLen: %d", ft_session_ptr->tspecLen); |
Yu Wang | 0477ee3 | 2017-02-10 20:02:03 +0800 | [diff] [blame] | 2457 | #endif |
| 2458 | |
Kiran Kumar Lokere | ba3b431 | 2016-04-29 16:40:20 -0700 | [diff] [blame] | 2459 | roam_sync_ind_ptr->join_rsp = qdf_mem_malloc(join_rsp_len); |
| 2460 | if (NULL == roam_sync_ind_ptr->join_rsp) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2461 | pe_err("LFR3:mem alloc failed"); |
Kiran Kumar Lokere | ba3b431 | 2016-04-29 16:40:20 -0700 | [diff] [blame] | 2462 | ft_session_ptr->bRoamSynchInProgress = false; |
| 2463 | if (mac_ctx->roam.pReassocResp) |
| 2464 | qdf_mem_free(mac_ctx->roam.pReassocResp); |
| 2465 | mac_ctx->roam.pReassocResp = NULL; |
| 2466 | return QDF_STATUS_E_NOMEM; |
| 2467 | } |
Kiran Kumar Lokere | ba3b431 | 2016-04-29 16:40:20 -0700 | [diff] [blame] | 2468 | |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2469 | pe_debug("Session RicLength: %d", ft_session_ptr->RICDataLen); |
Kiran Kumar Lokere | ba3b431 | 2016-04-29 16:40:20 -0700 | [diff] [blame] | 2470 | if (ft_session_ptr->ricData != NULL) { |
| 2471 | roam_sync_ind_ptr->join_rsp->parsedRicRspLen = |
| 2472 | ft_session_ptr->RICDataLen; |
| 2473 | qdf_mem_copy(roam_sync_ind_ptr->join_rsp->frames, |
| 2474 | ft_session_ptr->ricData, |
| 2475 | roam_sync_ind_ptr->join_rsp->parsedRicRspLen); |
| 2476 | qdf_mem_free(ft_session_ptr->ricData); |
| 2477 | ft_session_ptr->ricData = NULL; |
| 2478 | ft_session_ptr->RICDataLen = 0; |
| 2479 | } |
Yu Wang | 0477ee3 | 2017-02-10 20:02:03 +0800 | [diff] [blame] | 2480 | |
| 2481 | #ifdef FEATURE_WLAN_ESE |
Sreelakshmi Konamki | 0a942d4 | 2017-01-24 14:46:55 +0530 | [diff] [blame] | 2482 | if (ft_session_ptr->tspecIes != NULL) { |
| 2483 | roam_sync_ind_ptr->join_rsp->tspecIeLen = |
| 2484 | ft_session_ptr->tspecLen; |
| 2485 | qdf_mem_copy(roam_sync_ind_ptr->join_rsp->frames + |
| 2486 | roam_sync_ind_ptr->join_rsp->parsedRicRspLen, |
| 2487 | ft_session_ptr->tspecIes, |
| 2488 | roam_sync_ind_ptr->join_rsp->tspecIeLen); |
| 2489 | qdf_mem_free(ft_session_ptr->tspecIes); |
| 2490 | ft_session_ptr->tspecIes = NULL; |
| 2491 | ft_session_ptr->tspecLen = 0; |
| 2492 | } |
Yu Wang | 0477ee3 | 2017-02-10 20:02:03 +0800 | [diff] [blame] | 2493 | #endif |
| 2494 | |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2495 | roam_sync_ind_ptr->join_rsp->vht_channel_width = |
| 2496 | ft_session_ptr->ch_width; |
| 2497 | roam_sync_ind_ptr->join_rsp->staId = curr_sta_ds->staIndex; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2498 | roam_sync_ind_ptr->join_rsp->timingMeasCap = curr_sta_ds->timingMeasCap; |
| 2499 | roam_sync_ind_ptr->join_rsp->nss = curr_sta_ds->nss; |
| 2500 | roam_sync_ind_ptr->join_rsp->max_rate_flags = |
| 2501 | lim_get_max_rate_flags(mac_ctx, curr_sta_ds); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 2502 | lim_set_tdls_flags(roam_sync_ind_ptr, ft_session_ptr); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2503 | roam_sync_ind_ptr->join_rsp->aid = ft_session_ptr->limAID; |
| 2504 | lim_fill_join_rsp_ht_caps(ft_session_ptr, roam_sync_ind_ptr->join_rsp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2505 | ft_session_ptr->limPrevSmeState = ft_session_ptr->limSmeState; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2506 | ft_session_ptr->limSmeState = eLIM_SME_LINK_EST_STATE; |
| 2507 | ft_session_ptr->bRoamSynchInProgress = false; |
| 2508 | if (mac_ctx->roam.pReassocResp) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2509 | qdf_mem_free(mac_ctx->roam.pReassocResp); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2510 | mac_ctx->roam.pReassocResp = NULL; |
Naveen Rawat | 945894a | 2016-12-17 14:58:07 -0800 | [diff] [blame] | 2511 | |
| 2512 | if (roam_sync_ind_ptr->authStatus == CSR_ROAM_AUTH_STATUS_AUTHENTICATED) |
| 2513 | ft_session_ptr->is_key_installed = true; |
| 2514 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2515 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2516 | } |
| 2517 | #endif |
| 2518 | |
Jeff Johnson | 82b0c62 | 2016-10-07 07:53:55 -0700 | [diff] [blame] | 2519 | static bool lim_is_beacon_miss_scenario(tpAniSirGlobal pMac, |
| 2520 | uint8_t *pRxPacketInfo) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2521 | { |
| 2522 | tpSirMacMgmtHdr pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 2523 | uint8_t sessionId; |
| 2524 | tpPESession psessionEntry = |
| 2525 | pe_find_session_by_bssid(pMac, pHdr->bssId, &sessionId); |
| 2526 | |
| 2527 | if (psessionEntry && psessionEntry->pmmOffloadInfo.bcnmiss) |
| 2528 | return true; |
| 2529 | return false; |
| 2530 | } |
| 2531 | |
| 2532 | /** ----------------------------------------------------------------- |
| 2533 | \brief lim_is_pkt_candidate_for_drop() - decides whether to drop the frame or not |
| 2534 | |
| 2535 | This function is called before enqueuing the frame to PE queue for further processing. |
| 2536 | This prevents unnecessary frames getting into PE Queue and drops them right away. |
| 2537 | Frames will be droped in the following scenarios: |
| 2538 | |
| 2539 | - In Scan State, drop the frames which are not marked as scan frames |
| 2540 | - In non-Scan state, drop the frames which are marked as scan frames. |
| 2541 | - Drop INFRA Beacons and Probe Responses in IBSS Mode |
| 2542 | - Drop the Probe Request in IBSS mode, if STA did not send out the last beacon |
| 2543 | |
| 2544 | \param pMac - global mac structure |
| 2545 | \return - none |
| 2546 | \sa |
| 2547 | ----------------------------------------------------------------- */ |
| 2548 | |
| 2549 | tMgmtFrmDropReason lim_is_pkt_candidate_for_drop(tpAniSirGlobal pMac, |
| 2550 | uint8_t *pRxPacketInfo, |
| 2551 | uint32_t subType) |
| 2552 | { |
| 2553 | uint32_t framelen; |
| 2554 | uint8_t *pBody; |
| 2555 | tSirMacCapabilityInfo capabilityInfo; |
| 2556 | tpSirMacMgmtHdr pHdr = NULL; |
| 2557 | tpPESession psessionEntry = NULL; |
| 2558 | uint8_t sessionId; |
| 2559 | |
| 2560 | /* |
| 2561 | * |
| 2562 | * In scan mode, drop only Beacon/Probe Response which are NOT marked as scan-frames. |
| 2563 | * In non-scan mode, drop only Beacon/Probe Response which are marked as scan frames. |
| 2564 | * Allow other mgmt frames, they must be from our own AP, as we don't allow |
| 2565 | * other than beacons or probe responses in scan state. |
| 2566 | */ |
| 2567 | if ((subType == SIR_MAC_MGMT_BEACON) || |
| 2568 | (subType == SIR_MAC_MGMT_PROBE_RSP)) { |
| 2569 | if (lim_is_beacon_miss_scenario(pMac, pRxPacketInfo)) { |
Arif Hussain | fe3de0d | 2018-04-30 19:04:29 -0700 | [diff] [blame] | 2570 | MTRACE(mac_trace(pMac, TRACE_CODE_INFO_LOG, 0, |
| 2571 | eLOG_NODROP_MISSED_BEACON_SCENARIO)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2572 | return eMGMT_DROP_NO_DROP; |
| 2573 | } |
Arif Hussain | fe3de0d | 2018-04-30 19:04:29 -0700 | [diff] [blame] | 2574 | if (lim_is_system_in_scan_state(pMac)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2575 | return eMGMT_DROP_NO_DROP; |
Arif Hussain | fe3de0d | 2018-04-30 19:04:29 -0700 | [diff] [blame] | 2576 | else if (WMA_IS_RX_IN_SCAN(pRxPacketInfo)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2577 | return eMGMT_DROP_SCAN_MODE_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2578 | |
Arif Hussain | fe3de0d | 2018-04-30 19:04:29 -0700 | [diff] [blame] | 2579 | framelen = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
| 2580 | pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2581 | /* drop the frame if length is less than 12 */ |
| 2582 | if (framelen < LIM_MIN_BCN_PR_LENGTH) |
| 2583 | return eMGMT_DROP_INVALID_SIZE; |
| 2584 | |
| 2585 | *((uint16_t *) &capabilityInfo) = |
| 2586 | sir_read_u16(pBody + LIM_BCN_PR_CAPABILITY_OFFSET); |
| 2587 | |
| 2588 | /* Note sure if this is sufficient, basically this condition allows all probe responses and |
| 2589 | * beacons from an infrastructure network |
| 2590 | */ |
| 2591 | if (!capabilityInfo.ibss) |
| 2592 | return eMGMT_DROP_NO_DROP; |
| 2593 | |
Arif Hussain | fe3de0d | 2018-04-30 19:04:29 -0700 | [diff] [blame] | 2594 | /* Drop INFRA Beacons and Probe Responses in IBSS Mode */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2595 | /* This can be enhanced to even check the SSID before deciding to enque the frame. */ |
| 2596 | if (capabilityInfo.ess) |
| 2597 | return eMGMT_DROP_INFRA_BCN_IN_IBSS; |
Arif Hussain | fe3de0d | 2018-04-30 19:04:29 -0700 | [diff] [blame] | 2598 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2599 | } else if ((subType == SIR_MAC_MGMT_PROBE_REQ) && |
| 2600 | (!WMA_GET_RX_BEACON_SENT(pRxPacketInfo))) { |
| 2601 | pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo); |
Arif Hussain | fe3de0d | 2018-04-30 19:04:29 -0700 | [diff] [blame] | 2602 | psessionEntry = pe_find_session_by_bssid(pMac, |
| 2603 | pHdr->bssId, |
| 2604 | &sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2605 | if ((psessionEntry && !LIM_IS_IBSS_ROLE(psessionEntry)) || |
| 2606 | (!psessionEntry)) |
| 2607 | return eMGMT_DROP_NO_DROP; |
| 2608 | |
| 2609 | /* Drop the Probe Request in IBSS mode, if STA did not send out the last beacon */ |
| 2610 | /* In IBSS, the node which sends out the beacon, is supposed to respond to ProbeReq */ |
| 2611 | return eMGMT_DROP_NOT_LAST_IBSS_BCN; |
Krunal Soni | 05c914f | 2018-08-06 12:23:58 -0700 | [diff] [blame] | 2612 | } else if (subType == SIR_MAC_MGMT_AUTH) { |
| 2613 | uint16_t curr_seq_num = 0; |
| 2614 | struct tLimPreAuthNode *auth_node; |
| 2615 | |
| 2616 | pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 2617 | psessionEntry = pe_find_session_by_bssid(pMac, pHdr->bssId, |
| 2618 | &sessionId); |
| 2619 | if (!psessionEntry) |
| 2620 | return eMGMT_DROP_NO_DROP; |
| 2621 | |
| 2622 | curr_seq_num = ((pHdr->seqControl.seqNumHi << 4) | |
| 2623 | (pHdr->seqControl.seqNumLo)); |
| 2624 | auth_node = lim_search_pre_auth_list(pMac, pHdr->sa); |
| 2625 | if (auth_node && pHdr->fc.retry && |
| 2626 | (auth_node->seq_num == curr_seq_num)) { |
| 2627 | pe_err_rl("auth frame, seq num: %d is already processed, drop it", |
| 2628 | curr_seq_num); |
| 2629 | return eMGMT_DROP_DUPLICATE_AUTH_FRAME; |
| 2630 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2631 | } |
| 2632 | |
| 2633 | return eMGMT_DROP_NO_DROP; |
| 2634 | } |
| 2635 | |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 2636 | void lim_update_lost_link_info(tpAniSirGlobal mac, tpPESession session, |
| 2637 | int32_t rssi) |
| 2638 | { |
| 2639 | struct sir_lost_link_info *lost_link_info; |
Rajeev Kumar | cf7bd80 | 2017-04-18 11:11:42 -0700 | [diff] [blame] | 2640 | struct scheduler_msg mmh_msg = {0}; |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 2641 | |
| 2642 | if ((NULL == mac) || (NULL == session)) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2643 | pe_err("parameter NULL"); |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 2644 | return; |
| 2645 | } |
Yeshwanth Sriram Guntuka | e7303b8 | 2018-08-10 16:45:16 +0530 | [diff] [blame] | 2646 | if (!LIM_IS_STA_ROLE(session)) |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 2647 | return; |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 2648 | |
| 2649 | lost_link_info = qdf_mem_malloc(sizeof(*lost_link_info)); |
| 2650 | if (NULL == lost_link_info) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2651 | pe_err("lost_link_info allocation failure"); |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 2652 | return; |
| 2653 | } |
| 2654 | |
| 2655 | lost_link_info->vdev_id = session->smeSessionId; |
| 2656 | lost_link_info->rssi = rssi; |
| 2657 | mmh_msg.type = eWNI_SME_LOST_LINK_INFO_IND; |
| 2658 | mmh_msg.bodyptr = lost_link_info; |
| 2659 | mmh_msg.bodyval = 0; |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2660 | pe_debug("post eWNI_SME_LOST_LINK_INFO_IND, bss_idx: %d rssi: %d", |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 2661 | lost_link_info->vdev_id, lost_link_info->rssi); |
| 2662 | |
| 2663 | lim_sys_process_mmh_msg_api(mac, &mmh_msg, ePROT); |
| 2664 | } |
| 2665 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2666 | QDF_STATUS pe_acquire_global_lock(tAniSirLim *psPe) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2667 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2668 | QDF_STATUS status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2669 | |
| 2670 | if (psPe) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2671 | if (QDF_IS_STATUS_SUCCESS |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 2672 | (qdf_mutex_acquire(&psPe->lkPeGlobalLock))) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2673 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2674 | } |
| 2675 | } |
| 2676 | return status; |
| 2677 | } |
| 2678 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2679 | QDF_STATUS pe_release_global_lock(tAniSirLim *psPe) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2680 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2681 | QDF_STATUS status = QDF_STATUS_E_INVAL; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 2682 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2683 | if (psPe) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2684 | if (QDF_IS_STATUS_SUCCESS |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 2685 | (qdf_mutex_release(&psPe->lkPeGlobalLock))) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2686 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2687 | } |
| 2688 | } |
| 2689 | return status; |
| 2690 | } |
| 2691 | |
Manjunathappa Prakash | 0e6e6b5 | 2016-04-21 11:48:48 -0700 | [diff] [blame] | 2692 | /** |
| 2693 | * lim_mon_init_session() - create PE session for monitor mode operation |
| 2694 | * @mac_ptr: mac pointer |
| 2695 | * @msg: Pointer to struct sir_create_session type. |
| 2696 | * |
| 2697 | * Return: NONE |
| 2698 | */ |
| 2699 | void lim_mon_init_session(tpAniSirGlobal mac_ptr, |
| 2700 | struct sir_create_session *msg) |
| 2701 | { |
| 2702 | tpPESession psession_entry; |
| 2703 | uint8_t session_id; |
| 2704 | |
Manjunathappa Prakash | 0e6e6b5 | 2016-04-21 11:48:48 -0700 | [diff] [blame] | 2705 | psession_entry = pe_create_session(mac_ptr, msg->bss_id.bytes, |
| 2706 | &session_id, |
| 2707 | mac_ptr->lim.maxStation, |
| 2708 | eSIR_MONITOR_MODE); |
| 2709 | if (psession_entry == NULL) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2710 | pe_err("Monitor mode: Session Can not be created"); |
Manjunathappa Prakash | 0e6e6b5 | 2016-04-21 11:48:48 -0700 | [diff] [blame] | 2711 | lim_print_mac_addr(mac_ptr, msg->bss_id.bytes, LOGE); |
| 2712 | return; |
| 2713 | } |
| 2714 | psession_entry->vhtCapability = 1; |
| 2715 | } |
Selvaraj, Sridhar | 0174182 | 2016-08-30 18:26:19 +0530 | [diff] [blame] | 2716 | |
| 2717 | /** |
| 2718 | * lim_update_ext_cap_ie() - Update Extended capabilities IE(if present) |
| 2719 | * with capabilities of Fine Time measurements(FTM) if set in driver |
| 2720 | * |
| 2721 | * @mac_ctx: Pointer to Global MAC structure |
| 2722 | * @ie_data: Default Scan IE data |
| 2723 | * @local_ie_buf: Local Scan IE data |
| 2724 | * @local_ie_len: Pointer to length of @ie_data |
| 2725 | * |
| 2726 | * Return: QDF_STATUS |
| 2727 | */ |
| 2728 | QDF_STATUS lim_update_ext_cap_ie(tpAniSirGlobal mac_ctx, |
| 2729 | uint8_t *ie_data, uint8_t *local_ie_buf, uint16_t *local_ie_len) |
| 2730 | { |
| 2731 | uint32_t dot11mode; |
| 2732 | bool vht_enabled = false; |
| 2733 | tDot11fIEExtCap default_scan_ext_cap = {0}, driver_ext_cap = {0}; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2734 | QDF_STATUS status; |
Selvaraj, Sridhar | 0174182 | 2016-08-30 18:26:19 +0530 | [diff] [blame] | 2735 | |
| 2736 | status = lim_strip_extcap_update_struct(mac_ctx, ie_data, |
| 2737 | local_ie_len, &default_scan_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2738 | if (QDF_STATUS_SUCCESS != status) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2739 | pe_err("Strip ext cap fails %d", status); |
Selvaraj, Sridhar | 0174182 | 2016-08-30 18:26:19 +0530 | [diff] [blame] | 2740 | return QDF_STATUS_E_FAILURE; |
| 2741 | } |
| 2742 | |
Pragaspathi Thilagaraj | 6cf025f | 2018-06-25 18:37:05 +0530 | [diff] [blame] | 2743 | if ((*local_ie_len) > (MAX_DEFAULT_SCAN_IE_LEN - EXT_CAP_IE_HDR_LEN)) { |
| 2744 | pe_err("Invalid Scan IE length"); |
| 2745 | return QDF_STATUS_E_FAILURE; |
| 2746 | } |
Naveen Rawat | b677c24 | 2017-03-29 16:34:50 -0700 | [diff] [blame] | 2747 | /* copy ie prior to ext cap to local buffer */ |
Selvaraj, Sridhar | 0174182 | 2016-08-30 18:26:19 +0530 | [diff] [blame] | 2748 | qdf_mem_copy(local_ie_buf, ie_data, (*local_ie_len)); |
Naveen Rawat | b677c24 | 2017-03-29 16:34:50 -0700 | [diff] [blame] | 2749 | |
| 2750 | /* from here ext cap ie starts, set EID */ |
| 2751 | local_ie_buf[*local_ie_len] = DOT11F_EID_EXTCAP; |
Selvaraj, Sridhar | 0174182 | 2016-08-30 18:26:19 +0530 | [diff] [blame] | 2752 | |
| 2753 | wlan_cfg_get_int(mac_ctx, WNI_CFG_DOT11_MODE, &dot11mode); |
| 2754 | if (IS_DOT11_MODE_VHT(dot11mode)) |
| 2755 | vht_enabled = true; |
| 2756 | |
| 2757 | status = populate_dot11f_ext_cap(mac_ctx, vht_enabled, |
| 2758 | &driver_ext_cap, NULL); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2759 | if (QDF_STATUS_SUCCESS != status) { |
Nishank Aggarwal | 524ee9a803 | 2017-03-23 18:35:16 +0530 | [diff] [blame] | 2760 | pe_err("Failed %d to create ext cap IE. Use default value instead", |
Selvaraj, Sridhar | 0174182 | 2016-08-30 18:26:19 +0530 | [diff] [blame] | 2761 | status); |
Naveen Rawat | b677c24 | 2017-03-29 16:34:50 -0700 | [diff] [blame] | 2762 | local_ie_buf[*local_ie_len + 1] = DOT11F_IE_EXTCAP_MAX_LEN; |
Pragaspathi Thilagaraj | 6cf025f | 2018-06-25 18:37:05 +0530 | [diff] [blame] | 2763 | |
| 2764 | if ((*local_ie_len) > (MAX_DEFAULT_SCAN_IE_LEN - |
| 2765 | (DOT11F_IE_EXTCAP_MAX_LEN + EXT_CAP_IE_HDR_LEN))) { |
| 2766 | pe_err("Invalid Scan IE length"); |
| 2767 | return QDF_STATUS_E_FAILURE; |
| 2768 | } |
Naveen Rawat | b677c24 | 2017-03-29 16:34:50 -0700 | [diff] [blame] | 2769 | (*local_ie_len) += EXT_CAP_IE_HDR_LEN; |
Selvaraj, Sridhar | 0174182 | 2016-08-30 18:26:19 +0530 | [diff] [blame] | 2770 | qdf_mem_copy(local_ie_buf + (*local_ie_len), |
| 2771 | default_scan_ext_cap.bytes, |
| 2772 | DOT11F_IE_EXTCAP_MAX_LEN); |
| 2773 | (*local_ie_len) += DOT11F_IE_EXTCAP_MAX_LEN; |
| 2774 | return QDF_STATUS_SUCCESS; |
| 2775 | } |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 2776 | lim_merge_extcap_struct(&driver_ext_cap, &default_scan_ext_cap, true); |
Naveen Rawat | b677c24 | 2017-03-29 16:34:50 -0700 | [diff] [blame] | 2777 | local_ie_buf[*local_ie_len + 1] = driver_ext_cap.num_bytes; |
Pragaspathi Thilagaraj | 6cf025f | 2018-06-25 18:37:05 +0530 | [diff] [blame] | 2778 | |
| 2779 | if ((*local_ie_len) > (MAX_DEFAULT_SCAN_IE_LEN - |
| 2780 | (EXT_CAP_IE_HDR_LEN + driver_ext_cap.num_bytes))) { |
| 2781 | pe_err("Invalid Scan IE length"); |
| 2782 | return QDF_STATUS_E_FAILURE; |
| 2783 | } |
Naveen Rawat | b677c24 | 2017-03-29 16:34:50 -0700 | [diff] [blame] | 2784 | (*local_ie_len) += EXT_CAP_IE_HDR_LEN; |
Selvaraj, Sridhar | 0174182 | 2016-08-30 18:26:19 +0530 | [diff] [blame] | 2785 | qdf_mem_copy(local_ie_buf + (*local_ie_len), |
Selvaraj, Sridhar | 2c46d83 | 2017-03-13 17:55:48 +0530 | [diff] [blame] | 2786 | driver_ext_cap.bytes, driver_ext_cap.num_bytes); |
| 2787 | (*local_ie_len) += driver_ext_cap.num_bytes; |
Selvaraj, Sridhar | 0174182 | 2016-08-30 18:26:19 +0530 | [diff] [blame] | 2788 | return QDF_STATUS_SUCCESS; |
| 2789 | } |