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