Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Satyanarayana Dash | 6f43827 | 2015-03-03 18:01:06 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 26 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 27 | |
| 28 | |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 29 | |
| 30 | |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 31 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 32 | * This file limProcessSmeReqMessages.cc contains the code |
| 33 | * for processing SME request messages. |
| 34 | * Author: Chandra Modumudi |
| 35 | * Date: 02/11/02 |
| 36 | * History:- |
| 37 | * Date Modified by Modification Information |
| 38 | * -------------------------------------------------------------------- |
| 39 | * |
| 40 | */ |
| 41 | |
| 42 | #include "palTypes.h" |
| 43 | #include "wniApi.h" |
Satyanarayana Dash | 6f43827 | 2015-03-03 18:01:06 +0530 | [diff] [blame] | 44 | #include "wniCfg.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 45 | #include "cfgApi.h" |
| 46 | #include "sirApi.h" |
| 47 | #include "schApi.h" |
| 48 | #include "utilsApi.h" |
| 49 | #include "limTypes.h" |
| 50 | #include "limUtils.h" |
| 51 | #include "limAssocUtils.h" |
| 52 | #include "limSecurityUtils.h" |
| 53 | #include "limSerDesUtils.h" |
| 54 | #include "limSmeReqUtils.h" |
| 55 | #include "limIbssPeerMgmt.h" |
| 56 | #include "limAdmitControl.h" |
| 57 | #include "dphHashTable.h" |
| 58 | #include "limSendMessages.h" |
| 59 | #include "limApi.h" |
| 60 | #include "wmmApsd.h" |
| 61 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 62 | #include "sapApi.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 63 | |
| 64 | #if defined WLAN_FEATURE_VOWIFI |
| 65 | #include "rrmApi.h" |
| 66 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 67 | #if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD) |
| 68 | #include "eseApi.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 69 | #endif |
| 70 | |
| 71 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 72 | #include <limFT.h> |
| 73 | #endif |
| 74 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 75 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 76 | /* These are the min/max tx power (non virtual rates) range |
| 77 | supported by prima hardware */ |
Sandeep Puligilla | 33ccf33 | 2013-12-19 16:06:42 +0530 | [diff] [blame] | 78 | #define MIN_TX_PWR_CAP 8 |
| 79 | #define MAX_TX_PWR_CAP 22 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 80 | |
| 81 | #endif |
| 82 | |
Sushant Kaushik | e3ca61c | 2015-03-19 18:33:25 +0530 | [diff] [blame] | 83 | #define JOIN_FAILURE_TIMEOUT 1000 // in msecs |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 84 | /* This overhead is time for sending NOA start to host in case of GO/sending NULL data & receiving ACK |
| 85 | * in case of P2P Client and starting actual scanning with init scan req/rsp plus in case of concurrency, |
Sunil Ravi | 24fd3aa | 2013-01-21 22:12:06 -0800 | [diff] [blame] | 86 | * taking care of sending null data and receiving ACK to/from AP/Also SetChannel with calibration is taking |
| 87 | * around 7ms . |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 88 | */ |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 89 | #define SCAN_MESSAGING_OVERHEAD 20 // in msecs |
| 90 | #define JOIN_NOA_DURATION 2000 // in msecs |
| 91 | #define OEM_DATA_NOA_DURATION 60 // in msecs |
| 92 | #define DEFAULT_PASSIVE_MAX_CHANNEL_TIME 110 // in msecs |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 93 | |
Gopichand Nakkala | 096a105 | 2012-12-21 07:05:34 -0800 | [diff] [blame] | 94 | #define CONV_MS_TO_US 1024 //conversion factor from ms to us |
| 95 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 96 | // SME REQ processing function templates |
| 97 | static void __limProcessSmeStartReq(tpAniSirGlobal, tANI_U32 *); |
| 98 | static tANI_BOOLEAN __limProcessSmeSysReadyInd(tpAniSirGlobal, tANI_U32 *); |
| 99 | static tANI_BOOLEAN __limProcessSmeStartBssReq(tpAniSirGlobal, tpSirMsgQ pMsg); |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 100 | static void __limProcessSmeScanReq(tpAniSirGlobal, tANI_U32 *); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 101 | static void __limProcessSmeJoinReq(tpAniSirGlobal, tANI_U32 *); |
| 102 | static void __limProcessSmeReassocReq(tpAniSirGlobal, tANI_U32 *); |
| 103 | static void __limProcessSmeDisassocReq(tpAniSirGlobal, tANI_U32 *); |
| 104 | static void __limProcessSmeDisassocCnf(tpAniSirGlobal, tANI_U32 *); |
| 105 | static void __limProcessSmeDeauthReq(tpAniSirGlobal, tANI_U32 *); |
| 106 | static void __limProcessSmeSetContextReq(tpAniSirGlobal, tANI_U32 *); |
| 107 | static tANI_BOOLEAN __limProcessSmeStopBssReq(tpAniSirGlobal, tpSirMsgQ pMsg); |
| 108 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 109 | void __limProcessSmeAssocCnfNew(tpAniSirGlobal, tANI_U32, tANI_U32 *); |
| 110 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 111 | extern void peRegisterTLHandle(tpAniSirGlobal pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 112 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 113 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 114 | #ifdef BACKGROUND_SCAN_ENABLED |
| 115 | |
| 116 | // start the background scan timers if it hasn't already started |
| 117 | static void |
| 118 | __limBackgroundScanInitiate(tpAniSirGlobal pMac) |
| 119 | { |
| 120 | if (pMac->lim.gLimBackgroundScanStarted) |
| 121 | return; |
| 122 | |
| 123 | //make sure timer is created first |
| 124 | if (TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer)) |
| 125 | { |
| 126 | limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 127 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 128 | if (tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS) |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 129 | limLog(pMac, LOGP, FL("could not activate background scan timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 130 | pMac->lim.gLimBackgroundScanStarted = true; |
| 131 | pMac->lim.gLimBackgroundScanChannelId = 0; |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | #endif // BACKGROUND_SCAN_ENABLED |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 136 | |
| 137 | // determine if a fresh scan request must be issued or not |
| 138 | /* |
| 139 | * PE will do fresh scan, if all of the active sessions are in good state (Link Est or BSS Started) |
| 140 | * If one of the sessions is not in one of the above states, then PE does not do fresh scan |
| 141 | * If no session exists (scanning very first time), then PE will always do fresh scan if SME |
| 142 | * asks it to do that. |
| 143 | */ |
| 144 | static tANI_U8 |
| 145 | __limFreshScanReqd(tpAniSirGlobal pMac, tANI_U8 returnFreshResults) |
| 146 | { |
| 147 | |
| 148 | tANI_U8 validState = TRUE; |
| 149 | int i; |
| 150 | |
| 151 | if(pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE) |
| 152 | { |
| 153 | return FALSE; |
| 154 | } |
| 155 | for(i =0; i < pMac->lim.maxBssId; i++) |
| 156 | { |
| 157 | |
| 158 | if(pMac->lim.gpSession[i].valid == TRUE) |
| 159 | { |
| 160 | if(!( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) || |
| 161 | (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))&& |
| 162 | (pMac->lim.gpSession[i].limSmeState == eLIM_SME_LINK_EST_STATE) )|| |
| 163 | |
| 164 | ( ( (pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)|| |
| 165 | (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)|| |
| 166 | (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE) )&& |
| 167 | (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 168 | || ( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRA_AP_MODE) |
| 169 | && ( pMac->lim.gpSession[i].pePersona == VOS_P2P_GO_MODE) ) |
| 170 | || (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ) |
| 171 | && (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 172 | )) |
| 173 | { |
| 174 | validState = FALSE; |
| 175 | break; |
| 176 | } |
| 177 | |
| 178 | } |
| 179 | } |
Rashmi Ramanna | 6c13a34 | 2014-01-07 11:44:07 +0530 | [diff] [blame] | 180 | limLog(pMac, LOG1, FL("FreshScanReqd: %d "), validState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 181 | |
| 182 | if( (validState) && (returnFreshResults & SIR_BG_SCAN_RETURN_FRESH_RESULTS)) |
| 183 | return TRUE; |
| 184 | |
| 185 | return FALSE; |
| 186 | } |
| 187 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 188 | |
| 189 | |
| 190 | /** |
| 191 | * __limIsSmeAssocCnfValid() |
| 192 | * |
| 193 | *FUNCTION: |
| 194 | * This function is called by limProcessLmmMessages() upon |
| 195 | * receiving SME_ASSOC_CNF. |
| 196 | * |
| 197 | *LOGIC: |
| 198 | * Message validity checks are performed in this function |
| 199 | * |
| 200 | *ASSUMPTIONS: |
| 201 | * |
| 202 | *NOTE: |
| 203 | * |
| 204 | * @param pMeasReq Pointer to Received ASSOC_CNF message |
| 205 | * @return true When received SME_ASSOC_CNF is formatted |
| 206 | * correctly |
| 207 | * false otherwise |
| 208 | */ |
| 209 | |
| 210 | inline static tANI_U8 |
| 211 | __limIsSmeAssocCnfValid(tpSirSmeAssocCnf pAssocCnf) |
| 212 | { |
| 213 | if (limIsGroupAddr(pAssocCnf->peerMacAddr)) |
| 214 | return false; |
| 215 | else |
| 216 | return true; |
| 217 | } /*** end __limIsSmeAssocCnfValid() ***/ |
| 218 | |
| 219 | |
| 220 | /** |
| 221 | * __limGetSmeJoinReqSizeForAlloc() |
| 222 | * |
| 223 | *FUNCTION: |
| 224 | * This function is called in various places to get IE length |
| 225 | * from tSirBssDescription structure |
| 226 | * number being scanned. |
| 227 | * |
| 228 | *PARAMS: |
| 229 | * |
| 230 | *LOGIC: |
| 231 | * |
| 232 | *ASSUMPTIONS: |
| 233 | * NA |
| 234 | * |
| 235 | *NOTE: |
| 236 | * NA |
| 237 | * |
| 238 | * @param pBssDescr |
| 239 | * @return Total IE length |
| 240 | */ |
| 241 | |
| 242 | static tANI_U16 |
| 243 | __limGetSmeJoinReqSizeForAlloc(tANI_U8 *pBuf) |
| 244 | { |
| 245 | tANI_U16 len = 0; |
| 246 | |
| 247 | if (!pBuf) |
| 248 | return len; |
| 249 | |
| 250 | pBuf += sizeof(tANI_U16); |
| 251 | len = limGetU16( pBuf ); |
| 252 | return (len + sizeof( tANI_U16 )); |
| 253 | } /*** end __limGetSmeJoinReqSizeForAlloc() ***/ |
| 254 | |
| 255 | |
| 256 | /**---------------------------------------------------------------- |
| 257 | \fn __limIsDeferedMsgForLearn |
| 258 | |
| 259 | \brief Has role only if 11h is enabled. Not used on STA side. |
| 260 | Defers the message if SME is in learn state and brings |
| 261 | the LIM back to normal mode. |
| 262 | |
| 263 | \param pMac |
| 264 | \param pMsg - Pointer to message posted from SME to LIM. |
| 265 | \return TRUE - If defered |
| 266 | FALSE - Otherwise |
| 267 | ------------------------------------------------------------------*/ |
| 268 | static tANI_BOOLEAN |
| 269 | __limIsDeferedMsgForLearn(tpAniSirGlobal pMac, tpSirMsgQ pMsg) |
| 270 | { |
| 271 | if (limIsSystemInScanState(pMac)) |
| 272 | { |
| 273 | if (limDeferMsg(pMac, pMsg) != TX_SUCCESS) |
| 274 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 275 | PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 276 | return eANI_BOOLEAN_FALSE; |
| 277 | } |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 278 | PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 279 | pMsg->type);) |
| 280 | |
| 281 | /** Send finish scan req to HAL only if LIM is not waiting for any response |
| 282 | * from HAL like init scan rsp, start scan rsp etc. |
| 283 | */ |
| 284 | if (GET_LIM_PROCESS_DEFD_MESGS(pMac)) |
| 285 | { |
| 286 | //Set the resume channel to Any valid channel (invalid). |
| 287 | //This will instruct HAL to set it to any previous valid channel. |
| 288 | peSetResumeChannel(pMac, 0, 0); |
| 289 | limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE); |
| 290 | } |
| 291 | |
| 292 | return eANI_BOOLEAN_TRUE; |
| 293 | } |
| 294 | return eANI_BOOLEAN_FALSE; |
| 295 | } |
| 296 | |
| 297 | /**---------------------------------------------------------------- |
| 298 | \fn __limIsDeferedMsgForRadar |
| 299 | |
| 300 | \brief Has role only if 11h is enabled. Not used on STA side. |
| 301 | Defers the message if radar is detected. |
| 302 | |
| 303 | \param pMac |
| 304 | \param pMsg - Pointer to message posted from SME to LIM. |
| 305 | \return TRUE - If defered |
| 306 | FALSE - Otherwise |
| 307 | ------------------------------------------------------------------*/ |
| 308 | static tANI_BOOLEAN |
| 309 | __limIsDeferedMsgForRadar(tpAniSirGlobal pMac, tpSirMsgQ pMsg) |
| 310 | { |
| 311 | /** fRadarDetCurOperChan will be set only if we detect radar in current |
| 312 | * operating channel and System Role == AP ROLE */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 313 | //TODO: Need to take care radar detection. |
| 314 | //if (LIM_IS_RADAR_DETECTED(pMac)) |
| 315 | if( 0 ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 316 | { |
| 317 | if (limDeferMsg(pMac, pMsg) != TX_SUCCESS) |
| 318 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 319 | PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 320 | return eANI_BOOLEAN_FALSE; |
| 321 | } |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 322 | PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 323 | pMsg->type);) |
| 324 | return eANI_BOOLEAN_TRUE; |
| 325 | } |
| 326 | return eANI_BOOLEAN_FALSE; |
| 327 | } |
| 328 | |
| 329 | |
| 330 | /** |
| 331 | * __limProcessSmeStartReq() |
| 332 | * |
| 333 | *FUNCTION: |
| 334 | * This function is called to process SME_START_REQ message |
| 335 | * from HDD or upper layer application. |
| 336 | * |
| 337 | *LOGIC: |
| 338 | * |
| 339 | *ASSUMPTIONS: |
| 340 | * |
| 341 | *NOTE: |
| 342 | * |
| 343 | * @param pMac Pointer to Global MAC structure |
| 344 | * @param *pMsgBuf A pointer to the SME message buffer |
| 345 | * @return None |
| 346 | */ |
| 347 | |
| 348 | static void |
| 349 | __limProcessSmeStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 350 | { |
| 351 | tSirResultCodes retCode = eSIR_SME_SUCCESS; |
| 352 | tANI_U8 smesessionId; |
| 353 | tANI_U16 smetransactionId; |
| 354 | |
| 355 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 356 | limLog(pMac, LOG1, FL("Received SME_START_REQ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 357 | |
| 358 | limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId); |
| 359 | |
| 360 | if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) |
| 361 | { |
| 362 | pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE; |
| 363 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 364 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 365 | |
| 366 | /// By default do not return after first scan match |
| 367 | pMac->lim.gLimReturnAfterFirstMatch = 0; |
| 368 | |
| 369 | /// Initialize MLM state machine |
| 370 | limInitMlm(pMac); |
| 371 | |
| 372 | /// By default return unique scan results |
| 373 | pMac->lim.gLimReturnUniqueResults = true; |
| 374 | pMac->lim.gLimSmeScanResultLength = 0; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 375 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 376 | pMac->lim.gLimSmeLfrScanResultLength = 0; |
| 377 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 378 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 379 | if (((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd) |
| 380 | { |
| 381 | /* |
| 382 | * Need to indicate new BSSs found during background scanning to |
| 383 | * host. Update this parameter at CFG |
| 384 | */ |
| 385 | if (cfgSetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, ((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd) |
| 386 | != eSIR_SUCCESS) |
| 387 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 388 | limLog(pMac, LOGP, FL("could not set NEIGHBOR_BSS_IND at CFG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 389 | retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE; |
| 390 | } |
| 391 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 392 | } |
| 393 | else |
| 394 | { |
| 395 | /** |
| 396 | * Should not have received eWNI_SME_START_REQ in states |
| 397 | * other than OFFLINE. Return response to host and |
| 398 | * log error |
| 399 | */ |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 400 | limLog(pMac, LOGE, FL("Invalid SME_START_REQ received in SME state %d"),pMac->lim.gLimSmeState ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 401 | limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState); |
| 402 | retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE; |
| 403 | } |
| 404 | limSendSmeRsp(pMac, eWNI_SME_START_RSP, retCode,smesessionId,smetransactionId); |
| 405 | } /*** end __limProcessSmeStartReq() ***/ |
| 406 | |
| 407 | |
| 408 | /** ------------------------------------------------------------- |
| 409 | \fn __limProcessSmeSysReadyInd |
| 410 | \brief handles the notification from HDD. PE just forwards this message to HAL. |
| 411 | \param tpAniSirGlobal pMac |
| 412 | \param tANI_U32* pMsgBuf |
| 413 | \return TRUE-Posting to HAL failed, so PE will consume the buffer. |
| 414 | \ FALSE-Posting to HAL successful, so HAL will consume the buffer. |
| 415 | -------------------------------------------------------------*/ |
| 416 | static tANI_BOOLEAN |
| 417 | __limProcessSmeSysReadyInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 418 | { |
| 419 | tSirMsgQ msg; |
| 420 | |
| 421 | msg.type = WDA_SYS_READY_IND; |
| 422 | msg.reserved = 0; |
| 423 | msg.bodyptr = pMsgBuf; |
| 424 | msg.bodyval = 0; |
| 425 | |
Jeff Johnson | 9275169 | 2013-03-06 16:00:33 -0800 | [diff] [blame] | 426 | if (pMac->gDriverType != eDRIVER_TYPE_MFG) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 427 | { |
Jeff Johnson | 9275169 | 2013-03-06 16:00:33 -0800 | [diff] [blame] | 428 | peRegisterTLHandle(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 429 | } |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 430 | PELOGW(limLog(pMac, LOGW, FL("sending WDA_SYS_READY_IND msg to HAL"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 431 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 432 | |
Jeff Johnson | 9275169 | 2013-03-06 16:00:33 -0800 | [diff] [blame] | 433 | if (eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 434 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 435 | limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 436 | return eANI_BOOLEAN_TRUE; |
| 437 | } |
| 438 | return eANI_BOOLEAN_FALSE; |
| 439 | } |
| 440 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 441 | #ifdef WLAN_FEATURE_11AC |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 442 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 443 | tANI_U32 limGetCenterChannel(tpAniSirGlobal pMac,tANI_U8 primarychanNum,ePhyChanBondState secondaryChanOffset, tANI_U8 chanWidth) |
| 444 | { |
| 445 | if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ) |
| 446 | { |
| 447 | switch(secondaryChanOffset) |
| 448 | { |
| 449 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
| 450 | return primarychanNum; |
| 451 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 452 | return primarychanNum + 2; |
| 453 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 454 | return primarychanNum - 2; |
| 455 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 456 | return primarychanNum + 6; |
| 457 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 458 | return primarychanNum + 2; |
| 459 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 460 | return primarychanNum - 2; |
| 461 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 462 | return primarychanNum - 6; |
| 463 | default : |
| 464 | return eSIR_CFG_INVALID_ID; |
| 465 | } |
| 466 | } |
| 467 | else if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ) |
| 468 | { |
| 469 | switch(secondaryChanOffset) |
| 470 | { |
| 471 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 472 | return primarychanNum + 2; |
| 473 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 474 | return primarychanNum - 2; |
| 475 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
| 476 | return primarychanNum; |
| 477 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 478 | return primarychanNum + 2; |
| 479 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 480 | return primarychanNum - 2; |
| 481 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 482 | return primarychanNum + 2; |
| 483 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 484 | return primarychanNum - 2; |
| 485 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 486 | return primarychanNum + 2; |
| 487 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 488 | return primarychanNum - 2; |
| 489 | default : |
| 490 | return eSIR_CFG_INVALID_ID; |
| 491 | } |
| 492 | } |
| 493 | return primarychanNum; |
| 494 | } |
| 495 | |
| 496 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 497 | /** |
| 498 | * __limHandleSmeStartBssRequest() |
| 499 | * |
| 500 | *FUNCTION: |
| 501 | * This function is called to process SME_START_BSS_REQ message |
| 502 | * from HDD or upper layer application. |
| 503 | * |
| 504 | *LOGIC: |
| 505 | * |
| 506 | *ASSUMPTIONS: |
| 507 | * |
| 508 | *NOTE: |
| 509 | * |
| 510 | * @param pMac Pointer to Global MAC structure |
| 511 | * @param *pMsgBuf A pointer to the SME message buffer |
| 512 | * @return None |
| 513 | */ |
| 514 | |
| 515 | static void |
| 516 | __limHandleSmeStartBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 517 | { |
| 518 | tANI_U16 size; |
| 519 | tANI_U32 val = 0; |
| 520 | tSirRetStatus retStatus; |
| 521 | tSirMacChanNum channelNumber; |
Jeff Johnson | ace9110 | 2013-04-05 08:03:18 -0700 | [diff] [blame] | 522 | tLimMlmStartReq *pMlmStartReq = NULL; |
| 523 | tpSirSmeStartBssReq pSmeStartBssReq = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 524 | tSirResultCodes retCode = eSIR_SME_SUCCESS; |
| 525 | tANI_U32 autoGenBssId = FALSE; //Flag Used in case of IBSS to Auto generate BSSID. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 526 | tANI_U8 sessionId; |
| 527 | tpPESession psessionEntry = NULL; |
| 528 | tANI_U8 smesessionId; |
| 529 | tANI_U16 smetransactionId; |
| 530 | |
| 531 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 532 | //Since the session is not created yet, sending NULL. The response should have the correct state. |
| 533 | limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_REQ_EVENT, NULL, 0, 0); |
| 534 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 535 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 536 | limLog(pMac, LOG1, FL("Received SME_START_BSS_REQ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 537 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 538 | /* Global Sme state and mlm states are not defined yet, for BT-AMP Suppoprt . TO BE DONE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 539 | if ( (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) || |
| 540 | (pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE)) |
| 541 | { |
| 542 | size = sizeof(tSirSmeStartBssReq) + SIR_MAC_MAX_IE_LENGTH; |
| 543 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 544 | pSmeStartBssReq = vos_mem_malloc(size); |
| 545 | if ( NULL == pSmeStartBssReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 546 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 547 | PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pMac->lim.gpLimStartBssReq"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 548 | /// Send failure response to host |
| 549 | retCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 550 | goto end; |
| 551 | } |
| 552 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 553 | vos_mem_set((void *)pSmeStartBssReq, size, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 554 | |
| 555 | if ((limStartBssReqSerDes(pMac, pSmeStartBssReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) || |
| 556 | (!limIsSmeStartBssReqValid(pMac, pSmeStartBssReq))) |
| 557 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 558 | PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 559 | retCode = eSIR_SME_INVALID_PARAMETERS; |
| 560 | goto free; |
| 561 | } |
| 562 | #if 0 |
| 563 | PELOG3(limLog(pMac, LOG3, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 564 | FL("Parsed START_BSS_REQ fields are bssType=%d, channelId=%d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 565 | pMac->lim.gpLimStartBssReq->bssType, pMac->lim.gpLimStartBssReq->channelId);) |
| 566 | #endif |
| 567 | |
| 568 | /* This is the place where PE is going to create a session. |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 569 | * If session is not existed, then create a new session */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 570 | if((psessionEntry = peFindSessionByBssid(pMac,pSmeStartBssReq->bssId,&sessionId)) != NULL) |
| 571 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 572 | limLog(pMac, LOGW, FL("Session Already exists for given BSSID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 573 | retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED; |
| 574 | psessionEntry = NULL; |
| 575 | goto free; |
| 576 | } |
| 577 | else |
| 578 | { |
| 579 | if((psessionEntry = peCreateSession(pMac,pSmeStartBssReq->bssId,&sessionId, pMac->lim.maxStation)) == NULL) |
| 580 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 581 | limLog(pMac, LOGW, FL("Session Can not be created ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 582 | retCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 583 | goto free; |
| 584 | } |
| 585 | |
| 586 | } |
| 587 | |
| 588 | /* Store the session related parameters in newly created session */ |
| 589 | psessionEntry->pLimStartBssReq = pSmeStartBssReq; |
| 590 | |
| 591 | /* Store PE sessionId in session Table */ |
| 592 | psessionEntry->peSessionId = sessionId; |
| 593 | |
| 594 | /* Store SME session Id in sessionTable */ |
| 595 | psessionEntry->smeSessionId = pSmeStartBssReq->sessionId; |
| 596 | |
| 597 | psessionEntry->transactionId = pSmeStartBssReq->transactionId; |
| 598 | |
| 599 | sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeStartBssReq->selfMacAddr); |
| 600 | |
| 601 | /* Copy SSID to session table */ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 602 | vos_mem_copy( (tANI_U8 *)&psessionEntry->ssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 603 | (tANI_U8 *)&pSmeStartBssReq->ssId, |
| 604 | (pSmeStartBssReq->ssId.length + 1)); |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 605 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 606 | psessionEntry->bssType = pSmeStartBssReq->bssType; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 607 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 608 | psessionEntry->nwType = pSmeStartBssReq->nwType; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 609 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 610 | psessionEntry->beaconParams.beaconInterval = pSmeStartBssReq->beaconInterval; |
| 611 | |
| 612 | /* Store the channel number in session Table */ |
| 613 | psessionEntry->currentOperChannel = pSmeStartBssReq->channelId; |
| 614 | |
| 615 | /*Store Persona */ |
| 616 | psessionEntry->pePersona = pSmeStartBssReq->bssPersona; |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 617 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,FL("PE PERSONA=%d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 618 | psessionEntry->pePersona); |
| 619 | |
| 620 | /*Update the phymode*/ |
| 621 | psessionEntry->gLimPhyMode = pSmeStartBssReq->nwType; |
| 622 | |
| 623 | psessionEntry->maxTxPower = cfgGetRegulatoryMaxTransmitPower( pMac, |
| 624 | psessionEntry->currentOperChannel ); |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 625 | |
| 626 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 627 | /*Store Overlapping BSS Scan Parameters IEs to session table */ |
| 628 | if (pSmeStartBssReq->apHT40_24GEnabled) |
| 629 | { |
| 630 | limInitOBSSScanParams(pMac, psessionEntry); |
| 631 | } |
| 632 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 633 | /* Store the dot 11 mode in to the session Table*/ |
| 634 | |
| 635 | psessionEntry->dot11mode = pSmeStartBssReq->dot11mode; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 636 | psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode); |
| 637 | #ifdef WLAN_FEATURE_11AC |
| 638 | psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode); |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 639 | VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO, |
| 640 | FL("*****psessionEntry->vhtCapability = %d"),psessionEntry->vhtCapability); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 641 | #endif |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 642 | |
| 643 | psessionEntry->txLdpcIniFeatureEnabled = |
| 644 | pSmeStartBssReq->txLdpcIniFeatureEnabled; |
| 645 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 646 | #ifdef WLAN_FEATURE_11W |
| 647 | psessionEntry->limRmfEnabled = pSmeStartBssReq->pmfCapable ? 1 : 0; |
| 648 | limLog(pMac, LOG1, FL("Session RMF enabled: %d"), psessionEntry->limRmfEnabled); |
| 649 | #endif |
| 650 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 651 | vos_mem_copy((void*)&psessionEntry->rateSet, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 652 | (void*)&pSmeStartBssReq->operationalRateSet, |
| 653 | sizeof(tSirMacRateSet)); |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 654 | vos_mem_copy((void*)&psessionEntry->extRateSet, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 655 | (void*)&pSmeStartBssReq->extendedRateSet, |
| 656 | sizeof(tSirMacRateSet)); |
| 657 | |
| 658 | switch(pSmeStartBssReq->bssType) |
| 659 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 660 | case eSIR_INFRA_AP_MODE: |
| 661 | psessionEntry->limSystemRole = eLIM_AP_ROLE; |
| 662 | psessionEntry->privacy = pSmeStartBssReq->privacy; |
| 663 | psessionEntry->fwdWPSPBCProbeReq = pSmeStartBssReq->fwdWPSPBCProbeReq; |
| 664 | psessionEntry->authType = pSmeStartBssReq->authType; |
| 665 | /* Store the DTIM period */ |
| 666 | psessionEntry->dtimPeriod = (tANI_U8)pSmeStartBssReq->dtimPeriod; |
| 667 | /*Enable/disable UAPSD*/ |
| 668 | psessionEntry->apUapsdEnable = pSmeStartBssReq->apUapsdEnable; |
| 669 | if (psessionEntry->pePersona == VOS_P2P_GO_MODE) |
| 670 | { |
| 671 | psessionEntry->proxyProbeRspEn = 0; |
| 672 | } |
| 673 | else |
| 674 | { |
| 675 | /* To detect PBC overlap in SAP WPS mode, Host handles |
| 676 | * Probe Requests. |
| 677 | */ |
| 678 | if(SAP_WPS_DISABLED == pSmeStartBssReq->wps_state) |
| 679 | { |
| 680 | psessionEntry->proxyProbeRspEn = 1; |
| 681 | } |
| 682 | else |
| 683 | { |
| 684 | psessionEntry->proxyProbeRspEn = 0; |
| 685 | } |
| 686 | } |
| 687 | psessionEntry->ssidHidden = pSmeStartBssReq->ssidHidden; |
| 688 | psessionEntry->wps_state = pSmeStartBssReq->wps_state; |
krunal soni | 45b9eb6 | 2014-03-26 12:54:25 -0700 | [diff] [blame] | 689 | limGetShortSlotFromPhyMode(pMac, psessionEntry, |
| 690 | psessionEntry->gLimPhyMode, |
| 691 | &psessionEntry->shortSlotTimeSupported); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 692 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 693 | case eSIR_IBSS_MODE: |
| 694 | psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE; |
krunal soni | 45b9eb6 | 2014-03-26 12:54:25 -0700 | [diff] [blame] | 695 | limGetShortSlotFromPhyMode(pMac, psessionEntry, |
| 696 | psessionEntry->gLimPhyMode, |
| 697 | &psessionEntry->shortSlotTimeSupported); |
Abhishek Singh | d5c3127 | 2014-03-07 14:46:50 +0530 | [diff] [blame] | 698 | /* In WPA-NONE case we wont get the privacy bit in ibss config |
| 699 | * from supplicant, but we are updating WNI_CFG_PRIVACY_ENABLED |
| 700 | * on basis of Encryption type in csrRoamSetBssConfigCfg. So |
| 701 | * get the privacy info from WNI_CFG_PRIVACY_ENABLED |
| 702 | */ |
| 703 | if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED, &val) |
| 704 | != eSIR_SUCCESS) |
| 705 | limLog(pMac, LOGE, FL("cfg get WNI_CFG_PRIVACY_ENABLED" |
| 706 | " failed")); |
| 707 | psessionEntry->privacy =(tANI_U8) val; |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 708 | psessionEntry->isCoalesingInIBSSAllowed = |
| 709 | pSmeStartBssReq->isCoalesingInIBSSAllowed; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 710 | break; |
| 711 | |
| 712 | case eSIR_BTAMP_AP_MODE: |
| 713 | psessionEntry->limSystemRole = eLIM_BT_AMP_AP_ROLE; |
| 714 | break; |
| 715 | |
| 716 | case eSIR_BTAMP_STA_MODE: |
| 717 | psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE; |
| 718 | break; |
| 719 | |
| 720 | /* There is one more mode called auto mode. which is used no where */ |
| 721 | |
| 722 | //FORBUILD -TEMPFIX.. HOW TO use AUTO MODE????? |
| 723 | |
| 724 | |
| 725 | default: |
| 726 | //not used anywhere...used in scan function |
| 727 | break; |
| 728 | } |
| 729 | |
| 730 | // BT-AMP: Allocate memory for the array of parsed (Re)Assoc request structure |
| 731 | if ( (pSmeStartBssReq->bssType == eSIR_BTAMP_AP_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 732 | || (pSmeStartBssReq->bssType == eSIR_INFRA_AP_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 733 | ) |
| 734 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 735 | psessionEntry->parsedAssocReq = vos_mem_malloc( |
| 736 | psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)); |
| 737 | if ( NULL == psessionEntry->parsedAssocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 738 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 739 | limLog(pMac, LOGW, FL("AllocateMemory() failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 740 | retCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 741 | goto free; |
| 742 | } |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 743 | vos_mem_set(psessionEntry->parsedAssocReq, |
| 744 | (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)), |
| 745 | 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 746 | } |
| 747 | |
| 748 | /* Channel Bonding is not addressd yet for BT-AMP Support.. sunit will address channel bonding */ |
| 749 | if (pSmeStartBssReq->channelId) |
| 750 | { |
| 751 | channelNumber = pSmeStartBssReq->channelId; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 752 | psessionEntry->htSupportedChannelWidthSet = (pSmeStartBssReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes |
| 753 | psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet; |
| 754 | psessionEntry->htSecondaryChannelOffset = pSmeStartBssReq->cbMode; |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 755 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 756 | FL("cbMode %u"), pSmeStartBssReq->cbMode); |
| 757 | #ifdef WLAN_FEATURE_11AC |
| 758 | if(psessionEntry->vhtCapability) |
| 759 | { |
| 760 | tANI_U32 centerChan; |
| 761 | tANI_U32 chanWidth; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 762 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 763 | if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, |
| 764 | &chanWidth) != eSIR_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 765 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 766 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 767 | FL("Unable to retrieve Channel Width from CFG")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 768 | } |
Abhishek Singh | b92f70c | 2014-04-28 12:13:08 +0530 | [diff] [blame] | 769 | |
Abhishek Singh | 921926b | 2014-02-13 17:21:01 +0530 | [diff] [blame] | 770 | if(channelNumber <= RF_CHAN_14 && |
Abhishek Singh | b92f70c | 2014-04-28 12:13:08 +0530 | [diff] [blame] | 771 | chanWidth != eHT_CHANNEL_WIDTH_20MHZ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 772 | { |
Abhishek Singh | b92f70c | 2014-04-28 12:13:08 +0530 | [diff] [blame] | 773 | chanWidth = eHT_CHANNEL_WIDTH_20MHZ; |
Abhishek Singh | 921926b | 2014-02-13 17:21:01 +0530 | [diff] [blame] | 774 | limLog(pMac, LOG1, FL("Setting chanWidth to 20Mhz for" |
| 775 | " channel %d"),channelNumber); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 776 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 777 | |
Abhishek Singh | b92f70c | 2014-04-28 12:13:08 +0530 | [diff] [blame] | 778 | if(chanWidth == eHT_CHANNEL_WIDTH_20MHZ || |
| 779 | chanWidth == eHT_CHANNEL_WIDTH_40MHZ) |
Abhishek Singh | 921926b | 2014-02-13 17:21:01 +0530 | [diff] [blame] | 780 | { |
Abhishek Singh | b92f70c | 2014-04-28 12:13:08 +0530 | [diff] [blame] | 781 | if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, |
| 782 | WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ) |
| 783 | != eSIR_SUCCESS) |
| 784 | { |
| 785 | limLog(pMac, LOGP, FL("could not set " |
| 786 | " WNI_CFG_CHANNEL_BONDING_MODE at CFG")); |
| 787 | retCode = eSIR_LOGP_EXCEPTION; |
| 788 | goto free; |
| 789 | } |
| 790 | } |
| 791 | if (chanWidth == eHT_CHANNEL_WIDTH_80MHZ) |
| 792 | { |
| 793 | if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, |
| 794 | WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ) |
| 795 | != eSIR_SUCCESS) |
| 796 | { |
| 797 | limLog(pMac, LOGP, FL("could not set " |
| 798 | " WNI_CFG_CHANNEL_BONDING_MODE at CFG")); |
| 799 | retCode = eSIR_LOGP_EXCEPTION; |
| 800 | goto free; |
| 801 | } |
| 802 | |
| 803 | centerChan = limGetCenterChannel( pMac, channelNumber, |
| 804 | pSmeStartBssReq->cbMode, |
| 805 | WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 806 | if(centerChan != eSIR_CFG_INVALID_ID) |
| 807 | { |
Abhishek Singh | b92f70c | 2014-04-28 12:13:08 +0530 | [diff] [blame] | 808 | limLog(pMac, LOGW, FL("***Center Channel for " |
| 809 | "80MHZ channel width = %d"),centerChan); |
Madan Mohan Koyyalamudi | 8b152b8 | 2012-10-18 20:56:27 -0700 | [diff] [blame] | 810 | psessionEntry->apCenterChan = centerChan; |
Abhishek Singh | 921926b | 2014-02-13 17:21:01 +0530 | [diff] [blame] | 811 | if (cfgSetInt(pMac, |
Abhishek Singh | b92f70c | 2014-04-28 12:13:08 +0530 | [diff] [blame] | 812 | WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1, |
| 813 | centerChan) != eSIR_SUCCESS) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 814 | { |
Abhishek Singh | 921926b | 2014-02-13 17:21:01 +0530 | [diff] [blame] | 815 | limLog(pMac, LOGP, FL("could not set " |
Abhishek Singh | b92f70c | 2014-04-28 12:13:08 +0530 | [diff] [blame] | 816 | "WNI_CFG_CHANNEL_BONDING_MODE at CFG")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 817 | retCode = eSIR_LOGP_EXCEPTION; |
| 818 | goto free; |
| 819 | } |
| 820 | } |
| 821 | } |
| 822 | |
Abhishek Singh | b92f70c | 2014-04-28 12:13:08 +0530 | [diff] [blame] | 823 | /* All the translation is done by now for gVhtChannelWidth |
| 824 | * from .ini file to the actual values as defined in spec. |
| 825 | * So, grabing the spec value which is |
| 826 | * updated in .dat file by the above logic */ |
| 827 | if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, |
| 828 | &chanWidth) != eSIR_SUCCESS) |
| 829 | { |
| 830 | limLog(pMac, LOGP, |
| 831 | FL("Unable to retrieve Channel Width from CFG")); |
| 832 | } |
Madan Mohan Koyyalamudi | 8b152b8 | 2012-10-18 20:56:27 -0700 | [diff] [blame] | 833 | /*For Sta+p2p-Go concurrency |
| 834 | vhtTxChannelWidthSet is used for storing p2p-GO channel width |
| 835 | apChanWidth is used for storing the AP channel width that the Sta is going to associate. |
| 836 | Initialize the apChanWidth same as p2p-GO channel width this gets over written once the station joins the AP |
| 837 | */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 838 | psessionEntry->vhtTxChannelWidthSet = chanWidth; |
Madan Mohan Koyyalamudi | 8b152b8 | 2012-10-18 20:56:27 -0700 | [diff] [blame] | 839 | psessionEntry->apChanWidth = chanWidth; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 840 | } |
| 841 | psessionEntry->htSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode); |
| 842 | #endif |
| 843 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 844 | else |
| 845 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 846 | PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 847 | retCode = eSIR_SME_INVALID_PARAMETERS; |
| 848 | goto free; |
| 849 | } |
| 850 | |
| 851 | // Delete pre-auth list if any |
| 852 | limDeletePreAuthList(pMac); |
| 853 | |
| 854 | // Delete IBSS peer BSSdescription list if any |
| 855 | //limIbssDelete(pMac); sep 26 review |
| 856 | |
| 857 | |
| 858 | |
| 859 | #ifdef FIXME_GEN6 //following code may not be required. limInitMlm is now being invoked during peStart |
| 860 | /// Initialize MLM state machine |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 861 | limInitMlm(pMac); |
| 862 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 863 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 864 | psessionEntry->htCapability = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 865 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 866 | /* keep the RSN/WPA IE information in PE Session Entry |
| 867 | * later will be using this to check when received (Re)Assoc req |
| 868 | * */ |
| 869 | limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac,&pSmeStartBssReq->rsnIE,psessionEntry); |
| 870 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 871 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 872 | //Taken care for only softAP case rest need to be done |
| 873 | if (psessionEntry->limSystemRole == eLIM_AP_ROLE){ |
| 874 | psessionEntry->gLimProtectionControl = pSmeStartBssReq->protEnabled; |
| 875 | /*each byte will have the following info |
| 876 | *bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 |
| 877 | *reserved reserved RIFS Lsig n-GF ht20 11g 11b*/ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 878 | vos_mem_copy( (void *) &psessionEntry->cfgProtection, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 879 | (void *) &pSmeStartBssReq->ht_capab, |
Kiran Kumar Lokere | a4db3dc | 2013-03-25 18:05:24 -0700 | [diff] [blame] | 880 | sizeof( tANI_U16 )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 881 | psessionEntry->pAPWPSPBCSession = NULL; // Initialize WPS PBC session link list |
| 882 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 883 | |
| 884 | // Prepare and Issue LIM_MLM_START_REQ to MLM |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 885 | pMlmStartReq = vos_mem_malloc(sizeof(tLimMlmStartReq)); |
| 886 | if ( NULL == pMlmStartReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 887 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 888 | limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmStartReq")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 889 | retCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 890 | goto free; |
| 891 | } |
| 892 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 893 | vos_mem_set((void *) pMlmStartReq, sizeof(tLimMlmStartReq), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 894 | |
| 895 | /* Copy SSID to the MLM start structure */ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 896 | vos_mem_copy( (tANI_U8 *) &pMlmStartReq->ssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 897 | (tANI_U8 *) &pSmeStartBssReq->ssId, |
| 898 | pSmeStartBssReq->ssId.length + 1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 899 | pMlmStartReq->ssidHidden = pSmeStartBssReq->ssidHidden; |
| 900 | pMlmStartReq->obssProtEnabled = pSmeStartBssReq->obssProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 901 | |
| 902 | |
| 903 | pMlmStartReq->bssType = psessionEntry->bssType; |
| 904 | |
| 905 | /* Fill PE session Id from the session Table */ |
| 906 | pMlmStartReq->sessionId = psessionEntry->peSessionId; |
| 907 | |
| 908 | if( (pMlmStartReq->bssType == eSIR_BTAMP_STA_MODE) || (pMlmStartReq->bssType == eSIR_BTAMP_AP_MODE ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 909 | || (pMlmStartReq->bssType == eSIR_INFRA_AP_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 910 | ) |
| 911 | { |
| 912 | //len = sizeof(tSirMacAddr); |
| 913 | //retStatus = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, (tANI_U8 *) pMlmStartReq->bssId, &len); |
| 914 | //if (retStatus != eSIR_SUCCESS) |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 915 | //limLog(pMac, LOGP, FL("could not retrive BSSID, retStatus=%d"), retStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 916 | |
| 917 | /* Copy the BSSId from sessionTable to mlmStartReq struct */ |
| 918 | sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId); |
| 919 | } |
| 920 | |
| 921 | else // ibss mode |
| 922 | { |
| 923 | pMac->lim.gLimIbssCoalescingHappened = false; |
| 924 | |
| 925 | if((retStatus = wlan_cfgGetInt(pMac, WNI_CFG_IBSS_AUTO_BSSID, &autoGenBssId)) != eSIR_SUCCESS) |
| 926 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 927 | limLog(pMac, LOGP, FL("Could not retrieve Auto Gen BSSID, retStatus=%d"), retStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 928 | retCode = eSIR_LOGP_EXCEPTION; |
| 929 | goto free; |
| 930 | } |
| 931 | |
| 932 | if(!autoGenBssId) |
| 933 | { |
| 934 | // We're not auto generating BSSID. Instead, get it from session entry |
| 935 | sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId); |
| 936 | |
| 937 | if(pMlmStartReq->bssId[0] & 0x01) |
| 938 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 939 | PELOGE(limLog(pMac, LOGE, FL("Request to start IBSS with group BSSID\n Autogenerating the BSSID"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 940 | autoGenBssId = TRUE; |
| 941 | } |
| 942 | } |
| 943 | |
| 944 | if( autoGenBssId ) |
| 945 | { //if BSSID is not any uc id. then use locally generated BSSID. |
| 946 | //Autogenerate the BSSID |
| 947 | limGetRandomBssid( pMac, pMlmStartReq->bssId); |
| 948 | pMlmStartReq->bssId[0]= 0x02; |
| 949 | |
| 950 | /* Copy randomly generated BSSID to the session Table */ |
| 951 | sirCopyMacAddr(psessionEntry->bssId,pMlmStartReq->bssId); |
| 952 | } |
| 953 | } |
| 954 | /* store the channel num in mlmstart req structure */ |
| 955 | pMlmStartReq->channelNumber = psessionEntry->currentOperChannel; |
| 956 | pMlmStartReq->cbMode = pSmeStartBssReq->cbMode; |
| 957 | pMlmStartReq->beaconPeriod = psessionEntry->beaconParams.beaconInterval; |
| 958 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 959 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){ |
| 960 | pMlmStartReq->dtimPeriod = psessionEntry->dtimPeriod; |
| 961 | pMlmStartReq->wps_state = psessionEntry->wps_state; |
| 962 | |
| 963 | }else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 964 | { |
| 965 | if (wlan_cfgGetInt(pMac, WNI_CFG_DTIM_PERIOD, &val) != eSIR_SUCCESS) |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 966 | limLog(pMac, LOGP, FL("could not retrieve DTIM Period")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 967 | pMlmStartReq->dtimPeriod = (tANI_U8)val; |
| 968 | } |
| 969 | |
| 970 | if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_PERIOD, &val) != eSIR_SUCCESS) |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 971 | limLog(pMac, LOGP, FL("could not retrieve Beacon interval")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 972 | pMlmStartReq->cfParamSet.cfpPeriod = (tANI_U8)val; |
| 973 | |
| 974 | if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_MAX_DURATION, &val) != eSIR_SUCCESS) |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 975 | limLog(pMac, LOGP, FL("could not retrieve CFPMaxDuration")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 976 | pMlmStartReq->cfParamSet.cfpMaxDuration = (tANI_U16) val; |
| 977 | |
| 978 | //this may not be needed anymore now, as rateSet is now included in the session entry and MLM has session context. |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 979 | vos_mem_copy((void*)&pMlmStartReq->rateSet, (void*)&psessionEntry->rateSet, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 980 | sizeof(tSirMacRateSet)); |
| 981 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 982 | // Now populate the 11n related parameters |
| 983 | pMlmStartReq->nwType = psessionEntry->nwType; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 984 | pMlmStartReq->htCapable = psessionEntry->htCapability; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 985 | // |
| 986 | // FIXME_GEN4 - Determine the appropriate defaults... |
| 987 | // |
| 988 | pMlmStartReq->htOperMode = pMac->lim.gHTOperMode; |
| 989 | pMlmStartReq->dualCTSProtection = pMac->lim.gHTDualCTSProtection; // Unused |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 990 | pMlmStartReq->txChannelWidthSet = psessionEntry->htRecommendedTxWidthSet; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 991 | |
| 992 | /* sep26 review */ |
| 993 | psessionEntry->limRFBand = limGetRFBand(channelNumber); |
| 994 | |
| 995 | // Initialize 11h Enable Flag |
| 996 | psessionEntry->lim11hEnable = 0; |
| 997 | if((pMlmStartReq->bssType != eSIR_IBSS_MODE) && |
| 998 | (SIR_BAND_5_GHZ == psessionEntry->limRFBand) ) |
| 999 | { |
| 1000 | if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS) |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1001 | limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1002 | psessionEntry->lim11hEnable = val; |
| 1003 | } |
| 1004 | |
| 1005 | if (!psessionEntry->lim11hEnable) |
| 1006 | { |
| 1007 | if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, 0) != eSIR_SUCCESS) |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1008 | limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1009 | } |
| 1010 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1011 | psessionEntry ->limPrevSmeState = psessionEntry->limSmeState; |
| 1012 | psessionEntry ->limSmeState = eLIM_SME_WT_START_BSS_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1013 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry ->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1014 | |
| 1015 | limPostMlmMessage(pMac, LIM_MLM_START_REQ, (tANI_U32 *) pMlmStartReq); |
| 1016 | return; |
| 1017 | } |
| 1018 | else |
| 1019 | { |
| 1020 | |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1021 | limLog(pMac, LOGE, FL("Received unexpected START_BSS_REQ, in state %X"),pMac->lim.gLimSmeState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1022 | retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED; |
| 1023 | goto end; |
| 1024 | } // if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) |
| 1025 | |
| 1026 | free: |
Jeff Johnson | ace9110 | 2013-04-05 08:03:18 -0700 | [diff] [blame] | 1027 | if ((psessionEntry != NULL) && |
| 1028 | (psessionEntry->pLimStartBssReq == pSmeStartBssReq)) |
| 1029 | { |
| 1030 | psessionEntry->pLimStartBssReq = NULL; |
| 1031 | } |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1032 | vos_mem_free( pSmeStartBssReq); |
| 1033 | vos_mem_free( pMlmStartReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1034 | |
| 1035 | end: |
| 1036 | |
| 1037 | /* This routine should return the sme sessionId and SME transaction Id */ |
| 1038 | limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId); |
| 1039 | |
| 1040 | if(NULL != psessionEntry) |
| 1041 | { |
| 1042 | peDeleteSession(pMac,psessionEntry); |
| 1043 | psessionEntry = NULL; |
| 1044 | } |
| 1045 | limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP, retCode,psessionEntry,smesessionId,smetransactionId); |
| 1046 | } /*** end __limHandleSmeStartBssRequest() ***/ |
| 1047 | |
| 1048 | |
| 1049 | /**-------------------------------------------------------------- |
| 1050 | \fn __limProcessSmeStartBssReq |
| 1051 | |
| 1052 | \brief Wrapper for the function __limHandleSmeStartBssRequest |
| 1053 | This message will be defered until softmac come out of |
| 1054 | scan mode or if we have detected radar on the current |
| 1055 | operating channel. |
| 1056 | \param pMac |
| 1057 | \param pMsg |
| 1058 | |
| 1059 | \return TRUE - If we consumed the buffer |
| 1060 | FALSE - If have defered the message. |
| 1061 | ---------------------------------------------------------------*/ |
| 1062 | static tANI_BOOLEAN |
| 1063 | __limProcessSmeStartBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg) |
| 1064 | { |
| 1065 | if (__limIsDeferedMsgForLearn(pMac, pMsg) || |
| 1066 | __limIsDeferedMsgForRadar(pMac, pMsg)) |
| 1067 | { |
| 1068 | /** |
| 1069 | * If message defered, buffer is not consumed yet. |
| 1070 | * So return false |
| 1071 | */ |
| 1072 | return eANI_BOOLEAN_FALSE; |
| 1073 | } |
| 1074 | |
| 1075 | __limHandleSmeStartBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr); |
| 1076 | return eANI_BOOLEAN_TRUE; |
| 1077 | } |
| 1078 | |
| 1079 | |
| 1080 | /** |
| 1081 | * limGetRandomBssid() |
| 1082 | * |
| 1083 | * FUNCTION:This function is called to process generate the random number for bssid |
| 1084 | * This function is called to process SME_SCAN_REQ message |
| 1085 | * from HDD or upper layer application. |
| 1086 | * |
| 1087 | * LOGIC: |
| 1088 | * |
| 1089 | * ASSUMPTIONS: |
| 1090 | * |
| 1091 | * NOTE: |
| 1092 | * 1. geneartes the unique random number for bssid in ibss |
| 1093 | * |
| 1094 | * @param pMac Pointer to Global MAC structure |
| 1095 | * @param *data Pointer to bssid buffer |
| 1096 | * @return None |
| 1097 | */ |
| 1098 | void limGetRandomBssid(tpAniSirGlobal pMac, tANI_U8 *data) |
| 1099 | { |
| 1100 | tANI_U32 random[2] ; |
| 1101 | random[0] = tx_time_get(); |
| 1102 | random[0] |= (random[0] << 15) ; |
| 1103 | random[1] = random[0] >> 1; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1104 | vos_mem_copy( data, (tANI_U8*)random, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1105 | } |
| 1106 | |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1107 | static eHalStatus limSendHalStartScanOffloadReq(tpAniSirGlobal pMac, |
| 1108 | tpSirSmeScanReq pScanReq) |
| 1109 | { |
| 1110 | tSirScanOffloadReq *pScanOffloadReq; |
| 1111 | tANI_U8 *p; |
| 1112 | tSirMsgQ msg; |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1113 | tANI_U16 i, len; |
| 1114 | tSirRetStatus rc = eSIR_SUCCESS; |
| 1115 | |
| 1116 | /* The tSirScanOffloadReq will reserve the space for first channel, |
| 1117 | so allocate the memory for (numChannels - 1) and uIEFieldLen */ |
| 1118 | len = sizeof(tSirScanOffloadReq) + (pScanReq->channelList.numChannels - 1) + |
| 1119 | pScanReq->uIEFieldLen; |
| 1120 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1121 | pScanOffloadReq = vos_mem_malloc(len); |
| 1122 | if ( NULL == pScanOffloadReq ) |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1123 | { |
| 1124 | limLog(pMac, LOGE, |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1125 | FL("AllocateMemory failed for pScanOffloadReq")); |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1126 | return eHAL_STATUS_FAILURE; |
| 1127 | } |
| 1128 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1129 | vos_mem_set( (tANI_U8 *) pScanOffloadReq, len, 0); |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1130 | |
| 1131 | msg.type = WDA_START_SCAN_OFFLOAD_REQ; |
| 1132 | msg.bodyptr = pScanOffloadReq; |
| 1133 | msg.bodyval = 0; |
| 1134 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1135 | vos_mem_copy((tANI_U8 *) pScanOffloadReq->bssId, |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1136 | (tANI_U8*) pScanReq->bssId, |
| 1137 | sizeof(tSirMacAddr)); |
| 1138 | |
| 1139 | if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID) |
| 1140 | { |
| 1141 | limLog(pMac, LOGE, |
| 1142 | FL("Invalid value (%d) for numSsid"), SIR_SCAN_MAX_NUM_SSID); |
Kiet Lam | b123319 | 2013-11-28 13:38:20 +0530 | [diff] [blame] | 1143 | vos_mem_free (pScanOffloadReq); |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1144 | return eHAL_STATUS_FAILURE; |
| 1145 | } |
| 1146 | |
| 1147 | pScanOffloadReq->numSsid = pScanReq->numSsid; |
| 1148 | for (i = 0; i < pScanOffloadReq->numSsid; i++) |
| 1149 | { |
| 1150 | pScanOffloadReq->ssId[i].length = pScanReq->ssId[i].length; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1151 | vos_mem_copy((tANI_U8 *) pScanOffloadReq->ssId[i].ssId, |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1152 | (tANI_U8 *) pScanReq->ssId[i].ssId, |
| 1153 | pScanOffloadReq->ssId[i].length); |
| 1154 | } |
| 1155 | |
| 1156 | pScanOffloadReq->hiddenSsid = pScanReq->hiddenSsid; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1157 | vos_mem_copy((tANI_U8 *) pScanOffloadReq->selfMacAddr, |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1158 | (tANI_U8 *) pScanReq->selfMacAddr, |
| 1159 | sizeof(tSirMacAddr)); |
| 1160 | pScanOffloadReq->bssType = pScanReq->bssType; |
| 1161 | pScanOffloadReq->dot11mode = pScanReq->dot11mode; |
| 1162 | pScanOffloadReq->scanType = pScanReq->scanType; |
| 1163 | pScanOffloadReq->minChannelTime = pScanReq->minChannelTime; |
| 1164 | pScanOffloadReq->maxChannelTime = pScanReq->maxChannelTime; |
| 1165 | pScanOffloadReq->p2pSearch = pScanReq->p2pSearch; |
| 1166 | pScanOffloadReq->sessionId = pScanReq->sessionId; |
| 1167 | pScanOffloadReq->channelList.numChannels = |
| 1168 | pScanReq->channelList.numChannels; |
| 1169 | p = &(pScanOffloadReq->channelList.channelNumber[0]); |
| 1170 | for (i = 0; i < pScanOffloadReq->channelList.numChannels; i++) |
| 1171 | p[i] = pScanReq->channelList.channelNumber[i]; |
| 1172 | |
| 1173 | pScanOffloadReq->uIEFieldLen = pScanReq->uIEFieldLen; |
| 1174 | pScanOffloadReq->uIEFieldOffset = len - pScanOffloadReq->uIEFieldLen; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1175 | vos_mem_copy((tANI_U8 *) p + i, |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1176 | (tANI_U8 *) pScanReq + pScanReq->uIEFieldOffset, |
| 1177 | pScanOffloadReq->uIEFieldLen); |
| 1178 | |
| 1179 | rc = wdaPostCtrlMsg(pMac, &msg); |
| 1180 | if (rc != eSIR_SUCCESS) |
| 1181 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1182 | limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure")); |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1183 | vos_mem_free(pScanOffloadReq); |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1184 | return eHAL_STATUS_FAILURE; |
| 1185 | } |
Rashmi Ramanna | 6c13a34 | 2014-01-07 11:44:07 +0530 | [diff] [blame] | 1186 | limLog(pMac, LOG1, FL("Processed Offload Scan Request Successfully")); |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1187 | |
| 1188 | return eHAL_STATUS_SUCCESS; |
| 1189 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1190 | |
| 1191 | /** |
| 1192 | * __limProcessSmeScanReq() |
| 1193 | * |
| 1194 | *FUNCTION: |
| 1195 | * This function is called to process SME_SCAN_REQ message |
| 1196 | * from HDD or upper layer application. |
| 1197 | * |
| 1198 | *LOGIC: |
| 1199 | * |
| 1200 | *ASSUMPTIONS: |
| 1201 | * |
| 1202 | *NOTE: |
| 1203 | * 1. Periodic scanning should be requesting to return unique |
| 1204 | * scan results. |
| 1205 | * |
| 1206 | * @param pMac Pointer to Global MAC structure |
| 1207 | * @param *pMsgBuf A pointer to the SME message buffer |
| 1208 | * @return None |
| 1209 | */ |
| 1210 | |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 1211 | static void |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1212 | __limProcessSmeScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 1213 | { |
| 1214 | tANI_U32 len; |
| 1215 | tLimMlmScanReq *pMlmScanReq; |
| 1216 | tpSirSmeScanReq pScanReq; |
| 1217 | tANI_U8 i = 0; |
| 1218 | |
| 1219 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 1220 | limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_REQ_EVENT, NULL, 0, 0); |
| 1221 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 1222 | |
| 1223 | pScanReq = (tpSirSmeScanReq) pMsgBuf; |
Sushant Kaushik | e0d2cce | 2014-04-10 14:36:07 +0530 | [diff] [blame] | 1224 | limLog(pMac, LOG1,FL("SME SCAN REQ numChan %d min %d max %d IELen %d" |
| 1225 | "first %d fresh %d unique %d type %s (%d)" |
| 1226 | " mode %s (%d)rsp %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1227 | pScanReq->channelList.numChannels, |
| 1228 | pScanReq->minChannelTime, |
| 1229 | pScanReq->maxChannelTime, |
| 1230 | pScanReq->uIEFieldLen, |
| 1231 | pScanReq->returnAfterFirstMatch, |
| 1232 | pScanReq->returnFreshResults, |
| 1233 | pScanReq->returnUniqueResults, |
Sushant Kaushik | e0d2cce | 2014-04-10 14:36:07 +0530 | [diff] [blame] | 1234 | lim_ScanTypetoString(pScanReq->scanType), |
Madan Mohan Koyyalamudi | 70bb4cb | 2012-10-18 19:31:25 -0700 | [diff] [blame] | 1235 | pScanReq->scanType, |
Sushant Kaushik | e0d2cce | 2014-04-10 14:36:07 +0530 | [diff] [blame] | 1236 | lim_BackgroundScanModetoString(pScanReq->backgroundScanMode), |
| 1237 | pScanReq->backgroundScanMode, pMac->lim.gLimRspReqd ? 1 : 0); |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 1238 | |
| 1239 | /* Since scan req always requires a response, we will overwrite response required here. |
| 1240 | * This is added esp to take care of the condition where in p2p go case, we hold the scan req and |
| 1241 | * insert single NOA. We send the held scan request to FW later on getting start NOA ind from FW so |
| 1242 | * we lose state of the gLimRspReqd flag for the scan req if any other request comes by then. |
| 1243 | * e.g. While unit testing, we found when insert single NOA is done, we see a get stats request which turns the flag |
| 1244 | * gLimRspReqd to FALSE; now when we actually start the saved scan req for init scan after getting |
| 1245 | * NOA started, the gLimRspReqd being a global flag is showing FALSE instead of TRUE value for |
| 1246 | * this saved scan req. Since all scan reqs coming to lim require a response, there is no harm in setting |
| 1247 | * the global flag gLimRspReqd to TRUE here. |
| 1248 | */ |
| 1249 | pMac->lim.gLimRspReqd = TRUE; |
| 1250 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1251 | /*copy the Self MAC address from SmeReq to the globalplace, used for sending probe req*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1252 | sirCopyMacAddr(pMac->lim.gSelfMacAddr, pScanReq->selfMacAddr); |
| 1253 | |
| 1254 | /* This routine should return the sme sessionId and SME transaction Id */ |
| 1255 | |
| 1256 | if (!limIsSmeScanReqValid(pMac, pScanReq)) |
| 1257 | { |
Rashmi Ramanna | 6c13a34 | 2014-01-07 11:44:07 +0530 | [diff] [blame] | 1258 | limLog(pMac, LOGE, FL("Received SME_SCAN_REQ with invalid parameters")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1259 | |
| 1260 | if (pMac->lim.gLimRspReqd) |
| 1261 | { |
| 1262 | pMac->lim.gLimRspReqd = false; |
| 1263 | |
| 1264 | limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId); |
| 1265 | |
| 1266 | } // if (pMac->lim.gLimRspReqd) |
| 1267 | |
| 1268 | return; |
| 1269 | } |
| 1270 | |
| 1271 | //if scan is disabled then return as invalid scan request. |
| 1272 | //if scan in power save is disabled, and system is in power save mode, then ignore scan request. |
| 1273 | if( (pMac->lim.fScanDisabled) || (!pMac->lim.gScanInPowersave && !limIsSystemInActiveState(pMac)) ) |
| 1274 | { |
Rashmi Ramanna | 6c13a34 | 2014-01-07 11:44:07 +0530 | [diff] [blame] | 1275 | limLog(pMac, LOGE, FL("SCAN is disabled or SCAN in power save" |
| 1276 | " is disabled and system is in power save.")); |
Leela V Kiran Kumar Reddy Chirala | 6a45875 | 2013-02-16 15:41:27 -0800 | [diff] [blame] | 1277 | limSendSmeScanRsp(pMac, offsetof(tSirSmeScanRsp,bssDescription[0]), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1278 | return; |
| 1279 | } |
| 1280 | |
| 1281 | |
| 1282 | /** |
| 1283 | * If scan request is received in idle, joinFailed |
| 1284 | * states or in link established state (in STA role) |
| 1285 | * or in normal state (in STA-in-IBSS/AP role) with |
| 1286 | * 'return fresh scan results' request from HDD or |
| 1287 | * it is periodic background scanning request, |
| 1288 | * trigger fresh scan request to MLM |
| 1289 | */ |
| 1290 | if (__limFreshScanReqd(pMac, pScanReq->returnFreshResults)) |
| 1291 | { |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1292 | if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS) |
| 1293 | { |
| 1294 | // Discard previously cached scan results |
| 1295 | limReInitScanResults(pMac); |
| 1296 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1297 | |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1298 | pMac->lim.gLim24Band11dScanDone = 0; |
| 1299 | pMac->lim.gLim50Band11dScanDone = 0; |
| 1300 | pMac->lim.gLimReturnAfterFirstMatch = |
| 1301 | pScanReq->returnAfterFirstMatch; |
| 1302 | pMac->lim.gLimBackgroundScanMode = |
| 1303 | pScanReq->backgroundScanMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1304 | |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1305 | pMac->lim.gLimReturnUniqueResults = |
| 1306 | ((pScanReq->returnUniqueResults) > 0 ? true : false); |
| 1307 | /* De-activate Heartbeat timers for connected sessions while |
| 1308 | * scan is in progress if the system is in Active mode * |
| 1309 | * AND it is not a ROAMING ("background") scan */ |
| 1310 | if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) || |
| 1311 | (ePMM_STATE_READY == pMac->pmm.gPmmState)) && |
| 1312 | (pScanReq->backgroundScanMode != eSIR_ROAMING_SCAN ) && |
| 1313 | (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)) |
| 1314 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1315 | for(i=0;i<pMac->lim.maxBssId;i++) |
| 1316 | { |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1317 | if((peFindSessionBySessionId(pMac,i) != NULL) && |
| 1318 | (pMac->lim.gpSession[i].valid == TRUE) && |
| 1319 | (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState)) |
| 1320 | { |
| 1321 | limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i)); |
| 1322 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1323 | } |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1324 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1325 | |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1326 | if (pMac->fScanOffload) |
| 1327 | { |
| 1328 | if (eHAL_STATUS_SUCCESS != |
| 1329 | limSendHalStartScanOffloadReq(pMac, pScanReq)) |
| 1330 | { |
Rashmi Ramanna | 6c13a34 | 2014-01-07 11:44:07 +0530 | [diff] [blame] | 1331 | limLog(pMac, LOGE, FL("Couldn't send Offload scan request")); |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1332 | limSendSmeScanRsp(pMac, |
| 1333 | offsetof(tSirSmeScanRsp, bssDescription[0]), |
| 1334 | eSIR_SME_INVALID_PARAMETERS, |
| 1335 | pScanReq->sessionId, |
| 1336 | pScanReq->transactionId); |
| 1337 | return; |
| 1338 | } |
| 1339 | } |
| 1340 | else |
| 1341 | { |
| 1342 | |
| 1343 | /*Change Global SME state */ |
| 1344 | /* Store the previous SME state */ |
Rashmi Ramanna | 6c13a34 | 2014-01-07 11:44:07 +0530 | [diff] [blame] | 1345 | limLog(pMac, LOG1, FL("Non Offload SCAN request ")); |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1346 | pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState; |
| 1347 | pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE; |
| 1348 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pScanReq->sessionId, pMac->lim.gLimSmeState)); |
| 1349 | |
| 1350 | if (pScanReq->channelList.numChannels == 0) |
| 1351 | { |
| 1352 | tANI_U32 cfg_len; |
Rashmi Ramanna | 6c13a34 | 2014-01-07 11:44:07 +0530 | [diff] [blame] | 1353 | |
| 1354 | limLog(pMac, LOG1, |
| 1355 | FL("Scan all channels as Number of channels is 0")); |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1356 | // Scan all channels |
| 1357 | len = sizeof(tLimMlmScanReq) + |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1358 | (sizeof( pScanReq->channelList.channelNumber ) * (WNI_CFG_VALID_CHANNEL_LIST_LEN - 1)) + |
| 1359 | pScanReq->uIEFieldLen; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1360 | pMlmScanReq = vos_mem_malloc(len); |
| 1361 | if ( NULL == pMlmScanReq ) |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1362 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1363 | // Log error |
| 1364 | limLog(pMac, LOGP, |
| 1365 | FL("call to AllocateMemory failed for mlmScanReq (%d)"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1366 | |
Padma, Santhosh Kumar | 8fa8521 | 2015-02-18 12:24:56 +0530 | [diff] [blame] | 1367 | if (pMac->lim.gLimRspReqd) |
| 1368 | { |
| 1369 | pMac->lim.gLimRspReqd = false; |
| 1370 | |
| 1371 | limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), |
| 1372 | eSIR_SME_RESOURCES_UNAVAILABLE, |
| 1373 | pScanReq->sessionId, |
| 1374 | pScanReq->transactionId); |
| 1375 | } |
| 1376 | |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1377 | return; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1378 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1379 | |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1380 | // Initialize this buffer |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1381 | vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1382 | |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1383 | cfg_len = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 1384 | if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1385 | pMlmScanReq->channelList.channelNumber, |
| 1386 | &cfg_len) != eSIR_SUCCESS) |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1387 | { |
| 1388 | /** |
| 1389 | * Could not get Valid channel list from CFG. |
| 1390 | * Log error. |
| 1391 | */ |
| 1392 | limLog(pMac, LOGP, |
| 1393 | FL("could not retrieve Valid channel list")); |
Padma, Santhosh Kumar | 778d838 | 2015-03-04 17:41:22 +0530 | [diff] [blame] | 1394 | |
| 1395 | if (pMac->lim.gLimRspReqd) |
| 1396 | { |
| 1397 | pMac->lim.gLimRspReqd = false; |
| 1398 | |
| 1399 | limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), |
| 1400 | eSIR_SME_INVALID_PARAMETERS, |
| 1401 | pScanReq->sessionId, |
| 1402 | pScanReq->transactionId); |
| 1403 | } |
| 1404 | return; |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1405 | } |
| 1406 | pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len; |
Padma, Santhosh Kumar | 778d838 | 2015-03-04 17:41:22 +0530 | [diff] [blame] | 1407 | |
| 1408 | //Ignore DFS channels if DFS scan is disabled |
| 1409 | if(pMac->scan.fEnableDFSChnlScan == DFS_CHNL_SCAN_DISABLED) |
| 1410 | { |
| 1411 | tANI_U8 numChan = 0; |
| 1412 | tANI_U8 channel_state; |
| 1413 | tANI_U8 *chan_ptr = pMlmScanReq->channelList.channelNumber; |
| 1414 | |
| 1415 | limLog(pMac, LOG1, |
| 1416 | FL("Ignore DFS channels from valid channel list")); |
| 1417 | |
| 1418 | VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 1419 | pMlmScanReq->channelList.channelNumber, |
| 1420 | pMlmScanReq->channelList.numChannels); |
| 1421 | |
| 1422 | //Filter DFS channels |
| 1423 | for (i = 0; i < cfg_len; i++) |
| 1424 | { |
| 1425 | channel_state = |
| 1426 | vos_nv_getChannelEnabledState(*(chan_ptr + i)); |
| 1427 | |
| 1428 | //Allow channel if not DFS |
| 1429 | if(channel_state != NV_CHANNEL_DFS) |
| 1430 | { |
| 1431 | *(chan_ptr + numChan) = *(chan_ptr + i); |
| 1432 | numChan++; |
| 1433 | } |
| 1434 | } |
| 1435 | pMlmScanReq->channelList.numChannels = (tANI_U8) numChan; |
| 1436 | |
| 1437 | limLog(pMac, LOG1, FL("No of valid channels %d, No of" |
| 1438 | "channels after filtering %d"), cfg_len, numChan); |
| 1439 | |
| 1440 | limLog(pMac, LOG1, FL("Channel list after filtering: ")); |
| 1441 | |
| 1442 | VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 1443 | pMlmScanReq->channelList.channelNumber, |
| 1444 | pMlmScanReq->channelList.numChannels); |
| 1445 | } |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1446 | } |
| 1447 | else |
| 1448 | { |
| 1449 | len = sizeof( tLimMlmScanReq ) - sizeof( pScanReq->channelList.channelNumber ) + |
| 1450 | (sizeof( pScanReq->channelList.channelNumber ) * pScanReq->channelList.numChannels ) + |
| 1451 | pScanReq->uIEFieldLen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1452 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1453 | pMlmScanReq = vos_mem_malloc(len); |
| 1454 | if ( NULL == pMlmScanReq ) |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1455 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1456 | // Log error |
| 1457 | limLog(pMac, LOGP, |
| 1458 | FL("call to AllocateMemory failed for mlmScanReq(%d)"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1459 | |
Padma, Santhosh Kumar | 8fa8521 | 2015-02-18 12:24:56 +0530 | [diff] [blame] | 1460 | if (pMac->lim.gLimRspReqd) |
| 1461 | { |
| 1462 | pMac->lim.gLimRspReqd = false; |
| 1463 | |
| 1464 | limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), |
| 1465 | eSIR_SME_RESOURCES_UNAVAILABLE, |
| 1466 | pScanReq->sessionId, |
| 1467 | pScanReq->transactionId); |
| 1468 | } |
| 1469 | |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1470 | return; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1471 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1472 | |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1473 | // Initialize this buffer |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1474 | vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0); |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1475 | pMlmScanReq->channelList.numChannels = |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1476 | pScanReq->channelList.numChannels; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1477 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1478 | vos_mem_copy( pMlmScanReq->channelList.channelNumber, |
| 1479 | pScanReq->channelList.channelNumber, |
| 1480 | pScanReq->channelList.numChannels); |
| 1481 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1482 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1483 | pMlmScanReq->uIEFieldLen = pScanReq->uIEFieldLen; |
| 1484 | pMlmScanReq->uIEFieldOffset = len - pScanReq->uIEFieldLen; |
| 1485 | if(pScanReq->uIEFieldLen) |
| 1486 | { |
| 1487 | vos_mem_copy( (tANI_U8 *)pMlmScanReq+ pMlmScanReq->uIEFieldOffset, |
| 1488 | (tANI_U8 *)pScanReq+(pScanReq->uIEFieldOffset), |
| 1489 | pScanReq->uIEFieldLen); |
| 1490 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1491 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1492 | pMlmScanReq->bssType = pScanReq->bssType; |
| 1493 | vos_mem_copy( pMlmScanReq->bssId, |
| 1494 | pScanReq->bssId, |
| 1495 | sizeof(tSirMacAddr)); |
| 1496 | pMlmScanReq->numSsid = pScanReq->numSsid; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1497 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1498 | i = 0; |
| 1499 | while (i < pMlmScanReq->numSsid) |
| 1500 | { |
| 1501 | vos_mem_copy( (tANI_U8 *) &pMlmScanReq->ssId[i], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1502 | (tANI_U8 *) &pScanReq->ssId[i], |
| 1503 | pScanReq->ssId[i].length + 1); |
| 1504 | |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1505 | i++; |
| 1506 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1507 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1508 | |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1509 | pMlmScanReq->scanType = pScanReq->scanType; |
| 1510 | pMlmScanReq->backgroundScanMode = pScanReq->backgroundScanMode; |
Ganesh Kondabattini | 8f6e3b3 | 2014-08-25 16:07:54 +0530 | [diff] [blame] | 1511 | if (pMac->miracast_mode) |
| 1512 | { |
| 1513 | pMlmScanReq->minChannelTime = DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST; |
| 1514 | pMlmScanReq->maxChannelTime = DEFAULT_MAX_CHAN_TIME_DURING_MIRACAST; |
| 1515 | } |
| 1516 | else |
| 1517 | { |
| 1518 | pMlmScanReq->minChannelTime = pScanReq->minChannelTime; |
| 1519 | pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime; |
| 1520 | } |
| 1521 | |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1522 | pMlmScanReq->minChannelTimeBtc = pScanReq->minChannelTimeBtc; |
| 1523 | pMlmScanReq->maxChannelTimeBtc = pScanReq->maxChannelTimeBtc; |
| 1524 | pMlmScanReq->dot11mode = pScanReq->dot11mode; |
| 1525 | pMlmScanReq->p2pSearch = pScanReq->p2pSearch; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1526 | |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1527 | //Store the smeSessionID and transaction ID for later use. |
| 1528 | pMac->lim.gSmeSessionId = pScanReq->sessionId; |
| 1529 | pMac->lim.gTransactionId = pScanReq->transactionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1530 | |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1531 | // Issue LIM_MLM_SCAN_REQ to MLM |
Rashmi Ramanna | 6c13a34 | 2014-01-07 11:44:07 +0530 | [diff] [blame] | 1532 | limLog(pMac, LOG1, FL("Issue Scan request command to MLM ")); |
Ganesh Kondabattini | f0fa07c | 2013-06-11 17:47:49 +0530 | [diff] [blame] | 1533 | limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq); |
| 1534 | } |
| 1535 | } // if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ... |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1536 | |
| 1537 | else |
| 1538 | { |
| 1539 | /// In all other cases return 'cached' scan results |
| 1540 | if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults) |
| 1541 | { |
| 1542 | tANI_U16 scanRspLen = sizeof(tSirSmeScanRsp); |
| 1543 | |
| 1544 | pMac->lim.gLimRspReqd = false; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1545 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1546 | if (pScanReq->returnFreshResults & SIR_BG_SCAN_RETURN_LFR_CACHED_RESULTS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1547 | { |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1548 | pMac->lim.gLimSmeLfrScanResultLength = pMac->lim.gLimMlmLfrScanResultLength; |
| 1549 | if (pMac->lim.gLimSmeLfrScanResultLength == 0) |
| 1550 | { |
| 1551 | limSendSmeLfrScanRsp(pMac, scanRspLen, |
| 1552 | eSIR_SME_SUCCESS, |
| 1553 | pScanReq->sessionId, |
| 1554 | pScanReq->transactionId); |
| 1555 | } |
| 1556 | else |
| 1557 | { |
| 1558 | scanRspLen = sizeof(tSirSmeScanRsp) + |
| 1559 | pMac->lim.gLimSmeLfrScanResultLength - |
| 1560 | sizeof(tSirBssDescription); |
| 1561 | limSendSmeLfrScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, |
| 1562 | pScanReq->sessionId, pScanReq->transactionId); |
| 1563 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1564 | } |
| 1565 | else |
| 1566 | { |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1567 | #endif |
| 1568 | if (pMac->lim.gLimSmeScanResultLength == 0) |
| 1569 | { |
| 1570 | limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, |
| 1571 | pScanReq->sessionId, pScanReq->transactionId); |
| 1572 | } |
| 1573 | else |
| 1574 | { |
| 1575 | scanRspLen = sizeof(tSirSmeScanRsp) + |
| 1576 | pMac->lim.gLimSmeScanResultLength - |
| 1577 | sizeof(tSirBssDescription); |
| 1578 | limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, |
| 1579 | pScanReq->sessionId, pScanReq->transactionId); |
| 1580 | } |
| 1581 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1582 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1583 | #endif |
Rashmi Ramanna | 6c13a34 | 2014-01-07 11:44:07 +0530 | [diff] [blame] | 1584 | limLog(pMac, LOG1, FL("Cached scan results are returned ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1585 | |
| 1586 | if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS) |
| 1587 | { |
| 1588 | // Discard previously cached scan results |
| 1589 | limReInitScanResults(pMac); |
| 1590 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1591 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1592 | if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_LFR_RESULTS) |
| 1593 | { |
| 1594 | // Discard previously cached scan results |
| 1595 | limReInitLfrScanResults(pMac); |
| 1596 | } |
| 1597 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1598 | |
| 1599 | } // if (pMac->lim.gLimRspReqd) |
| 1600 | } // else ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ... |
| 1601 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1602 | #ifdef BACKGROUND_SCAN_ENABLED |
| 1603 | // start background scans if needed |
| 1604 | // There is a bug opened against softmac. Need to enable when the bug is fixed. |
| 1605 | __limBackgroundScanInitiate(pMac); |
| 1606 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1607 | |
| 1608 | } /*** end __limProcessSmeScanReq() ***/ |
| 1609 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1610 | #ifdef FEATURE_OEM_DATA_SUPPORT |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1611 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1612 | static void __limProcessSmeOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 1613 | { |
| 1614 | tpSirOemDataReq pOemDataReq; |
| 1615 | tLimMlmOemDataReq* pMlmOemDataReq; |
| 1616 | |
| 1617 | pOemDataReq = (tpSirOemDataReq) pMsgBuf; |
| 1618 | |
| 1619 | //post the lim mlm message now |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1620 | pMlmOemDataReq = vos_mem_malloc(sizeof(tLimMlmOemDataReq)); |
| 1621 | if ( NULL == pMlmOemDataReq ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1622 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1623 | limLog(pMac, LOGP, FL("AllocateMemory failed for mlmOemDataReq")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1624 | return; |
| 1625 | } |
| 1626 | |
| 1627 | //Initialize this buffer |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1628 | vos_mem_set( pMlmOemDataReq, (sizeof(tLimMlmOemDataReq)), 0); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1629 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1630 | vos_mem_copy( pMlmOemDataReq->selfMacAddr, pOemDataReq->selfMacAddr, |
| 1631 | sizeof(tSirMacAddr)); |
| 1632 | vos_mem_copy( pMlmOemDataReq->oemDataReq, pOemDataReq->oemDataReq, |
| 1633 | OEM_DATA_REQ_SIZE); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1634 | |
| 1635 | //Issue LIM_MLM_OEM_DATA_REQ to MLM |
| 1636 | limPostMlmMessage(pMac, LIM_MLM_OEM_DATA_REQ, (tANI_U32*)pMlmOemDataReq); |
| 1637 | |
| 1638 | return; |
| 1639 | |
| 1640 | } /*** end __limProcessSmeOemDataReq() ***/ |
| 1641 | |
| 1642 | #endif //FEATURE_OEM_DATA_SUPPORT |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1643 | |
Gopichand Nakkala | c178ac8 | 2013-05-30 19:53:39 +0530 | [diff] [blame] | 1644 | /** |
| 1645 | * __limProcessClearDfsChannelList() |
| 1646 | * |
| 1647 | *FUNCTION: |
| 1648 | *Clear DFS channel list when country is changed/aquired. |
| 1649 | .*This message is sent from SME. |
| 1650 | * |
| 1651 | *LOGIC: |
| 1652 | * |
| 1653 | *ASSUMPTIONS: |
| 1654 | * |
| 1655 | *NOTE: |
| 1656 | * |
| 1657 | * @param pMac Pointer to Global MAC structure |
| 1658 | * @param *pMsgBuf A pointer to the SME message buffer |
| 1659 | * @return None |
| 1660 | */ |
| 1661 | static void __limProcessClearDfsChannelList(tpAniSirGlobal pMac, |
| 1662 | tpSirMsgQ pMsg) |
| 1663 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1664 | vos_mem_set( &pMac->lim.dfschannelList, |
| 1665 | sizeof(tSirDFSChannelList), 0); |
Gopichand Nakkala | c178ac8 | 2013-05-30 19:53:39 +0530 | [diff] [blame] | 1666 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1667 | |
| 1668 | /** |
| 1669 | * __limProcessSmeJoinReq() |
| 1670 | * |
| 1671 | *FUNCTION: |
| 1672 | * This function is called to process SME_JOIN_REQ message |
| 1673 | * from HDD or upper layer application. |
| 1674 | * |
| 1675 | *LOGIC: |
| 1676 | * |
| 1677 | *ASSUMPTIONS: |
| 1678 | * |
| 1679 | *NOTE: |
| 1680 | * |
| 1681 | * @param pMac Pointer to Global MAC structure |
| 1682 | * @param *pMsgBuf A pointer to the SME message buffer |
| 1683 | * @return None |
| 1684 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1685 | static void |
| 1686 | __limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 1687 | { |
| 1688 | // tANI_U8 *pBuf; |
| 1689 | //tANI_U32 len; |
| 1690 | // tSirMacAddr currentBssId; |
| 1691 | tpSirSmeJoinReq pSmeJoinReq = NULL; |
| 1692 | tLimMlmJoinReq *pMlmJoinReq; |
| 1693 | tSirResultCodes retCode = eSIR_SME_SUCCESS; |
| 1694 | tANI_U32 val = 0; |
| 1695 | tANI_U16 nSize; |
| 1696 | tANI_U8 sessionId; |
| 1697 | tpPESession psessionEntry = NULL; |
| 1698 | tANI_U8 smesessionId; |
| 1699 | tANI_U16 smetransactionId; |
| 1700 | tPowerdBm localPowerConstraint = 0, regMax = 0; |
Agarwal Ashish | 87039eb | 2014-01-15 14:13:15 +0530 | [diff] [blame] | 1701 | tANI_U16 ieLen; |
| 1702 | v_U8_t *vendorIE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1703 | |
| 1704 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 1705 | //Not sending any session, since it is not created yet. The response whould have correct state. |
| 1706 | limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0); |
| 1707 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 1708 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1709 | limLog(pMac, LOG1, FL("Received SME_JOIN_REQ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1710 | |
| 1711 | #ifdef WLAN_FEATURE_VOWIFI |
| 1712 | /* Need to read the CFG here itself as this is used in limExtractAPCapability() below. |
| 1713 | * This CFG is actually read in rrmUpdateConfig() which is called later. Because this is not |
| 1714 | * read, RRM related path before calling rrmUpdateConfig() is not getting executed causing issues |
| 1715 | * like not honoring power constraint on 1st association after driver loading. */ |
| 1716 | if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS) |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1717 | limLog(pMac, LOGP, FL("cfg get rrm enabled failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1718 | pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0; |
| 1719 | val = 0; |
| 1720 | #endif /* WLAN_FEATURE_VOWIFI */ |
| 1721 | |
| 1722 | /** |
| 1723 | * Expect Join request in idle state. |
| 1724 | * Reassociate request is expected in link established state. |
| 1725 | */ |
| 1726 | |
| 1727 | /* Global SME and LIM states are not defined yet for BT-AMP Support */ |
| 1728 | if(pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) |
| 1729 | { |
| 1730 | nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8*) pMsgBuf); |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1731 | |
| 1732 | pSmeJoinReq = vos_mem_malloc(nSize); |
| 1733 | if ( NULL == pSmeJoinReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1734 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1735 | limLog(pMac, LOGP, FL("call to AllocateMemory failed for " |
| 1736 | "pSmeJoinReq")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1737 | retCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 1738 | goto end; |
| 1739 | } |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1740 | (void) vos_mem_set((void *) pSmeJoinReq, nSize, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1741 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1742 | if ((limJoinReqSerDes(pMac, pSmeJoinReq, (tANI_U8 *)pMsgBuf) == eSIR_FAILURE) || |
| 1743 | (!limIsSmeJoinReqValid(pMac, pSmeJoinReq))) |
| 1744 | { |
| 1745 | /// Received invalid eWNI_SME_JOIN_REQ |
| 1746 | // Log the event |
Padma, Santhosh Kumar | 2b47ca8 | 2014-01-03 16:57:27 +0530 | [diff] [blame] | 1747 | limLog(pMac, LOGW, FL("SessionId:%d Received SME_JOIN_REQ with" |
| 1748 | "invalid data"),pSmeJoinReq->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1749 | retCode = eSIR_SME_INVALID_PARAMETERS; |
| 1750 | goto end; |
| 1751 | } |
| 1752 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1753 | //pMac->lim.gpLimJoinReq = pSmeJoinReq; TO SUPPORT BT-AMP, review os sep 23 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1754 | |
| 1755 | /* check for the existence of start BSS session */ |
| 1756 | #ifdef FIXME_GEN6 |
| 1757 | if(pSmeJoinReq->bsstype == eSIR_BTAMP_AP_MODE) |
| 1758 | { |
| 1759 | if(peValidateBtJoinRequest(pMac)!= TRUE) |
| 1760 | { |
Padma, Santhosh Kumar | 2b47ca8 | 2014-01-03 16:57:27 +0530 | [diff] [blame] | 1761 | limLog(pMac, LOGW, FL("SessionId:%d Start Bss session" |
| 1762 | "not present::SME_JOIN_REQ in unexpected state"), |
| 1763 | pSmeJoinReq->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1764 | retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE; |
| 1765 | psessionEntry = NULL; |
| 1766 | goto end; |
| 1767 | } |
| 1768 | } |
| 1769 | |
| 1770 | #endif |
| 1771 | |
| 1772 | |
| 1773 | if((psessionEntry = peFindSessionByBssid(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId)) != NULL) |
| 1774 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1775 | limLog(pMac, LOGE, FL("Session(%d) Already exists for BSSID: " |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 1776 | MAC_ADDRESS_STR" in limSmeState = %d"),sessionId, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1777 | MAC_ADDR_ARRAY(pSmeJoinReq->bssDescription.bssId), |
| 1778 | psessionEntry->limSmeState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1779 | |
| 1780 | if(psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE) |
| 1781 | { |
| 1782 | // Received eWNI_SME_JOIN_REQ for same |
| 1783 | // BSS as currently associated. |
| 1784 | // Log the event and send success |
Padma, Santhosh Kumar | 2b47ca8 | 2014-01-03 16:57:27 +0530 | [diff] [blame] | 1785 | PELOGW(limLog(pMac, LOGW, FL("SessionId:%d Received" |
| 1786 | "SME_JOIN_REQ for currently joined BSS"),sessionId);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1787 | /// Send Join success response to host |
Deepthi Gowri | f3e2725 | 2013-12-11 20:50:01 +0530 | [diff] [blame] | 1788 | retCode = eSIR_SME_ALREADY_JOINED_A_BSS; |
| 1789 | psessionEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1790 | goto end; |
| 1791 | } |
| 1792 | else |
| 1793 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1794 | PELOGE(limLog(pMac, LOGE, FL("SME_JOIN_REQ not for" |
| 1795 | "currently joined BSS"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1796 | retCode = eSIR_SME_REFUSED; |
| 1797 | psessionEntry = NULL; |
| 1798 | goto end; |
| 1799 | } |
| 1800 | } |
| 1801 | else /* Session Entry does not exist for given BSSId */ |
| 1802 | { |
| 1803 | /* Try to Create a new session */ |
| 1804 | if((psessionEntry = peCreateSession(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId, pMac->lim.maxStation)) == NULL) |
| 1805 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1806 | limLog(pMac, LOGE, FL("Session Can not be created ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1807 | retCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 1808 | goto end; |
| 1809 | } |
Padma, Santhosh Kumar | 2b47ca8 | 2014-01-03 16:57:27 +0530 | [diff] [blame] | 1810 | else |
| 1811 | limLog(pMac,LOG1,FL("SessionId:%d New session created"), |
| 1812 | sessionId); |
Masti, Narayanraddi | 67ea591 | 2015-01-08 12:34:05 +0530 | [diff] [blame] | 1813 | } |
| 1814 | |
| 1815 | if(psessionEntry != NULL && pSmeJoinReq->operationalRateSet.numRates > 0 ){ |
| 1816 | if(!limCheck11BRateBitmap(pSmeJoinReq->rateBitMap)){ |
| 1817 | psessionEntry->is11Gonly = true; |
| 1818 | } |
| 1819 | } |
| 1820 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1821 | handleHTCapabilityandHTInfo(pMac, psessionEntry); |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 1822 | psessionEntry->isAmsduSupportInAMPDU = pSmeJoinReq->isAmsduSupportInAMPDU; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1823 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1824 | /* Store Session related parameters */ |
| 1825 | /* Store PE session Id in session Table */ |
| 1826 | psessionEntry->peSessionId = sessionId; |
| 1827 | |
| 1828 | /* store the smejoin req handle in session table */ |
| 1829 | psessionEntry->pLimJoinReq = pSmeJoinReq; |
| 1830 | |
| 1831 | /* Store SME session Id in sessionTable */ |
| 1832 | psessionEntry->smeSessionId = pSmeJoinReq->sessionId; |
| 1833 | |
| 1834 | /* Store SME transaction Id in session Table */ |
| 1835 | psessionEntry->transactionId = pSmeJoinReq->transactionId; |
| 1836 | |
| 1837 | /* Store beaconInterval */ |
| 1838 | psessionEntry->beaconParams.beaconInterval = pSmeJoinReq->bssDescription.beaconInterval; |
| 1839 | |
| 1840 | /* Copying of bssId is already done, while creating session */ |
| 1841 | //sirCopyMacAddr(psessionEntry->bssId,pSmeJoinReq->bssId); |
| 1842 | sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeJoinReq->selfMacAddr); |
| 1843 | psessionEntry->bssType = pSmeJoinReq->bsstype; |
| 1844 | |
| 1845 | psessionEntry->statypeForBss = STA_ENTRY_PEER; |
Sandeep Puligilla | aea98a2 | 2013-12-04 13:36:32 +0530 | [diff] [blame] | 1846 | psessionEntry->limWmeEnabled = pSmeJoinReq->isWMEenabled; |
| 1847 | psessionEntry->limQosEnabled = pSmeJoinReq->isQosEnabled; |
Sushant Kaushik | 74df8db | 2015-03-11 18:09:05 +0530 | [diff] [blame] | 1848 | psessionEntry->bOSENAssociation = pSmeJoinReq->bOSENAssociation; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1849 | |
Agarwal Ashish | 87039eb | 2014-01-15 14:13:15 +0530 | [diff] [blame] | 1850 | /* Store vendor specfic IE for CISCO AP */ |
| 1851 | ieLen = (pSmeJoinReq->bssDescription.length + |
| 1852 | sizeof( pSmeJoinReq->bssDescription.length ) - |
| 1853 | GET_FIELD_OFFSET( tSirBssDescription, ieFields )); |
| 1854 | |
| 1855 | vendorIE = limGetVendorIEOuiPtr(pMac, SIR_MAC_CISCO_OUI, |
| 1856 | SIR_MAC_CISCO_OUI_SIZE, |
| 1857 | ((tANI_U8 *)&pSmeJoinReq->bssDescription.ieFields) , ieLen); |
| 1858 | |
| 1859 | if ( NULL != vendorIE ) |
| 1860 | { |
| 1861 | limLog(pMac, LOGE, |
| 1862 | FL("DUT is trying to connect to Cisco AP")); |
| 1863 | psessionEntry->isCiscoVendorAP = TRUE; |
| 1864 | } |
| 1865 | else |
| 1866 | { |
| 1867 | psessionEntry->isCiscoVendorAP = FALSE; |
| 1868 | } |
| 1869 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1870 | /* Copy the dot 11 mode in to the session table */ |
| 1871 | |
| 1872 | psessionEntry->dot11mode = pSmeJoinReq->dot11mode; |
| 1873 | psessionEntry->nwType = pSmeJoinReq->bssDescription.nwType; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1874 | #ifdef WLAN_FEATURE_11AC |
| 1875 | psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 1876 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1877 | "***__limProcessSmeJoinReq: vhtCapability=%d****",psessionEntry->vhtCapability); |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1878 | if (psessionEntry->vhtCapability ) |
| 1879 | { |
| 1880 | psessionEntry->txBFIniFeatureEnabled = pSmeJoinReq->txBFIniFeatureEnabled; |
| 1881 | |
| 1882 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1883 | "***__limProcessSmeJoinReq: txBFIniFeatureEnabled=%d****", |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1884 | psessionEntry->txBFIniFeatureEnabled); |
| 1885 | |
| 1886 | if( psessionEntry->txBFIniFeatureEnabled ) |
| 1887 | { |
| 1888 | if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, psessionEntry->txBFIniFeatureEnabled) |
| 1889 | != eSIR_SUCCESS) |
| 1890 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1891 | limLog(pMac, LOGP, FL("could not set " |
| 1892 | "WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG")); |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1893 | retCode = eSIR_LOGP_EXCEPTION; |
| 1894 | goto end; |
| 1895 | } |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1896 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1897 | "***__limProcessSmeJoinReq: txBFCsnValue=%d****", |
| 1898 | pSmeJoinReq->txBFCsnValue); |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1899 | |
| 1900 | if (cfgSetInt(pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, pSmeJoinReq->txBFCsnValue) |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1901 | != eSIR_SUCCESS) |
| 1902 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1903 | limLog(pMac, LOGP, FL("could not set " |
| 1904 | "WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED at CFG")); |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1905 | retCode = eSIR_LOGP_EXCEPTION; |
| 1906 | goto end; |
| 1907 | } |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 1908 | |
| 1909 | if ( FALSE == pMac->isMuBfsessionexist ) |
| 1910 | psessionEntry->txMuBformee = pSmeJoinReq->txMuBformee; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1911 | } |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 1912 | |
| 1913 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 1914 | "SmeJoinReq:txMuBformee=%d psessionEntry: txMuBformee = %d", |
| 1915 | pSmeJoinReq->txMuBformee, psessionEntry->txMuBformee); |
| 1916 | |
| 1917 | if(cfgSetInt(pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, psessionEntry->txMuBformee) |
| 1918 | != eSIR_SUCCESS) |
| 1919 | { |
| 1920 | limLog(pMac, LOGE, FL("could not set " |
| 1921 | "WNI_CFG_VHT_MU_BEAMFORMEE_CAP at CFG")); |
| 1922 | retCode = eSIR_LOGP_EXCEPTION; |
| 1923 | goto end; |
| 1924 | } |
| 1925 | |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1926 | } |
| 1927 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1928 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1929 | |
| 1930 | /*Phy mode*/ |
| 1931 | psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType; |
| 1932 | |
| 1933 | /* Copy The channel Id to the session Table */ |
| 1934 | psessionEntry->currentOperChannel = pSmeJoinReq->bssDescription.channelId; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1935 | psessionEntry->htSupportedChannelWidthSet = (pSmeJoinReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes |
| 1936 | psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet; |
| 1937 | psessionEntry->htSecondaryChannelOffset = pSmeJoinReq->cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1938 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1939 | /* Record if management frames need to be protected */ |
| 1940 | #ifdef WLAN_FEATURE_11W |
| 1941 | if(eSIR_ED_AES_128_CMAC == pSmeJoinReq->MgmtEncryptionType) |
| 1942 | { |
| 1943 | psessionEntry->limRmfEnabled = 1; |
| 1944 | } |
| 1945 | else |
| 1946 | { |
| 1947 | psessionEntry->limRmfEnabled = 0; |
| 1948 | } |
| 1949 | #endif |
| 1950 | |
krunal soni | 8d13b09 | 2013-07-19 13:23:29 -0700 | [diff] [blame] | 1951 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 1952 | psessionEntry->rssi = pSmeJoinReq->bssDescription.rssi; |
| 1953 | #endif |
| 1954 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1955 | /*Store Persona */ |
| 1956 | psessionEntry->pePersona = pSmeJoinReq->staPersona; |
| 1957 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1958 | FL("PE PERSONA=%d cbMode %u"), psessionEntry->pePersona, |
| 1959 | pSmeJoinReq->cbMode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1960 | |
| 1961 | /* Copy the SSID from smejoinreq to session entry */ |
| 1962 | psessionEntry->ssId.length = pSmeJoinReq->ssId.length; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1963 | vos_mem_copy( psessionEntry->ssId.ssId, |
| 1964 | pSmeJoinReq->ssId.ssId, psessionEntry->ssId.length); |
| 1965 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1966 | // Determin 11r or ESE connection based on input from SME |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1967 | // which inturn is dependent on the profile the user wants to connect |
| 1968 | // to, So input is coming from supplicant |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1969 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1970 | psessionEntry->is11Rconnection = pSmeJoinReq->is11Rconnection; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1971 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1972 | #ifdef FEATURE_WLAN_ESE |
| 1973 | psessionEntry->isESEconnection = pSmeJoinReq->isESEconnection; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1974 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1975 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1976 | psessionEntry->isFastTransitionEnabled = pSmeJoinReq->isFastTransitionEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1977 | #endif |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1978 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1979 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1980 | psessionEntry->isFastRoamIniFeatureEnabled = pSmeJoinReq->isFastRoamIniFeatureEnabled; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1981 | #endif |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1982 | psessionEntry->txLdpcIniFeatureEnabled = pSmeJoinReq->txLdpcIniFeatureEnabled; |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 1983 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1984 | if (psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1985 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1986 | psessionEntry->limSystemRole = eLIM_STA_ROLE; |
| 1987 | } |
| 1988 | else if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE) |
| 1989 | { |
| 1990 | psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE; |
| 1991 | } |
| 1992 | else |
| 1993 | { |
| 1994 | /* Throw an error and return and make sure to delete the session.*/ |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1995 | limLog(pMac, LOGE, FL("received SME_JOIN_REQ with invalid" |
| 1996 | " bss type %d"), psessionEntry->bssType); |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1997 | retCode = eSIR_SME_INVALID_PARAMETERS; |
| 1998 | goto end; |
| 1999 | } |
| 2000 | |
| 2001 | if (pSmeJoinReq->addIEScan.length) |
| 2002 | { |
| 2003 | vos_mem_copy( &psessionEntry->pLimJoinReq->addIEScan, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2004 | &pSmeJoinReq->addIEScan, sizeof(tSirAddie)); |
| 2005 | } |
| 2006 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2007 | if (pSmeJoinReq->addIEAssoc.length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2008 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2009 | vos_mem_copy( &psessionEntry->pLimJoinReq->addIEAssoc, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2010 | &pSmeJoinReq->addIEAssoc, sizeof(tSirAddie)); |
| 2011 | } |
| 2012 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2013 | val = sizeof(tLimMlmJoinReq) + psessionEntry->pLimJoinReq->bssDescription.length + 2; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2014 | pMlmJoinReq = vos_mem_malloc(val); |
| 2015 | if ( NULL == pMlmJoinReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2016 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2017 | limLog(pMac, LOGP, FL("call to AllocateMemory " |
| 2018 | "failed for mlmJoinReq")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2019 | return; |
| 2020 | } |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2021 | (void) vos_mem_set((void *) pMlmJoinReq, val, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2022 | |
| 2023 | /* PE SessionId is stored as a part of JoinReq*/ |
| 2024 | pMlmJoinReq->sessionId = psessionEntry->peSessionId; |
| 2025 | |
| 2026 | if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, (tANI_U32 *) &pMlmJoinReq->joinFailureTimeout) |
| 2027 | != eSIR_SUCCESS) |
Sushant Kaushik | e3ca61c | 2015-03-19 18:33:25 +0530 | [diff] [blame] | 2028 | { |
| 2029 | limLog(pMac, LOGE, FL("could not retrieve JoinFailureTimer value " |
| 2030 | "setting it to default value")); |
| 2031 | pMlmJoinReq->joinFailureTimeout = JOIN_FAILURE_TIMEOUT; |
| 2032 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2033 | |
| 2034 | /* copy operational rate from psessionEntry*/ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2035 | vos_mem_copy((void*)&psessionEntry->rateSet, (void*)&pSmeJoinReq->operationalRateSet, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2036 | sizeof(tSirMacRateSet)); |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2037 | vos_mem_copy((void*)&psessionEntry->extRateSet, (void*)&pSmeJoinReq->extendedRateSet, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2038 | sizeof(tSirMacRateSet)); |
| 2039 | //this may not be needed anymore now, as rateSet is now included in the session entry and MLM has session context. |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2040 | vos_mem_copy((void*)&pMlmJoinReq->operationalRateSet, (void*)&psessionEntry->rateSet, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2041 | sizeof(tSirMacRateSet)); |
| 2042 | |
| 2043 | psessionEntry->encryptType = pSmeJoinReq->UCEncryptionType; |
| 2044 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2045 | pMlmJoinReq->bssDescription.length = psessionEntry->pLimJoinReq->bssDescription.length; |
| 2046 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2047 | vos_mem_copy((tANI_U8 *) &pMlmJoinReq->bssDescription.bssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2048 | (tANI_U8 *) &psessionEntry->pLimJoinReq->bssDescription.bssId, |
| 2049 | psessionEntry->pLimJoinReq->bssDescription.length + 2); |
| 2050 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2051 | psessionEntry->limCurrentBssCaps = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2052 | psessionEntry->pLimJoinReq->bssDescription.capabilityInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2053 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2054 | regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel ); |
Sandeep Puligilla | a9eb9ad | 2014-05-27 14:42:50 +0530 | [diff] [blame] | 2055 | localPowerConstraint = regMax; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2056 | limExtractApCapability( pMac, |
| 2057 | (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields, |
| 2058 | limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription), |
| 2059 | &psessionEntry->limCurrentBssQosCaps, |
| 2060 | &psessionEntry->limCurrentBssPropCap, |
| 2061 | &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimCurrentBssUapsd this session specific |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 2062 | , &localPowerConstraint, |
| 2063 | psessionEntry |
Sandeep Puligilla | 4ce0259 | 2014-04-22 09:05:57 +0530 | [diff] [blame] | 2064 | ); |
Sandeep Puligilla | a9eb9ad | 2014-05-27 14:42:50 +0530 | [diff] [blame] | 2065 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2066 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2067 | psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2068 | #else |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2069 | psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2070 | #endif |
Sandeep Puligilla | 4ce0259 | 2014-04-22 09:05:57 +0530 | [diff] [blame] | 2071 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 2072 | "Regulatory max = %d, local power constraint = %d," |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2073 | " max tx = %d", regMax, localPowerConstraint, |
| 2074 | psessionEntry->maxTxPower ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2075 | |
| 2076 | if (pMac->lim.gLimCurrentBssUapsd) |
| 2077 | { |
| 2078 | pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimJoinReq->uapsdPerAcBitmask; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2079 | limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"), |
| 2080 | pMac->lim.gUapsdPerAcBitmask); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2081 | |
| 2082 | // resetting the dynamic uapsd mask |
| 2083 | pMac->lim.gUapsdPerAcDeliveryEnableMask = 0; |
| 2084 | pMac->lim.gUapsdPerAcTriggerEnableMask = 0; |
| 2085 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2086 | |
| 2087 | psessionEntry->limRFBand = limGetRFBand(psessionEntry->currentOperChannel); |
| 2088 | |
| 2089 | // Initialize 11h Enable Flag |
| 2090 | if(SIR_BAND_5_GHZ == psessionEntry->limRFBand) |
| 2091 | { |
| 2092 | if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS) |
Sushant Kaushik | e3ca61c | 2015-03-19 18:33:25 +0530 | [diff] [blame] | 2093 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2094 | limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED ")); |
Sushant Kaushik | e3ca61c | 2015-03-19 18:33:25 +0530 | [diff] [blame] | 2095 | psessionEntry->lim11hEnable = 1; |
| 2096 | } |
| 2097 | else |
| 2098 | psessionEntry->lim11hEnable = val; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2099 | } |
| 2100 | else |
| 2101 | psessionEntry->lim11hEnable = 0; |
| 2102 | |
| 2103 | //To care of the scenario when STA transitions from IBSS to Infrastructure mode. |
| 2104 | pMac->lim.gLimIbssCoalescingHappened = false; |
| 2105 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2106 | psessionEntry->limPrevSmeState = psessionEntry->limSmeState; |
| 2107 | psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE; |
| 2108 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2109 | |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2110 | limLog(pMac, LOG1, FL("SME JoinReq:Sessionid %d SSID len %d SSID : %s " |
| 2111 | "Channel %d, BSSID "MAC_ADDRESS_STR), pMlmJoinReq->sessionId, |
| 2112 | psessionEntry->ssId.length,psessionEntry->ssId.ssId, |
| 2113 | psessionEntry->currentOperChannel, |
| 2114 | MAC_ADDR_ARRAY(psessionEntry->bssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2115 | |
| 2116 | /* Indicate whether spectrum management is enabled*/ |
| 2117 | psessionEntry->spectrumMgtEnabled = |
| 2118 | pSmeJoinReq->spectrumMgtIndicator; |
Rajesh Babu Prathipati | 043149f | 2014-06-06 13:33:45 +0530 | [diff] [blame] | 2119 | |
| 2120 | /* Enable the spectrum management if this is a DFS channel */ |
| 2121 | if (psessionEntry->countryInfoPresent && |
| 2122 | limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel)) |
| 2123 | { |
| 2124 | psessionEntry->spectrumMgtEnabled = TRUE; |
| 2125 | } |
| 2126 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 2127 | limLog(pMac,LOG1,FL("SessionId: %d LIM_MLM_JOIN_REQ is posted to MLM " |
| 2128 | "SM"), pMlmJoinReq->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2129 | /* Issue LIM_MLM_JOIN_REQ to MLM */ |
| 2130 | limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq); |
| 2131 | return; |
| 2132 | |
| 2133 | } |
| 2134 | else |
| 2135 | { |
| 2136 | /* Received eWNI_SME_JOIN_REQ un expected state */ |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2137 | limLog(pMac, LOGE, FL("received unexpected SME_JOIN_REQ " |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 2138 | "in state %d"), pMac->lim.gLimSmeState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2139 | limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState); |
| 2140 | retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE; |
| 2141 | psessionEntry = NULL; |
| 2142 | goto end; |
| 2143 | |
| 2144 | } |
| 2145 | |
| 2146 | end: |
| 2147 | limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId); |
| 2148 | |
| 2149 | if(pSmeJoinReq) |
| 2150 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2151 | vos_mem_free(pSmeJoinReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2152 | pSmeJoinReq = NULL; |
| 2153 | if (NULL != psessionEntry) |
| 2154 | { |
| 2155 | psessionEntry->pLimJoinReq = NULL; |
| 2156 | } |
| 2157 | } |
| 2158 | |
| 2159 | if(retCode != eSIR_SME_SUCCESS) |
| 2160 | { |
| 2161 | if(NULL != psessionEntry) |
| 2162 | { |
| 2163 | peDeleteSession(pMac,psessionEntry); |
| 2164 | psessionEntry = NULL; |
| 2165 | } |
| 2166 | } |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2167 | limLog(pMac, LOG1, FL("Sending failure status limSendSmeJoinReassocRsp" |
| 2168 | "on sessionid: %d with retCode = %d"),smesessionId, retCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2169 | limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry,smesessionId,smetransactionId); |
| 2170 | } /*** end __limProcessSmeJoinReq() ***/ |
| 2171 | |
| 2172 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2173 | #ifdef FEATURE_WLAN_ESE |
Madan Mohan Koyyalamudi | 3282c57 | 2012-11-09 17:01:41 -0800 | [diff] [blame] | 2174 | tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower, tANI_U8 iniTxPower) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2175 | { |
| 2176 | tANI_U8 maxTxPower = 0; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2177 | tANI_U8 txPower = VOS_MIN( regMax, (apTxPower) ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2178 | txPower = VOS_MIN(txPower, iniTxPower); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2179 | if((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP)) |
| 2180 | maxTxPower = txPower; |
| 2181 | else if (txPower < MIN_TX_PWR_CAP) |
| 2182 | maxTxPower = MIN_TX_PWR_CAP; |
| 2183 | else |
| 2184 | maxTxPower = MAX_TX_PWR_CAP; |
| 2185 | |
| 2186 | return (maxTxPower); |
| 2187 | } |
| 2188 | #endif |
| 2189 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2190 | /** |
| 2191 | * __limProcessSmeReassocReq() |
| 2192 | * |
| 2193 | *FUNCTION: |
| 2194 | * This function is called to process SME_REASSOC_REQ message |
| 2195 | * from HDD or upper layer application. |
| 2196 | * |
| 2197 | *LOGIC: |
| 2198 | * |
| 2199 | *ASSUMPTIONS: |
| 2200 | * |
| 2201 | *NOTE: |
| 2202 | * |
| 2203 | * @param pMac Pointer to Global MAC structure |
| 2204 | * @param *pMsgBuf A pointer to the SME message buffer |
| 2205 | * @return None |
| 2206 | */ |
| 2207 | |
| 2208 | static void |
| 2209 | __limProcessSmeReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 2210 | { |
| 2211 | tANI_U16 caps; |
| 2212 | tANI_U32 val; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 2213 | tpSirSmeJoinReq pReassocReq = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2214 | tLimMlmReassocReq *pMlmReassocReq; |
| 2215 | tSirResultCodes retCode = eSIR_SME_SUCCESS; |
| 2216 | tpPESession psessionEntry = NULL; |
| 2217 | tANI_U8 sessionId; |
| 2218 | tANI_U8 smeSessionId; |
| 2219 | tANI_U16 transactionId; |
| 2220 | tPowerdBm localPowerConstraint = 0, regMax = 0; |
| 2221 | tANI_U32 teleBcnEn = 0; |
Madan Mohan Koyyalamudi | 7df624d | 2012-10-31 16:32:50 -0700 | [diff] [blame] | 2222 | tANI_U16 nSize; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2223 | |
| 2224 | |
Abhishek Singh | 127a844 | 2014-12-15 17:31:27 +0530 | [diff] [blame] | 2225 | limLog(pMac, LOG1, FL("Received SME_REASSOC_REQ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2226 | |
Madan Mohan Koyyalamudi | 7df624d | 2012-10-31 16:32:50 -0700 | [diff] [blame] | 2227 | nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf); |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2228 | pReassocReq = vos_mem_malloc(nSize); |
| 2229 | if ( NULL == pReassocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2230 | { |
| 2231 | // Log error |
| 2232 | limLog(pMac, LOGP, |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2233 | FL("call to AllocateMemory failed for pReassocReq")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2234 | |
| 2235 | retCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2236 | goto end; |
| 2237 | } |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2238 | (void) vos_mem_set((void *) pReassocReq, nSize, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2239 | if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq, |
| 2240 | (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) || |
| 2241 | (!limIsSmeJoinReqValid(pMac, |
| 2242 | (tpSirSmeJoinReq) pReassocReq))) |
| 2243 | { |
| 2244 | /// Received invalid eWNI_SME_REASSOC_REQ |
| 2245 | // Log the event |
| 2246 | limLog(pMac, LOGW, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2247 | FL("received SME_REASSOC_REQ with invalid data")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2248 | |
| 2249 | retCode = eSIR_SME_INVALID_PARAMETERS; |
| 2250 | goto end; |
| 2251 | } |
| 2252 | |
| 2253 | if((psessionEntry = peFindSessionByBssid(pMac,pReassocReq->bssDescription.bssId,&sessionId))==NULL) |
| 2254 | { |
| 2255 | limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE); |
Srinivas Girigowda | 2a69dcf | 2013-09-13 14:48:34 -0700 | [diff] [blame] | 2256 | limLog(pMac, LOGE, FL("Session does not exist for given bssId")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2257 | retCode = eSIR_SME_INVALID_PARAMETERS; |
| 2258 | goto end; |
| 2259 | } |
| 2260 | |
| 2261 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 2262 | limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry, 0, 0); |
| 2263 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 2264 | //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP |
| 2265 | |
| 2266 | /* Store the reassoc handle in the session Table.. 23rd sep review */ |
| 2267 | psessionEntry->pLimReAssocReq = pReassocReq; |
Padma, Santhosh Kumar | 0d25d10 | 2014-07-17 15:08:48 +0530 | [diff] [blame] | 2268 | psessionEntry->dot11mode = pReassocReq->dot11mode; |
| 2269 | psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(pReassocReq->dot11mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2270 | |
| 2271 | /** |
| 2272 | * Reassociate request is expected |
| 2273 | * in link established state only. |
| 2274 | */ |
| 2275 | |
| 2276 | if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE) |
| 2277 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2278 | #if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2279 | if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE) |
| 2280 | { |
| 2281 | // May be from 11r FT pre-auth. So lets check it before we bail out |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2282 | limLog(pMac, LOG1, FL("Session in reassoc state is %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2283 | psessionEntry->peSessionId); |
| 2284 | |
| 2285 | // Make sure its our preauth bssid |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2286 | if (!vos_mem_compare( pReassocReq->bssDescription.bssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2287 | pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, 6)) |
| 2288 | { |
| 2289 | limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE); |
| 2290 | limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE); |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2291 | limLog(pMac, LOGP, FL("Unknown bssId in reassoc state")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2292 | retCode = eSIR_SME_INVALID_PARAMETERS; |
| 2293 | goto end; |
| 2294 | } |
| 2295 | |
| 2296 | limProcessMlmFTReassocReq(pMac, pMsgBuf, psessionEntry); |
| 2297 | return; |
| 2298 | } |
| 2299 | #endif |
| 2300 | /// Should not have received eWNI_SME_REASSOC_REQ |
| 2301 | // Log the event |
| 2302 | limLog(pMac, LOGE, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 2303 | FL("received unexpected SME_REASSOC_REQ in state %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2304 | psessionEntry->limSmeState); |
| 2305 | limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState); |
| 2306 | |
| 2307 | retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE; |
| 2308 | goto end; |
| 2309 | } |
| 2310 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2311 | vos_mem_copy( psessionEntry->limReAssocbssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2312 | psessionEntry->pLimReAssocReq->bssDescription.bssId, |
| 2313 | sizeof(tSirMacAddr)); |
| 2314 | |
| 2315 | psessionEntry->limReassocChannelId = |
| 2316 | psessionEntry->pLimReAssocReq->bssDescription.channelId; |
| 2317 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2318 | psessionEntry->reAssocHtSupportedChannelWidthSet = |
| 2319 | (psessionEntry->pLimReAssocReq->cbMode)?1:0; |
| 2320 | psessionEntry->reAssocHtRecommendedTxWidthSet = |
| 2321 | psessionEntry->reAssocHtSupportedChannelWidthSet; |
| 2322 | psessionEntry->reAssocHtSecondaryChannelOffset = |
| 2323 | psessionEntry->pLimReAssocReq->cbMode; |
| 2324 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2325 | psessionEntry->limReassocBssCaps = |
| 2326 | psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2327 | regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel ); |
| 2328 | localPowerConstraint = regMax; |
| 2329 | limExtractApCapability( pMac, |
| 2330 | (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields, |
| 2331 | limGetIElenFromBssDescription( |
| 2332 | &psessionEntry->pLimReAssocReq->bssDescription), |
| 2333 | &psessionEntry->limReassocBssQosCaps, |
| 2334 | &psessionEntry->limReassocBssPropCap, |
| 2335 | &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimReassocBssUapsd session specific |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 2336 | , &localPowerConstraint, |
| 2337 | psessionEntry |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2338 | ); |
| 2339 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2340 | psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2341 | #if defined WLAN_VOWIFI_DEBUG |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2342 | limLog( pMac, LOGE, "Regulatory max = %d, local power constraint " |
| 2343 | "= %d, max tx = %d", regMax, localPowerConstraint, |
| 2344 | psessionEntry->maxTxPower ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2345 | #endif |
| 2346 | { |
| 2347 | #if 0 |
| 2348 | if (wlan_cfgGetStr(pMac, WNI_CFG_SSID, pMac->lim.gLimReassocSSID.ssId, |
| 2349 | &cfgLen) != eSIR_SUCCESS) |
| 2350 | { |
| 2351 | /// Could not get SSID from CFG. Log error. |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2352 | limLog(pMac, LOGP, FL("could not retrive SSID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2353 | } |
| 2354 | #endif//TO SUPPORT BT-AMP |
| 2355 | |
| 2356 | /* Copy the SSID from sessio entry to local variable */ |
| 2357 | #if 0 |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2358 | vos_mem_copy( pMac->lim.gLimReassocSSID.ssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2359 | psessionEntry->ssId.ssId, |
| 2360 | psessionEntry->ssId.length); |
| 2361 | #endif |
| 2362 | psessionEntry->limReassocSSID.length = pReassocReq->ssId.length; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2363 | vos_mem_copy( psessionEntry->limReassocSSID.ssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2364 | pReassocReq->ssId.ssId, psessionEntry->limReassocSSID.length); |
| 2365 | |
| 2366 | } |
| 2367 | |
| 2368 | if (pMac->lim.gLimCurrentBssUapsd) |
| 2369 | { |
| 2370 | pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimReAssocReq->uapsdPerAcBitmask; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2371 | limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"), |
| 2372 | pMac->lim.gUapsdPerAcBitmask); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2373 | } |
| 2374 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2375 | pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq)); |
| 2376 | if ( NULL == pMlmReassocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2377 | { |
| 2378 | // Log error |
| 2379 | limLog(pMac, LOGP, |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2380 | FL("call to AllocateMemory failed for mlmReassocReq")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2381 | |
| 2382 | retCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2383 | goto end; |
| 2384 | } |
| 2385 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2386 | vos_mem_copy( pMlmReassocReq->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2387 | psessionEntry->limReAssocbssId, |
| 2388 | sizeof(tSirMacAddr)); |
| 2389 | |
| 2390 | if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT, |
| 2391 | (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout) |
| 2392 | != eSIR_SUCCESS) |
| 2393 | { |
| 2394 | /** |
| 2395 | * Could not get ReassocFailureTimeout value |
| 2396 | * from CFG. Log error. |
| 2397 | */ |
| 2398 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2399 | FL("could not retrieve ReassocFailureTimeout value")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2400 | } |
| 2401 | |
| 2402 | if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS) |
| 2403 | { |
| 2404 | /** |
| 2405 | * Could not get Capabilities value |
| 2406 | * from CFG. Log error. |
| 2407 | */ |
| 2408 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2409 | FL("could not retrieve Capabilities value")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2410 | } |
| 2411 | pMlmReassocReq->capabilityInfo = caps; |
| 2412 | |
| 2413 | /* Update PE sessionId*/ |
| 2414 | pMlmReassocReq->sessionId = sessionId; |
| 2415 | |
| 2416 | /* If telescopic beaconing is enabled, set listen interval to |
| 2417 | WNI_CFG_TELE_BCN_MAX_LI */ |
| 2418 | if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) != |
| 2419 | eSIR_SUCCESS) |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2420 | limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2421 | |
| 2422 | val = WNI_CFG_LISTEN_INTERVAL_STADEF; |
| 2423 | |
| 2424 | if(teleBcnEn) |
| 2425 | { |
| 2426 | if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != |
| 2427 | eSIR_SUCCESS) |
| 2428 | { |
| 2429 | /** |
| 2430 | * Could not get ListenInterval value |
| 2431 | * from CFG. Log error. |
| 2432 | */ |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2433 | limLog(pMac, LOGP, FL("could not retrieve ListenInterval")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2434 | } |
| 2435 | } |
| 2436 | else |
| 2437 | { |
| 2438 | if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS) |
| 2439 | { |
| 2440 | /** |
| 2441 | * Could not get ListenInterval value |
| 2442 | * from CFG. Log error. |
| 2443 | */ |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2444 | limLog(pMac, LOGP, FL("could not retrieve ListenInterval")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2445 | } |
| 2446 | } |
| 2447 | |
| 2448 | /* Delete all BA sessions before Re-Assoc. |
| 2449 | * BA frames are class 3 frames and the session |
| 2450 | * is lost upon disassociation and reassociation. |
| 2451 | */ |
| 2452 | |
Ganesh Kondabattini | 01f75c9 | 2014-07-07 19:27:41 +0530 | [diff] [blame] | 2453 | limDeleteBASessions(pMac, psessionEntry, BA_BOTH_DIRECTIONS, |
| 2454 | eSIR_MAC_UNSPEC_FAILURE_REASON); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2455 | |
| 2456 | pMlmReassocReq->listenInterval = (tANI_U16) val; |
| 2457 | |
| 2458 | /* Indicate whether spectrum management is enabled*/ |
| 2459 | psessionEntry->spectrumMgtEnabled = pReassocReq->spectrumMgtIndicator; |
| 2460 | |
Rajesh Babu Prathipati | 043149f | 2014-06-06 13:33:45 +0530 | [diff] [blame] | 2461 | /* Enable the spectrum management if this is a DFS channel */ |
| 2462 | if (psessionEntry->countryInfoPresent && |
| 2463 | limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel)) |
| 2464 | { |
| 2465 | psessionEntry->spectrumMgtEnabled = TRUE; |
| 2466 | } |
| 2467 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2468 | psessionEntry->limPrevSmeState = psessionEntry->limSmeState; |
| 2469 | psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE; |
| 2470 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2471 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2472 | |
| 2473 | limPostMlmMessage(pMac, |
| 2474 | LIM_MLM_REASSOC_REQ, |
| 2475 | (tANI_U32 *) pMlmReassocReq); |
| 2476 | return; |
| 2477 | |
| 2478 | end: |
| 2479 | if (pReassocReq) |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2480 | vos_mem_free( pReassocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2481 | |
| 2482 | if (psessionEntry) |
| 2483 | { |
| 2484 | // error occurred after we determined the session so extract |
| 2485 | // session and transaction info from there |
| 2486 | smeSessionId = psessionEntry->smeSessionId; |
| 2487 | transactionId = psessionEntry->transactionId; |
| 2488 | } |
| 2489 | else |
| 2490 | { |
| 2491 | // error occurred before or during the time we determined the session |
| 2492 | // so extract the session and transaction info from the message |
| 2493 | limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId); |
| 2494 | } |
| 2495 | |
| 2496 | /// Send Reassoc failure response to host |
| 2497 | /// (note psessionEntry may be NULL, but that's OK) |
| 2498 | limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, |
| 2499 | retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 2500 | psessionEntry, smeSessionId, transactionId); |
| 2501 | |
| 2502 | } /*** end __limProcessSmeReassocReq() ***/ |
| 2503 | |
| 2504 | |
| 2505 | tANI_BOOLEAN sendDisassocFrame = 1; |
| 2506 | /** |
| 2507 | * __limProcessSmeDisassocReq() |
| 2508 | * |
| 2509 | *FUNCTION: |
| 2510 | * This function is called to process SME_DISASSOC_REQ message |
| 2511 | * from HDD or upper layer application. |
| 2512 | * |
| 2513 | *LOGIC: |
| 2514 | * |
| 2515 | *ASSUMPTIONS: |
| 2516 | * |
| 2517 | *NOTE: |
| 2518 | * |
| 2519 | * @param pMac Pointer to Global MAC structure |
| 2520 | * @param *pMsgBuf A pointer to the SME message buffer |
| 2521 | * @return None |
| 2522 | */ |
| 2523 | |
| 2524 | static void |
| 2525 | __limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 2526 | { |
| 2527 | tANI_U16 disassocTrigger, reasonCode; |
| 2528 | tLimMlmDisassocReq *pMlmDisassocReq; |
| 2529 | tSirResultCodes retCode = eSIR_SME_SUCCESS; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2530 | tSirRetStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2531 | tSirSmeDisassocReq smeDisassocReq; |
| 2532 | tpPESession psessionEntry = NULL; |
| 2533 | tANI_U8 sessionId; |
| 2534 | tANI_U8 smesessionId; |
| 2535 | tANI_U16 smetransactionId; |
| 2536 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2537 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2538 | if (pMsgBuf == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2539 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2540 | limLog(pMac, LOGE, FL("Buffer is Pointing to NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2541 | return; |
| 2542 | } |
| 2543 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2544 | limGetSessionInfo(pMac, (tANI_U8 *)pMsgBuf,&smesessionId, &smetransactionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2545 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2546 | status = limDisassocReqSerDes(pMac, &smeDisassocReq, (tANI_U8 *) pMsgBuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2547 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2548 | if ( (eSIR_FAILURE == status) || |
| 2549 | (!limIsSmeDisassocReqValid(pMac, &smeDisassocReq, psessionEntry)) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2550 | { |
| 2551 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2552 | FL("received invalid SME_DISASSOC_REQ message"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2553 | |
| 2554 | if (pMac->lim.gLimRspReqd) |
| 2555 | { |
| 2556 | pMac->lim.gLimRspReqd = false; |
| 2557 | |
| 2558 | retCode = eSIR_SME_INVALID_PARAMETERS; |
| 2559 | disassocTrigger = eLIM_HOST_DISASSOC; |
| 2560 | goto sendDisassoc; |
| 2561 | } |
| 2562 | |
| 2563 | return; |
| 2564 | } |
| 2565 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2566 | if((psessionEntry = peFindSessionByBssid(pMac,smeDisassocReq.bssId,&sessionId))== NULL) |
| 2567 | { |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 2568 | limLog(pMac, LOGE,FL("session does not exist for given bssId "MAC_ADDRESS_STR), |
| 2569 | MAC_ADDR_ARRAY(smeDisassocReq.bssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2570 | retCode = eSIR_SME_INVALID_PARAMETERS; |
| 2571 | disassocTrigger = eLIM_HOST_DISASSOC; |
| 2572 | goto sendDisassoc; |
| 2573 | |
| 2574 | } |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 2575 | limLog(pMac, LOG1, FL("received DISASSOC_REQ message on sessionid %d" |
| 2576 | "Systemrole %d Reason: %u SmeState: %d from: "MAC_ADDRESS_STR), |
| 2577 | smesessionId,psessionEntry->limSystemRole, |
| 2578 | smeDisassocReq.reasonCode, pMac->lim.gLimSmeState, |
| 2579 | MAC_ADDR_ARRAY(smeDisassocReq.peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2580 | |
| 2581 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 2582 | limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, 0, smeDisassocReq.reasonCode); |
| 2583 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 2584 | |
| 2585 | /* Update SME session Id and SME transaction ID*/ |
| 2586 | |
| 2587 | psessionEntry->smeSessionId = smesessionId; |
| 2588 | psessionEntry->transactionId = smetransactionId; |
| 2589 | |
| 2590 | switch (psessionEntry->limSystemRole) |
| 2591 | { |
| 2592 | case eLIM_STA_ROLE: |
| 2593 | case eLIM_BT_AMP_STA_ROLE: |
| 2594 | switch (psessionEntry->limSmeState) |
| 2595 | { |
| 2596 | case eLIM_SME_ASSOCIATED_STATE: |
| 2597 | case eLIM_SME_LINK_EST_STATE: |
Kanchanapally, Vidyullatha | c796fc6 | 2015-03-17 10:45:28 +0530 | [diff] [blame^] | 2598 | limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in " |
| 2599 | "limSmeState: %d "),psessionEntry->limSmeState); |
| 2600 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2601 | psessionEntry->limPrevSmeState = psessionEntry->limSmeState; |
| 2602 | psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE; |
Hoonki Lee | 8c9e99f | 2013-04-18 22:59:11 -0700 | [diff] [blame] | 2603 | #ifdef FEATURE_WLAN_TDLS |
| 2604 | /* Delete all TDLS peers connected before leaving BSS*/ |
| 2605 | limDeleteTDLSPeers(pMac, psessionEntry); |
| 2606 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2607 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2608 | break; |
| 2609 | |
| 2610 | case eLIM_SME_WT_DEAUTH_STATE: |
| 2611 | /* PE shall still process the DISASSOC_REQ and proceed with |
| 2612 | * link tear down even if it had already sent a DEAUTH_IND to |
| 2613 | * to SME. pMac->lim.gLimPrevSmeState shall remain the same as |
| 2614 | * its been set when PE entered WT_DEAUTH_STATE. |
| 2615 | */ |
| 2616 | psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2617 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 2618 | limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in " |
| 2619 | "SME_WT_DEAUTH_STATE. ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2620 | break; |
| 2621 | |
| 2622 | case eLIM_SME_WT_DISASSOC_STATE: |
| 2623 | /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it |
| 2624 | * received DISASSOC_REQ. Which means host is also trying to disconnect. |
| 2625 | * PE can continue processing DISASSOC_REQ and send the response instead |
| 2626 | * of failing the request. SME will anyway ignore DEAUTH_IND that was sent |
| 2627 | * for disassoc frame. |
| 2628 | * |
| 2629 | * It will send a disassoc, which is ok. However, we can use the global flag |
| 2630 | * sendDisassoc to not send disassoc frame. |
| 2631 | */ |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 2632 | limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in " |
| 2633 | "SME_WT_DISASSOC_STATE. ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2634 | break; |
| 2635 | |
| 2636 | case eLIM_SME_JOIN_FAILURE_STATE: { |
| 2637 | /** Return Success as we are already in Disconnected State*/ |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 2638 | limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in " |
| 2639 | "eLIM_SME_JOIN_FAILURE_STATE. ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2640 | if (pMac->lim.gLimRspReqd) { |
| 2641 | retCode = eSIR_SME_SUCCESS; |
| 2642 | disassocTrigger = eLIM_HOST_DISASSOC; |
| 2643 | goto sendDisassoc; |
| 2644 | } |
| 2645 | }break; |
| 2646 | default: |
| 2647 | /** |
| 2648 | * STA is not currently associated. |
| 2649 | * Log error and send response to host |
| 2650 | */ |
| 2651 | limLog(pMac, LOGE, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 2652 | FL("received unexpected SME_DISASSOC_REQ in state %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2653 | psessionEntry->limSmeState); |
| 2654 | limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState); |
| 2655 | |
| 2656 | if (pMac->lim.gLimRspReqd) |
| 2657 | { |
| 2658 | if (psessionEntry->limSmeState != |
| 2659 | eLIM_SME_WT_ASSOC_STATE) |
| 2660 | pMac->lim.gLimRspReqd = false; |
| 2661 | |
| 2662 | retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE; |
| 2663 | disassocTrigger = eLIM_HOST_DISASSOC; |
| 2664 | goto sendDisassoc; |
| 2665 | } |
| 2666 | |
| 2667 | return; |
| 2668 | } |
| 2669 | |
| 2670 | break; |
| 2671 | |
| 2672 | case eLIM_AP_ROLE: |
| 2673 | case eLIM_BT_AMP_AP_ROLE: |
| 2674 | // Fall through |
| 2675 | break; |
| 2676 | |
| 2677 | case eLIM_STA_IN_IBSS_ROLE: |
| 2678 | default: // eLIM_UNKNOWN_ROLE |
| 2679 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2680 | FL("received unexpected SME_DISASSOC_REQ for role %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2681 | psessionEntry->limSystemRole); |
| 2682 | |
| 2683 | retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE; |
| 2684 | disassocTrigger = eLIM_HOST_DISASSOC; |
| 2685 | goto sendDisassoc; |
| 2686 | } // end switch (pMac->lim.gLimSystemRole) |
| 2687 | |
| 2688 | if (smeDisassocReq.reasonCode == eLIM_LINK_MONITORING_DISASSOC) |
| 2689 | { |
| 2690 | /// Disassociation is triggered by Link Monitoring |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 2691 | limLog(pMac, LOG1, FL("Sending Disasscoc with reason Link Monitoring")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2692 | disassocTrigger = eLIM_LINK_MONITORING_DISASSOC; |
| 2693 | reasonCode = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON; |
| 2694 | } |
| 2695 | else |
| 2696 | { |
| 2697 | disassocTrigger = eLIM_HOST_DISASSOC; |
| 2698 | reasonCode = smeDisassocReq.reasonCode; |
| 2699 | } |
| 2700 | |
| 2701 | if (smeDisassocReq.doNotSendOverTheAir) |
| 2702 | { |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 2703 | limLog(pMac, LOG1, FL("do not send dissoc over the air")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2704 | sendDisassocFrame = 0; |
| 2705 | } |
| 2706 | // Trigger Disassociation frame to peer MAC entity |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 2707 | limLog(pMac, LOG1, FL("Sending Disasscoc with disassoc Trigger" |
| 2708 | " : %d, reasonCode : %d"), |
| 2709 | disassocTrigger, reasonCode); |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2710 | pMlmDisassocReq = vos_mem_malloc(sizeof(tLimMlmDisassocReq)); |
| 2711 | if ( NULL == pMlmDisassocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2712 | { |
| 2713 | // Log error |
| 2714 | limLog(pMac, LOGP, |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2715 | FL("call to AllocateMemory failed for mlmDisassocReq")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2716 | |
| 2717 | return; |
| 2718 | } |
| 2719 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2720 | vos_mem_copy( (tANI_U8 *) &pMlmDisassocReq->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2721 | (tANI_U8 *) &smeDisassocReq.peerMacAddr, |
| 2722 | sizeof(tSirMacAddr)); |
| 2723 | |
| 2724 | pMlmDisassocReq->reasonCode = reasonCode; |
| 2725 | pMlmDisassocReq->disassocTrigger = disassocTrigger; |
| 2726 | |
| 2727 | /* Update PE session ID*/ |
| 2728 | pMlmDisassocReq->sessionId = sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2729 | |
| 2730 | limPostMlmMessage(pMac, |
| 2731 | LIM_MLM_DISASSOC_REQ, |
| 2732 | (tANI_U32 *) pMlmDisassocReq); |
| 2733 | return; |
| 2734 | |
| 2735 | sendDisassoc: |
| 2736 | if (psessionEntry) |
| 2737 | limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr, |
| 2738 | retCode, |
| 2739 | disassocTrigger, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2740 | 1,smesessionId,smetransactionId,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2741 | else |
| 2742 | limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr, |
| 2743 | retCode, |
| 2744 | disassocTrigger, |
Sudhir Sattayappa Kohalli | 5a8ac22 | 2013-03-06 12:41:42 -0800 | [diff] [blame] | 2745 | 1, smesessionId, smetransactionId, NULL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2746 | |
| 2747 | |
| 2748 | } /*** end __limProcessSmeDisassocReq() ***/ |
| 2749 | |
| 2750 | |
| 2751 | /** ----------------------------------------------------------------- |
| 2752 | \brief __limProcessSmeDisassocCnf() - Process SME_DISASSOC_CNF |
| 2753 | |
| 2754 | This function is called to process SME_DISASSOC_CNF message |
| 2755 | from HDD or upper layer application. |
| 2756 | |
| 2757 | \param pMac - global mac structure |
| 2758 | \param pStaDs - station dph hash node |
| 2759 | \return none |
| 2760 | \sa |
| 2761 | ----------------------------------------------------------------- */ |
| 2762 | static void |
| 2763 | __limProcessSmeDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 2764 | { |
| 2765 | tSirSmeDisassocCnf smeDisassocCnf; |
| 2766 | tANI_U16 aid; |
| 2767 | tpDphHashNode pStaDs; |
| 2768 | tSirRetStatus status = eSIR_SUCCESS; |
| 2769 | tpPESession psessionEntry; |
| 2770 | tANI_U8 sessionId; |
| 2771 | |
| 2772 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 2773 | limLog(pMac, LOG1, FL("received SME_DISASSOC_CNF message")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2774 | |
| 2775 | status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf); |
| 2776 | |
| 2777 | if (status == eSIR_FAILURE) |
| 2778 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2779 | PELOGE(limLog(pMac, LOGE, FL("invalid SME_DISASSOC_CNF message"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2780 | return; |
| 2781 | } |
| 2782 | |
| 2783 | if((psessionEntry = peFindSessionByBssid(pMac, smeDisassocCnf.bssId, &sessionId))== NULL) |
| 2784 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2785 | limLog(pMac, LOGE,FL("session does not exist for given bssId")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2786 | return; |
| 2787 | } |
| 2788 | |
| 2789 | if (!limIsSmeDisassocCnfValid(pMac, &smeDisassocCnf, psessionEntry)) |
| 2790 | { |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 2791 | limLog(pMac, LOGE, FL("received invalid SME_DISASSOC_CNF message")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2792 | return; |
| 2793 | } |
| 2794 | |
| 2795 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 2796 | if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF) |
| 2797 | limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0); |
| 2798 | else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF) |
| 2799 | limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0); |
| 2800 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 2801 | |
| 2802 | switch (psessionEntry->limSystemRole) |
| 2803 | { |
| 2804 | case eLIM_STA_ROLE: |
| 2805 | case eLIM_BT_AMP_STA_ROLE: //To test reconn |
| 2806 | if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) && |
| 2807 | (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) && |
| 2808 | (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)) |
| 2809 | { |
| 2810 | limLog(pMac, LOGE, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 2811 | FL("received unexp SME_DISASSOC_CNF in state %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2812 | psessionEntry->limSmeState); |
| 2813 | limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState); |
| 2814 | return; |
| 2815 | } |
| 2816 | break; |
| 2817 | |
| 2818 | case eLIM_AP_ROLE: |
| 2819 | // Fall through |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2820 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2821 | |
| 2822 | case eLIM_STA_IN_IBSS_ROLE: |
| 2823 | default: // eLIM_UNKNOWN_ROLE |
| 2824 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2825 | FL("received unexpected SME_DISASSOC_CNF role %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2826 | psessionEntry->limSystemRole); |
| 2827 | |
| 2828 | return; |
| 2829 | } |
| 2830 | |
| 2831 | |
| 2832 | if ( (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) || |
| 2833 | (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2834 | || (psessionEntry->limSystemRole == eLIM_AP_ROLE ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2835 | ) |
| 2836 | { |
| 2837 | pStaDs = dphLookupHashEntry(pMac, smeDisassocCnf.peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 2838 | if (pStaDs == NULL) |
| 2839 | { |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 2840 | PELOGE(limLog(pMac, LOGE, FL("received DISASSOC_CNF for a STA that " |
| 2841 | "does not have context, addr= "MAC_ADDRESS_STR), |
| 2842 | MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2843 | return; |
| 2844 | } |
Madan Mohan Koyyalamudi | 2300172 | 2012-10-31 16:48:56 -0700 | [diff] [blame] | 2845 | /* Delete FT session if there exists one */ |
| 2846 | limFTCleanup(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2847 | limCleanupRxPath(pMac, pStaDs, psessionEntry); |
Madan Mohan Koyyalamudi | a67d433 | 2012-11-29 11:35:23 -0800 | [diff] [blame] | 2848 | |
| 2849 | limCleanUpDisassocDeauthReq(pMac, (char*)&smeDisassocCnf.peerMacAddr, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2850 | } |
| 2851 | |
| 2852 | return; |
| 2853 | } |
| 2854 | |
| 2855 | |
| 2856 | /** |
| 2857 | * __limProcessSmeDeauthReq() |
| 2858 | * |
| 2859 | *FUNCTION: |
| 2860 | * This function is called to process SME_DEAUTH_REQ message |
| 2861 | * from HDD or upper layer application. |
| 2862 | * |
| 2863 | *LOGIC: |
| 2864 | * |
| 2865 | *ASSUMPTIONS: |
| 2866 | * |
| 2867 | *NOTE: |
| 2868 | * |
| 2869 | * @param pMac Pointer to Global MAC structure |
| 2870 | * @param *pMsgBuf A pointer to the SME message buffer |
| 2871 | * @return None |
| 2872 | */ |
| 2873 | |
| 2874 | static void |
| 2875 | __limProcessSmeDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 2876 | { |
| 2877 | tANI_U16 deauthTrigger, reasonCode; |
| 2878 | tLimMlmDeauthReq *pMlmDeauthReq; |
| 2879 | tSirSmeDeauthReq smeDeauthReq; |
| 2880 | tSirResultCodes retCode = eSIR_SME_SUCCESS; |
| 2881 | tSirRetStatus status = eSIR_SUCCESS; |
| 2882 | tpPESession psessionEntry; |
| 2883 | tANI_U8 sessionId; //PE sessionId |
| 2884 | tANI_U8 smesessionId; |
| 2885 | tANI_U16 smetransactionId; |
| 2886 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2887 | |
| 2888 | status = limDeauthReqSerDes(pMac, &smeDeauthReq,(tANI_U8 *) pMsgBuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2889 | limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId); |
| 2890 | |
| 2891 | //We need to get a session first but we don't even know if the message is correct. |
| 2892 | if((psessionEntry = peFindSessionByBssid(pMac, smeDeauthReq.bssId, &sessionId)) == NULL) |
| 2893 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2894 | limLog(pMac, LOGE,FL("session does not exist for given bssId")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2895 | retCode = eSIR_SME_INVALID_PARAMETERS; |
| 2896 | deauthTrigger = eLIM_HOST_DEAUTH; |
| 2897 | goto sendDeauth; |
| 2898 | |
| 2899 | } |
| 2900 | |
| 2901 | if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry))) |
| 2902 | { |
Sachin Ahuja | 4235414 | 2015-01-06 19:48:35 +0530 | [diff] [blame] | 2903 | PELOGE(limLog(pMac, LOGE,FL |
| 2904 | ("received invalid SME_DEAUTH_REQ message"));) |
| 2905 | pMac->lim.gLimRspReqd = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2906 | |
Sachin Ahuja | 4235414 | 2015-01-06 19:48:35 +0530 | [diff] [blame] | 2907 | retCode = eSIR_SME_INVALID_PARAMETERS; |
| 2908 | deauthTrigger = eLIM_HOST_DEAUTH; |
| 2909 | goto sendDeauth; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2910 | } |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 2911 | limLog(pMac, LOG1,FL("received DEAUTH_REQ message on sessionid %d " |
| 2912 | "Systemrole %d with reasoncode %u in limSmestate %d from " |
| 2913 | MAC_ADDRESS_STR), smesessionId, psessionEntry->limSystemRole, |
| 2914 | smeDeauthReq.reasonCode, psessionEntry->limSmeState, |
| 2915 | MAC_ADDR_ARRAY(smeDeauthReq.peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2916 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 2917 | limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, psessionEntry, 0, smeDeauthReq.reasonCode); |
| 2918 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 2919 | |
| 2920 | /* Update SME session ID and Transaction ID */ |
| 2921 | psessionEntry->smeSessionId = smesessionId; |
| 2922 | psessionEntry->transactionId = smetransactionId; |
| 2923 | |
| 2924 | |
| 2925 | switch (psessionEntry->limSystemRole) |
| 2926 | { |
| 2927 | case eLIM_STA_ROLE: |
| 2928 | case eLIM_BT_AMP_STA_ROLE: |
| 2929 | |
| 2930 | switch (psessionEntry->limSmeState) |
| 2931 | { |
| 2932 | case eLIM_SME_ASSOCIATED_STATE: |
| 2933 | case eLIM_SME_LINK_EST_STATE: |
| 2934 | case eLIM_SME_WT_ASSOC_STATE: |
| 2935 | case eLIM_SME_JOIN_FAILURE_STATE: |
| 2936 | case eLIM_SME_IDLE_STATE: |
| 2937 | psessionEntry->limPrevSmeState = psessionEntry->limSmeState; |
| 2938 | psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE; |
Varun Reddy Yeturu | e3bbf6e | 2013-02-08 18:50:55 -0800 | [diff] [blame] | 2939 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2940 | |
| 2941 | // Send Deauthentication request to MLM below |
| 2942 | |
| 2943 | break; |
Sachin Ahuja | a100dcc | 2014-07-03 14:30:18 +0530 | [diff] [blame] | 2944 | case eLIM_SME_WT_DEAUTH_STATE: |
| 2945 | /* |
| 2946 | * PE Recieved a Deauth frame. Normally it gets |
| 2947 | * DEAUTH_CNF but it received DEAUTH_REQ. Which |
| 2948 | * means host is also trying to disconnect. |
| 2949 | * PE can continue processing DEAUTH_REQ and send |
| 2950 | * the response instead of failing the request. |
| 2951 | * SME will anyway ignore DEAUTH_IND that was sent |
| 2952 | * for deauth frame. |
| 2953 | */ |
| 2954 | limLog(pMac, LOG1, FL("Rcvd SME_DEAUTH_REQ while in " |
| 2955 | "SME_WT_DEAUTH_STATE. ")); |
| 2956 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2957 | default: |
| 2958 | /** |
| 2959 | * STA is not in a state to deauthenticate with |
| 2960 | * peer. Log error and send response to host. |
| 2961 | */ |
| 2962 | limLog(pMac, LOGE, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 2963 | FL("received unexp SME_DEAUTH_REQ in state %d"), |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 2964 | psessionEntry->limSmeState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2965 | limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState); |
| 2966 | |
| 2967 | if (pMac->lim.gLimRspReqd) |
| 2968 | { |
| 2969 | pMac->lim.gLimRspReqd = false; |
| 2970 | |
| 2971 | retCode = eSIR_SME_STA_NOT_AUTHENTICATED; |
| 2972 | deauthTrigger = eLIM_HOST_DEAUTH; |
Leela Venkata Kiran Kumar Reddy Chirala | 56df73f | 2014-01-30 14:18:00 -0800 | [diff] [blame] | 2973 | /** |
| 2974 | *here we received deauth request from AP so sme state is |
| 2975 | eLIM_SME_WT_DEAUTH_STATE.if we have ISSUED delSta then |
| 2976 | mlm state should be eLIM_MLM_WT_DEL_STA_RSP_STATE and if |
| 2977 | we got delBSS rsp then mlm state should be eLIM_MLM_IDLE_STATE |
| 2978 | so the below condition captures the state where delSta |
| 2979 | not done and firmware still in connected state. |
| 2980 | */ |
| 2981 | if (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE && |
| 2982 | psessionEntry->limMlmState != eLIM_MLM_IDLE_STATE && |
| 2983 | psessionEntry->limMlmState != eLIM_MLM_WT_DEL_STA_RSP_STATE) |
| 2984 | { |
| 2985 | retCode = eSIR_SME_DEAUTH_STATUS; |
| 2986 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2987 | goto sendDeauth; |
| 2988 | } |
| 2989 | |
| 2990 | return; |
| 2991 | } |
| 2992 | |
| 2993 | break; |
| 2994 | |
| 2995 | case eLIM_STA_IN_IBSS_ROLE: |
| 2996 | |
| 2997 | return; |
| 2998 | |
| 2999 | case eLIM_AP_ROLE: |
| 3000 | // Fall through |
| 3001 | |
| 3002 | break; |
| 3003 | |
| 3004 | default: |
| 3005 | limLog(pMac, LOGE, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 3006 | FL("received unexpected SME_DEAUTH_REQ for role %d"), |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3007 | psessionEntry->limSystemRole); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3008 | |
| 3009 | return; |
| 3010 | } // end switch (pMac->lim.gLimSystemRole) |
| 3011 | |
| 3012 | if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH) |
| 3013 | { |
| 3014 | /// Deauthentication is triggered by Link Monitoring |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 3015 | limLog(pMac, LOG1, |
| 3016 | FL("Deauthentication is triggered by Link Monitoring")); |
| 3017 | limLog(pMac, LOG1, |
| 3018 | FL("Set Trigger to eLIM_LINK_MONITORING_DEAUTH")); |
| 3019 | limLog(pMac, LOG1, |
| 3020 | FL("and Reason to eSIR_MAC_UNSPEC_FAILURE_REASON")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3021 | deauthTrigger = eLIM_LINK_MONITORING_DEAUTH; |
| 3022 | reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON; |
| 3023 | } |
| 3024 | else |
| 3025 | { |
| 3026 | deauthTrigger = eLIM_HOST_DEAUTH; |
| 3027 | reasonCode = smeDeauthReq.reasonCode; |
| 3028 | } |
| 3029 | |
| 3030 | // Trigger Deauthentication frame to peer MAC entity |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3031 | pMlmDeauthReq = vos_mem_malloc(sizeof(tLimMlmDeauthReq)); |
| 3032 | if ( NULL == pMlmDeauthReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3033 | { |
| 3034 | // Log error |
| 3035 | limLog(pMac, LOGP, |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3036 | FL("call to AllocateMemory failed for mlmDeauthReq")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3037 | |
| 3038 | return; |
| 3039 | } |
| 3040 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3041 | vos_mem_copy( (tANI_U8 *) &pMlmDeauthReq->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3042 | (tANI_U8 *) &smeDeauthReq.peerMacAddr, |
| 3043 | sizeof(tSirMacAddr)); |
| 3044 | |
| 3045 | pMlmDeauthReq->reasonCode = reasonCode; |
| 3046 | pMlmDeauthReq->deauthTrigger = deauthTrigger; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3047 | |
| 3048 | /* Update PE session Id*/ |
| 3049 | pMlmDeauthReq->sessionId = sessionId; |
| 3050 | |
| 3051 | limPostMlmMessage(pMac, |
| 3052 | LIM_MLM_DEAUTH_REQ, |
| 3053 | (tANI_U32 *) pMlmDeauthReq); |
| 3054 | return; |
| 3055 | |
| 3056 | sendDeauth: |
| 3057 | limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr, |
| 3058 | retCode, |
| 3059 | deauthTrigger, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3060 | 1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3061 | smesessionId, smetransactionId); |
| 3062 | } /*** end __limProcessSmeDeauthReq() ***/ |
| 3063 | |
| 3064 | |
| 3065 | |
| 3066 | /** |
| 3067 | * __limProcessSmeSetContextReq() |
| 3068 | * |
| 3069 | *FUNCTION: |
| 3070 | * This function is called to process SME_SETCONTEXT_REQ message |
| 3071 | * from HDD or upper layer application. |
| 3072 | * |
| 3073 | *LOGIC: |
| 3074 | * |
| 3075 | *ASSUMPTIONS: |
| 3076 | * |
| 3077 | *NOTE: |
| 3078 | * |
| 3079 | * @param pMac Pointer to Global MAC structure |
| 3080 | * @param *pMsgBuf A pointer to the SME message buffer |
| 3081 | * @return None |
| 3082 | */ |
| 3083 | |
| 3084 | static void |
| 3085 | __limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 3086 | { |
| 3087 | tpSirSmeSetContextReq pSetContextReq; |
| 3088 | tLimMlmSetKeysReq *pMlmSetKeysReq; |
| 3089 | tpPESession psessionEntry; |
| 3090 | tANI_U8 sessionId; //PE sessionID |
| 3091 | tANI_U8 smesessionId; |
| 3092 | tANI_U16 smetransactionId; |
| 3093 | |
| 3094 | |
| 3095 | PELOG1(limLog(pMac, LOG1, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3096 | FL("received SETCONTEXT_REQ message"));); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3097 | |
| 3098 | |
| 3099 | if(pMsgBuf == NULL) |
| 3100 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3101 | limLog(pMac, LOGE,FL("Buffer is Pointing to NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3102 | return; |
| 3103 | } |
| 3104 | |
| 3105 | limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId); |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3106 | |
| 3107 | pSetContextReq = vos_mem_malloc(sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS); |
| 3108 | if ( NULL == pSetContextReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3109 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3110 | limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSetContextReq")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3111 | return; |
| 3112 | } |
| 3113 | |
| 3114 | if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) || |
| 3115 | (!limIsSmeSetContextReqValid(pMac, pSetContextReq))) |
| 3116 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3117 | limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3118 | goto end; |
| 3119 | } |
| 3120 | |
| 3121 | if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS) |
| 3122 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3123 | PELOGE(limLog(pMac, LOGE, FL("numKeys:%d is more than SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS"), pSetContextReq->keyMaterial.numKeys);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3124 | limSendSmeSetContextRsp(pMac, |
| 3125 | pSetContextReq->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3126 | 1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3127 | eSIR_SME_INVALID_PARAMETERS,NULL, |
| 3128 | smesessionId,smetransactionId); |
| 3129 | |
| 3130 | goto end; |
| 3131 | } |
| 3132 | |
| 3133 | |
| 3134 | if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL) |
| 3135 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3136 | limLog(pMac, LOGW, FL("Session does not exist for given BSSID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3137 | limSendSmeSetContextRsp(pMac, |
| 3138 | pSetContextReq->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3139 | 1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3140 | eSIR_SME_INVALID_PARAMETERS,NULL, |
| 3141 | smesessionId,smetransactionId); |
| 3142 | |
| 3143 | goto end; |
| 3144 | } |
| 3145 | |
| 3146 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 3147 | limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0); |
| 3148 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 3149 | |
| 3150 | |
| 3151 | if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) && |
| 3152 | (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) || |
| 3153 | (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) || |
| 3154 | (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) && |
| 3155 | (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE))) |
| 3156 | { |
| 3157 | // Trigger MLM_SETKEYS_REQ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3158 | pMlmSetKeysReq = vos_mem_malloc(sizeof(tLimMlmSetKeysReq)); |
| 3159 | if ( NULL == pMlmSetKeysReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3160 | { |
| 3161 | // Log error |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3162 | limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmSetKeysReq")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3163 | goto end; |
| 3164 | } |
| 3165 | |
| 3166 | pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType; |
| 3167 | pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys; |
| 3168 | if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS) |
| 3169 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3170 | limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3171 | goto end; |
| 3172 | } |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3173 | vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3174 | (tANI_U8 *) &pSetContextReq->peerMacAddr, |
| 3175 | sizeof(tSirMacAddr)); |
| 3176 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3177 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3178 | vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3179 | (tANI_U8 *) &pSetContextReq->keyMaterial.key, |
| 3180 | sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1)); |
| 3181 | |
| 3182 | pMlmSetKeysReq->sessionId = sessionId; |
| 3183 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
| 3184 | PELOG1(limLog(pMac, LOG1, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3185 | FL("received SETCONTEXT_REQ message sessionId=%d"), pMlmSetKeysReq->sessionId);); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3186 | #endif |
| 3187 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3188 | if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104)) |
| 3189 | && (psessionEntry->limSystemRole == eLIM_AP_ROLE)) |
| 3190 | { |
| 3191 | if(pSetContextReq->keyMaterial.key[0].keyLength) |
| 3192 | { |
| 3193 | tANI_U8 keyId; |
| 3194 | keyId = pSetContextReq->keyMaterial.key[0].keyId; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3195 | vos_mem_copy( (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3196 | (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial)); |
| 3197 | } |
| 3198 | else { |
| 3199 | tANI_U32 i; |
| 3200 | for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++) |
| 3201 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3202 | vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key[i], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3203 | (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys)); |
| 3204 | } |
| 3205 | } |
| 3206 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3207 | |
| 3208 | limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3209 | } |
| 3210 | else |
| 3211 | { |
| 3212 | limLog(pMac, LOGE, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 3213 | FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3214 | psessionEntry->limSystemRole, |
| 3215 | psessionEntry->limSmeState); |
| 3216 | limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState); |
| 3217 | |
| 3218 | limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3219 | 1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3220 | eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry, |
| 3221 | smesessionId, |
| 3222 | smetransactionId); |
| 3223 | } |
| 3224 | |
| 3225 | end: |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 3226 | vos_mem_zero(pSetContextReq, |
| 3227 | (sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)); |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3228 | vos_mem_free( pSetContextReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3229 | return; |
| 3230 | } /*** end __limProcessSmeSetContextReq() ***/ |
| 3231 | |
| 3232 | /** |
| 3233 | * __limProcessSmeRemoveKeyReq() |
| 3234 | * |
| 3235 | *FUNCTION: |
| 3236 | * This function is called to process SME_REMOVEKEY_REQ message |
| 3237 | * from HDD or upper layer application. |
| 3238 | * |
| 3239 | *LOGIC: |
| 3240 | * |
| 3241 | *ASSUMPTIONS: |
| 3242 | * |
| 3243 | *NOTE: |
| 3244 | * |
| 3245 | * @param pMac Pointer to Global MAC structure |
| 3246 | * @param *pMsgBuf A pointer to the SME message buffer |
| 3247 | * @return None |
| 3248 | */ |
| 3249 | |
| 3250 | static void |
| 3251 | __limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 3252 | { |
| 3253 | tpSirSmeRemoveKeyReq pRemoveKeyReq; |
| 3254 | tLimMlmRemoveKeyReq *pMlmRemoveKeyReq; |
| 3255 | tpPESession psessionEntry; |
| 3256 | tANI_U8 sessionId; //PE sessionID |
| 3257 | tANI_U8 smesessionId; |
| 3258 | tANI_U16 smetransactionId; |
| 3259 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 3260 | limLog(pMac, LOG1, |
| 3261 | FL("received SME_REMOVEKEY_REQ message")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3262 | |
| 3263 | if(pMsgBuf == NULL) |
| 3264 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3265 | limLog(pMac, LOGE,FL("Buffer is Pointing to NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3266 | return; |
| 3267 | } |
| 3268 | |
| 3269 | |
| 3270 | limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId); |
| 3271 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3272 | pRemoveKeyReq = vos_mem_malloc(sizeof(*pRemoveKeyReq)); |
| 3273 | if ( NULL == pRemoveKeyReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3274 | { |
| 3275 | //Log error |
| 3276 | limLog(pMac, LOGP, |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3277 | FL("call to AllocateMemory failed for pRemoveKeyReq")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3278 | |
| 3279 | return; |
| 3280 | } |
| 3281 | |
| 3282 | if ((limRemoveKeyReqSerDes(pMac, |
| 3283 | pRemoveKeyReq, |
| 3284 | (tANI_U8 *) pMsgBuf) == eSIR_FAILURE)) |
| 3285 | { |
| 3286 | limLog(pMac, LOGW, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3287 | FL("received invalid SME_REMOVECONTEXT_REQ message")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3288 | |
| 3289 | /* extra look up is needed since, session entry to be passed il limsendremovekey response */ |
| 3290 | |
| 3291 | if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL) |
| 3292 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3293 | limLog(pMac, LOGE,FL("session does not exist for given bssId")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3294 | //goto end; |
| 3295 | } |
| 3296 | |
| 3297 | limSendSmeRemoveKeyRsp(pMac, |
| 3298 | pRemoveKeyReq->peerMacAddr, |
| 3299 | eSIR_SME_INVALID_PARAMETERS,psessionEntry, |
| 3300 | smesessionId,smetransactionId); |
| 3301 | |
| 3302 | goto end; |
| 3303 | } |
| 3304 | |
| 3305 | if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL) |
| 3306 | { |
| 3307 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3308 | FL("session does not exist for given bssId")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3309 | limSendSmeRemoveKeyRsp(pMac, |
| 3310 | pRemoveKeyReq->peerMacAddr, |
| 3311 | eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL, |
| 3312 | smesessionId, smetransactionId); |
| 3313 | goto end; |
| 3314 | } |
| 3315 | |
| 3316 | |
| 3317 | if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&& |
| 3318 | (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) || |
| 3319 | (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) || |
| 3320 | (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) && |
| 3321 | (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE))) |
| 3322 | { |
| 3323 | // Trigger MLM_REMOVEKEYS_REQ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3324 | pMlmRemoveKeyReq = vos_mem_malloc(sizeof(tLimMlmRemoveKeyReq)); |
| 3325 | if ( NULL == pMlmRemoveKeyReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3326 | { |
| 3327 | // Log error |
| 3328 | limLog(pMac, LOGP, |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3329 | FL("call to AllocateMemory failed for mlmRemoveKeysReq")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3330 | |
| 3331 | goto end; |
| 3332 | } |
| 3333 | |
| 3334 | pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType; |
| 3335 | pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId; |
| 3336 | pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType; |
| 3337 | pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast; |
| 3338 | |
| 3339 | /* Update PE session Id */ |
| 3340 | pMlmRemoveKeyReq->sessionId = sessionId; |
| 3341 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3342 | vos_mem_copy( (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3343 | (tANI_U8 *) &pRemoveKeyReq->peerMacAddr, |
| 3344 | sizeof(tSirMacAddr)); |
| 3345 | |
| 3346 | |
| 3347 | limPostMlmMessage(pMac, |
| 3348 | LIM_MLM_REMOVEKEY_REQ, |
| 3349 | (tANI_U32 *) pMlmRemoveKeyReq); |
| 3350 | } |
| 3351 | else |
| 3352 | { |
| 3353 | limLog(pMac, LOGE, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 3354 | FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3355 | psessionEntry->limSystemRole, |
| 3356 | psessionEntry->limSmeState); |
| 3357 | limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState); |
| 3358 | |
| 3359 | limSendSmeRemoveKeyRsp(pMac, |
| 3360 | pRemoveKeyReq->peerMacAddr, |
| 3361 | eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry, |
| 3362 | smesessionId,smetransactionId); |
| 3363 | } |
| 3364 | |
| 3365 | end: |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3366 | vos_mem_free( pRemoveKeyReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3367 | } /*** end __limProcessSmeRemoveKeyReq() ***/ |
| 3368 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3369 | void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 3370 | { |
| 3371 | tSirMsgQ mmhMsg; |
| 3372 | tpSmeGetScanChnRsp pSirSmeRsp; |
| 3373 | tANI_U16 len = 0; |
Madan Mohan Koyyalamudi | de1b5bc | 2013-07-12 00:56:04 +0530 | [diff] [blame] | 3374 | tANI_U8 sessionId; |
| 3375 | tANI_U16 transactionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3376 | |
| 3377 | if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST) |
| 3378 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3379 | limLog(pMac, LOGW, FL("numChn is out of bounds %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3380 | pMac->lim.scanChnInfo.numChnInfo); |
| 3381 | pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST; |
| 3382 | } |
| 3383 | |
Abhishek Singh | 525045c | 2014-12-15 17:18:45 +0530 | [diff] [blame] | 3384 | limLog(pMac, LOG1, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3385 | FL("Sending message %s with number of channels %d"), |
Abhishek Singh | 525045c | 2014-12-15 17:18:45 +0530 | [diff] [blame] | 3386 | limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3387 | |
| 3388 | len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn); |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3389 | pSirSmeRsp = vos_mem_malloc(len); |
| 3390 | if ( NULL == pSirSmeRsp ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3391 | { |
| 3392 | /// Buffer not available. Log error |
| 3393 | limLog(pMac, LOGP, |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3394 | FL("call to AllocateMemory failed for JOIN/REASSOC_RSP")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3395 | |
| 3396 | return; |
| 3397 | } |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3398 | vos_mem_set(pSirSmeRsp, len, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3399 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3400 | pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP; |
| 3401 | pSirSmeRsp->mesgLen = len; |
Madan Mohan Koyyalamudi | de1b5bc | 2013-07-12 00:56:04 +0530 | [diff] [blame] | 3402 | |
| 3403 | if (pMac->fScanOffload) |
| 3404 | { |
| 3405 | limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&sessionId,&transactionId); |
| 3406 | pSirSmeRsp->sessionId = sessionId; |
| 3407 | } |
| 3408 | else |
| 3409 | pSirSmeRsp->sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3410 | |
| 3411 | if(pMac->lim.scanChnInfo.numChnInfo) |
| 3412 | { |
| 3413 | pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3414 | vos_mem_copy( pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn, |
| 3415 | sizeof(tLimScanChn) * pSirSmeRsp->numChn); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3416 | } |
| 3417 | //Clear the list |
| 3418 | limRessetScanChannelInfo(pMac); |
| 3419 | |
| 3420 | mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP; |
| 3421 | mmhMsg.bodyptr = pSirSmeRsp; |
| 3422 | mmhMsg.bodyval = 0; |
| 3423 | |
| 3424 | pMac->lim.gLimRspReqd = false; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3425 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3426 | limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 3427 | } |
| 3428 | |
| 3429 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3430 | void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 3431 | { |
| 3432 | tSirSmeGetAssocSTAsReq getAssocSTAsReq; |
| 3433 | tpDphHashNode pStaDs = NULL; |
| 3434 | tpPESession psessionEntry = NULL; |
| 3435 | tSap_Event sapEvent; |
| 3436 | tpWLAN_SAPEventCB pSapEventCallback = NULL; |
| 3437 | tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h" |
| 3438 | tANI_U8 sessionId = CSR_SESSION_ID_INVALID; |
| 3439 | tANI_U8 assocId = 0; |
| 3440 | tANI_U8 staCount = 0; |
| 3441 | |
| 3442 | if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf)) |
| 3443 | { |
| 3444 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3445 | FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message")); |
Girish Gowli | afd4231 | 2014-07-24 13:13:59 +0530 | [diff] [blame] | 3446 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3447 | } |
| 3448 | |
| 3449 | switch (getAssocSTAsReq.modId) |
| 3450 | { |
| 3451 | /** |
| 3452 | case VOS_MODULE_ID_HAL: |
| 3453 | wdaPostCtrlMsg( pMac, &msgQ ); |
| 3454 | return; |
| 3455 | |
| 3456 | case VOS_MODULE_ID_TL: |
| 3457 | Post msg TL |
| 3458 | return; |
| 3459 | */ |
| 3460 | case VOS_MODULE_ID_PE: |
| 3461 | default: |
| 3462 | break; |
| 3463 | } |
| 3464 | |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 3465 | // Get Associated stations from PE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3466 | // Find PE session Entry |
| 3467 | if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL) |
| 3468 | { |
| 3469 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3470 | FL("session does not exist for given bssId")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3471 | goto limAssocStaEnd; |
| 3472 | } |
| 3473 | |
| 3474 | if (psessionEntry->limSystemRole != eLIM_AP_ROLE) |
| 3475 | { |
| 3476 | limLog(pMac, LOGE, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 3477 | FL("Received unexpected message in state %d, in role %d"), |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3478 | psessionEntry->limSmeState, psessionEntry->limSystemRole); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3479 | goto limAssocStaEnd; |
| 3480 | } |
| 3481 | |
| 3482 | // Retrieve values obtained in the request message |
| 3483 | pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback; |
| 3484 | pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray; |
| 3485 | |
| 3486 | for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8 |
| 3487 | { |
| 3488 | pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable); |
| 3489 | |
Abhishek Singh | 8a99b9f | 2015-03-31 14:18:26 +0530 | [diff] [blame] | 3490 | if ((NULL == pStaDs) || (NULL == pAssocStasTemp)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3491 | continue; |
| 3492 | |
| 3493 | if (pStaDs->valid) |
| 3494 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3495 | vos_mem_copy((tANI_U8 *)&pAssocStasTemp->staMac, |
| 3496 | (tANI_U8 *)&pStaDs->staAddr, |
| 3497 | sizeof(v_MACADDR_t)); // Mac address |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3498 | pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id |
| 3499 | pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id |
| 3500 | |
Kiet Lam | b123319 | 2013-11-28 13:38:20 +0530 | [diff] [blame] | 3501 | vos_mem_copy((tANI_U8 *)&pAssocStasTemp->supportedRates, |
Leo Chang | 614d207 | 2013-08-22 14:59:44 -0700 | [diff] [blame] | 3502 | (tANI_U8 *)&pStaDs->supportedRates, |
| 3503 | sizeof(tSirSupportedRates)); |
| 3504 | pAssocStasTemp->ShortGI40Mhz = pStaDs->htShortGI40Mhz; |
| 3505 | pAssocStasTemp->ShortGI20Mhz = pStaDs->htShortGI20Mhz; |
| 3506 | pAssocStasTemp->Support40Mhz = pStaDs->htDsssCckRate40MHzSupport; |
| 3507 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3508 | limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3509 | limLog(pMac, LOG1, FL("MAC = " MAC_ADDRESS_STR), |
| 3510 | MAC_ADDR_ARRAY(pStaDs->staAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3511 | limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId); |
| 3512 | limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex); |
| 3513 | |
| 3514 | pAssocStasTemp++; |
| 3515 | staCount++; |
| 3516 | } |
| 3517 | } |
| 3518 | |
| 3519 | limAssocStaEnd: |
| 3520 | // Call hdd callback with sap event to send the list of associated stations from PE |
| 3521 | if (pSapEventCallback != NULL) |
| 3522 | { |
| 3523 | sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT; |
| 3524 | sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE; |
| 3525 | sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount; |
| 3526 | sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray; |
| 3527 | pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext); |
| 3528 | } |
| 3529 | } |
| 3530 | |
| 3531 | |
| 3532 | /** |
| 3533 | * limProcessSmeGetWPSPBCSessions |
| 3534 | * |
| 3535 | *FUNCTION: |
| 3536 | * This function is called when query the WPS PBC overlap message is received |
| 3537 | * |
| 3538 | *LOGIC: |
| 3539 | * This function parses get WPS PBC overlap information message and call callback to pass |
| 3540 | * WPS PBC overlap information back to hdd. |
| 3541 | *ASSUMPTIONS: |
| 3542 | * |
| 3543 | * |
| 3544 | *NOTE: |
| 3545 | * |
| 3546 | * @param pMac Pointer to Global MAC structure |
| 3547 | * @param pMsgBuf A pointer to WPS PBC overlap query message |
| 3548 | * |
| 3549 | * @return None |
| 3550 | */ |
| 3551 | void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 3552 | { |
| 3553 | tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq; |
| 3554 | tpPESession psessionEntry = NULL; |
| 3555 | tSap_Event sapEvent; |
| 3556 | tpWLAN_SAPEventCB pSapEventCallback = NULL; |
| 3557 | tANI_U8 sessionId = CSR_SESSION_ID_INVALID; |
| 3558 | tSirMacAddr zeroMac = {0,0,0,0,0,0}; |
| 3559 | |
| 3560 | sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT; |
| 3561 | |
| 3562 | if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) |
| 3563 | { |
| 3564 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3565 | FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message")); |
Girish Gowli | afd4231 | 2014-07-24 13:13:59 +0530 | [diff] [blame] | 3566 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3567 | } |
| 3568 | |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 3569 | // Get Associated stations from PE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3570 | // Find PE session Entry |
| 3571 | if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL) |
| 3572 | { |
| 3573 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3574 | FL("session does not exist for given bssId")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3575 | goto limGetWPSPBCSessionsEnd; |
| 3576 | } |
| 3577 | |
| 3578 | if (psessionEntry->limSystemRole != eLIM_AP_ROLE) |
| 3579 | { |
| 3580 | limLog(pMac, LOGE, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 3581 | FL("Received unexpected message in role %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3582 | psessionEntry->limSystemRole); |
| 3583 | goto limGetWPSPBCSessionsEnd; |
| 3584 | } |
| 3585 | |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 3586 | // Call hdd callback with sap event to send the WPS PBC overlap information |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3587 | sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT; |
| 3588 | sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE; |
| 3589 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3590 | if (vos_mem_compare( zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3591 | { //This is GetWpsSession call |
| 3592 | |
| 3593 | limGetWPSPBCSessions(pMac, |
| 3594 | sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E, |
| 3595 | &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry); |
| 3596 | } |
| 3597 | else |
| 3598 | { |
| 3599 | limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry); |
| 3600 | /* don't have to inform the HDD/Host */ |
| 3601 | return; |
| 3602 | } |
| 3603 | |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3604 | PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3605 | PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);) |
| 3606 | |
| 3607 | sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS; |
| 3608 | |
| 3609 | limGetWPSPBCSessionsEnd: |
| 3610 | pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback; |
Abhishek Singh | 8a99b9f | 2015-03-31 14:18:26 +0530 | [diff] [blame] | 3611 | |
| 3612 | if (NULL != pSapEventCallback) |
| 3613 | pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3614 | } |
| 3615 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3616 | |
| 3617 | |
| 3618 | /** |
| 3619 | * __limCounterMeasures() |
| 3620 | * |
| 3621 | * FUNCTION: |
| 3622 | * This function is called to "implement" MIC counter measure |
| 3623 | * and is *temporary* only |
| 3624 | * |
| 3625 | * LOGIC: on AP, disassoc all STA associated thru TKIP, |
| 3626 | * we don't do the proper STA disassoc sequence since the |
| 3627 | * BSS will be stoped anyway |
| 3628 | * |
| 3629 | *ASSUMPTIONS: |
| 3630 | * |
| 3631 | *NOTE: |
| 3632 | * |
| 3633 | * @param pMac Pointer to Global MAC structure |
| 3634 | * @return None |
| 3635 | */ |
| 3636 | |
| 3637 | static void |
| 3638 | __limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 3639 | { |
| 3640 | tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
Abhishek Singh | 8944b22 | 2014-09-17 16:13:17 +0530 | [diff] [blame] | 3641 | /* If PMF is enabled then don't send broadcast disassociation */ |
| 3642 | if ( ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) || |
| 3643 | (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) || |
| 3644 | (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) |
| 3645 | #ifdef WLAN_FEATURE_11W |
| 3646 | && !psessionEntry->limRmfEnabled |
| 3647 | #endif |
| 3648 | ) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3649 | limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry, FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3650 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3651 | }; |
| 3652 | |
| 3653 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3654 | void |
| 3655 | limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 3656 | { |
| 3657 | tSirSmeTkipCntrMeasReq tkipCntrMeasReq; |
| 3658 | tpPESession psessionEntry; |
| 3659 | tANI_U8 sessionId; //PE sessionId |
| 3660 | |
| 3661 | if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS ) |
| 3662 | { |
| 3663 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3664 | FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3665 | return; |
| 3666 | } |
| 3667 | |
| 3668 | if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) ) |
| 3669 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3670 | limLog(pMac, LOGE, FL("session does not exist for given BSSID ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3671 | return; |
| 3672 | } |
| 3673 | |
| 3674 | if ( tkipCntrMeasReq.bEnable ) |
| 3675 | { |
| 3676 | __limCounterMeasures( pMac, psessionEntry ); |
| 3677 | } |
| 3678 | |
| 3679 | psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable; |
| 3680 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3681 | |
| 3682 | |
| 3683 | static void |
| 3684 | __limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 3685 | { |
| 3686 | tSirSmeStopBssReq stopBssReq; |
| 3687 | tSirRetStatus status; |
| 3688 | tLimSmeStates prevState; |
| 3689 | tANI_U8 sessionId; //PE sessionId |
| 3690 | tpPESession psessionEntry; |
| 3691 | tANI_U8 smesessionId; |
| 3692 | tANI_U16 smetransactionId; |
Sachin Ahuja | 51c08e6 | 2014-03-26 19:21:29 +0530 | [diff] [blame] | 3693 | tANI_U8 i = 0; |
| 3694 | tpDphHashNode pStaDs = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3695 | |
| 3696 | limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId); |
| 3697 | |
| 3698 | |
| 3699 | |
| 3700 | if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) || |
| 3701 | !limIsSmeStopBssReqValid(pMsgBuf)) |
| 3702 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3703 | PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3704 | /// Send Stop BSS response to host |
| 3705 | limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId); |
| 3706 | return; |
| 3707 | } |
| 3708 | |
| 3709 | |
| 3710 | if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL) |
| 3711 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3712 | limLog(pMac, LOGW, FL("session does not exist for given BSSID ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3713 | limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId); |
| 3714 | return; |
| 3715 | } |
| 3716 | |
| 3717 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 3718 | limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0); |
| 3719 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 3720 | |
| 3721 | |
| 3722 | if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */ |
| 3723 | (psessionEntry->limSystemRole == eLIM_STA_ROLE )) |
| 3724 | { |
| 3725 | /** |
| 3726 | * Should not have received STOP_BSS_REQ in states |
| 3727 | * other than 'normal' state or on STA in Infrastructure |
| 3728 | * mode. Log error and return response to host. |
| 3729 | */ |
| 3730 | limLog(pMac, LOGE, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 3731 | FL("received unexpected SME_STOP_BSS_REQ in state %d, for role %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3732 | psessionEntry->limSmeState, psessionEntry->limSystemRole); |
| 3733 | limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState); |
| 3734 | /// Send Stop BSS response to host |
| 3735 | limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId); |
| 3736 | return; |
| 3737 | } |
| 3738 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3739 | if (psessionEntry->limSystemRole == eLIM_AP_ROLE ) |
| 3740 | { |
| 3741 | limWPSPBCClose(pMac, psessionEntry); |
| 3742 | } |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3743 | PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d"), stopBssReq.reasonCode);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3744 | |
| 3745 | prevState = psessionEntry->limSmeState; |
| 3746 | |
| 3747 | psessionEntry->limSmeState = eLIM_SME_IDLE_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3748 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3749 | |
| 3750 | /* Update SME session Id and Transaction Id */ |
| 3751 | psessionEntry->smeSessionId = smesessionId; |
| 3752 | psessionEntry->transactionId = smetransactionId; |
| 3753 | |
Abhishek Singh | 8944b22 | 2014-09-17 16:13:17 +0530 | [diff] [blame] | 3754 | /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame. |
| 3755 | * If PMF is enabled then don't send broadcast disassociation */ |
| 3756 | if ( ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) && |
| 3757 | (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) ) |
| 3758 | #ifdef WLAN_FEATURE_11W |
| 3759 | && !psessionEntry->limRmfEnabled |
| 3760 | #endif |
| 3761 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3762 | { |
| 3763 | tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
| 3764 | if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES)) |
| 3765 | // Send disassoc all stations associated thru TKIP |
| 3766 | __limCounterMeasures(pMac,psessionEntry); |
| 3767 | else |
Madan Mohan Koyyalamudi | 299b486 | 2013-01-30 19:59:23 +0530 | [diff] [blame] | 3768 | limSendDisassocMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, bcAddr, psessionEntry, FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3769 | } |
| 3770 | |
| 3771 | //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg. |
| 3772 | pMac->lim.gLimIbssCoalescingHappened = false; |
| 3773 | |
Sachin Ahuja | 51c08e6 | 2014-03-26 19:21:29 +0530 | [diff] [blame] | 3774 | for(i = 1 ; i < pMac->lim.gLimAssocStaLimit ; i++) |
| 3775 | { |
| 3776 | pStaDs = dphGetHashEntry(pMac, i, &psessionEntry->dph.dphHashTable); |
| 3777 | if (NULL == pStaDs) |
| 3778 | continue; |
| 3779 | status = limDelSta(pMac, pStaDs, false, psessionEntry) ; |
| 3780 | if(eSIR_SUCCESS == status) |
| 3781 | { |
| 3782 | limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry) ; |
| 3783 | limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry) ; |
| 3784 | } |
| 3785 | else |
| 3786 | { |
| 3787 | limLog(pMac, LOGE, FL("limDelSta failed with Status : %d"), status); |
| 3788 | VOS_ASSERT(0) ; |
| 3789 | } |
| 3790 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3791 | /* send a delBss to HAL and wait for a response */ |
| 3792 | status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry); |
| 3793 | |
| 3794 | if (status != eSIR_SUCCESS) |
| 3795 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3796 | PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d"), psessionEntry->bssIdx);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3797 | psessionEntry->limSmeState= prevState; |
| 3798 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3799 | MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3800 | |
| 3801 | limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId); |
| 3802 | } |
| 3803 | } |
| 3804 | |
| 3805 | |
| 3806 | /**-------------------------------------------------------------- |
| 3807 | \fn __limProcessSmeStopBssReq |
| 3808 | |
| 3809 | \brief Wrapper for the function __limHandleSmeStopBssRequest |
| 3810 | This message will be defered until softmac come out of |
| 3811 | scan mode. Message should be handled even if we have |
| 3812 | detected radar in the current operating channel. |
| 3813 | \param pMac |
| 3814 | \param pMsg |
| 3815 | |
| 3816 | \return TRUE - If we consumed the buffer |
| 3817 | FALSE - If have defered the message. |
| 3818 | ---------------------------------------------------------------*/ |
| 3819 | static tANI_BOOLEAN |
| 3820 | __limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg) |
| 3821 | { |
| 3822 | if (__limIsDeferedMsgForLearn(pMac, pMsg)) |
| 3823 | { |
| 3824 | /** |
| 3825 | * If message defered, buffer is not consumed yet. |
| 3826 | * So return false |
| 3827 | */ |
| 3828 | return eANI_BOOLEAN_FALSE; |
| 3829 | } |
| 3830 | __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr); |
| 3831 | return eANI_BOOLEAN_TRUE; |
| 3832 | } /*** end __limProcessSmeStopBssReq() ***/ |
| 3833 | |
| 3834 | |
| 3835 | void limProcessSmeDelBssRsp( |
| 3836 | tpAniSirGlobal pMac, |
| 3837 | tANI_U32 body,tpPESession psessionEntry) |
| 3838 | { |
| 3839 | |
| 3840 | (void) body; |
| 3841 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 3842 | //TBD: get the sessionEntry |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 3843 | limIbssDelete(pMac,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3844 | dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable); |
| 3845 | limDeletePreAuthList(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3846 | limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId); |
| 3847 | return; |
| 3848 | } |
| 3849 | |
| 3850 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3851 | /**--------------------------------------------------------------- |
| 3852 | \fn __limProcessSmeAssocCnfNew |
| 3853 | \brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF |
| 3854 | \ in BTAMP AP. |
| 3855 | \ |
| 3856 | \param pMac |
| 3857 | \param msgType - message type |
| 3858 | \param pMsgBuf - a pointer to the SME message buffer |
| 3859 | \return None |
| 3860 | ------------------------------------------------------------------*/ |
| 3861 | |
| 3862 | void |
| 3863 | __limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf) |
| 3864 | { |
| 3865 | tSirSmeAssocCnf assocCnf; |
| 3866 | tpDphHashNode pStaDs = NULL; |
| 3867 | tpPESession psessionEntry= NULL; |
| 3868 | tANI_U8 sessionId; |
| 3869 | |
| 3870 | |
| 3871 | if(pMsgBuf == NULL) |
| 3872 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3873 | limLog(pMac, LOGE, FL("pMsgBuf is NULL ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3874 | goto end; |
| 3875 | } |
| 3876 | |
| 3877 | if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) || |
| 3878 | !__limIsSmeAssocCnfValid(&assocCnf)) |
| 3879 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3880 | limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3881 | goto end; |
| 3882 | } |
| 3883 | |
| 3884 | if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL) |
| 3885 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3886 | limLog(pMac, LOGE, FL("session does not exist for given bssId")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3887 | goto end; |
| 3888 | } |
| 3889 | |
| 3890 | if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) || |
| 3891 | ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE))) |
| 3892 | { |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 3893 | limLog(pMac, LOGE, FL("Received unexpected message %X in state %d, in role %d"), |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3894 | msgType, psessionEntry->limSmeState, psessionEntry->limSystemRole); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3895 | goto end; |
| 3896 | } |
| 3897 | |
| 3898 | pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable); |
| 3899 | |
| 3900 | if (pStaDs == NULL) |
| 3901 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 3902 | limLog(pMac, LOGE, |
| 3903 | FL("Received invalid message %X due to no STA context, " |
| 3904 | "for aid %d, peer "), |
| 3905 | msgType, assocCnf.aid); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3906 | limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1); |
| 3907 | |
| 3908 | /* |
| 3909 | ** send a DISASSOC_IND message to WSM to make sure |
| 3910 | ** the state in WSM and LIM is the same |
| 3911 | **/ |
| 3912 | limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED, |
| 3913 | eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry); |
| 3914 | goto end; |
| 3915 | } |
| 3916 | if ((pStaDs && |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3917 | (( !vos_mem_compare( (tANI_U8 *) pStaDs->staAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3918 | (tANI_U8 *) assocCnf.peerMacAddr, |
| 3919 | sizeof(tSirMacAddr)) ) || |
| 3920 | (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) || |
| 3921 | ((pStaDs->mlmStaContext.subType == LIM_ASSOC) && |
| 3922 | (msgType != eWNI_SME_ASSOC_CNF)) || |
| 3923 | ((pStaDs->mlmStaContext.subType == LIM_REASSOC) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3924 | (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3925 | { |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 3926 | limLog(pMac, LOGE, |
| 3927 | FL("Received invalid message %X due to peerMacAddr mismatched " |
| 3928 | "or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer " |
| 3929 | "StaD mlmState : %d"), |
| 3930 | msgType, assocCnf.aid, pStaDs->mlmStaContext.mlmState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3931 | limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1); |
| 3932 | goto end; |
| 3933 | } |
| 3934 | |
| 3935 | /* |
| 3936 | ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF |
| 3937 | ** has been received |
| 3938 | **/ |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3939 | limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3940 | limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId); |
| 3941 | |
| 3942 | if (assocCnf.statusCode == eSIR_SME_SUCCESS) |
| 3943 | { |
| 3944 | /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence |
| 3945 | * when it had received Assoc Request frame. Now, PE just needs to send |
| 3946 | * Association Response frame to the requesting BTAMP-STA. |
| 3947 | */ |
| 3948 | pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE; |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3949 | limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3950 | limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr, |
| 3951 | pStaDs->mlmStaContext.subType, pStaDs, psessionEntry); |
| 3952 | goto end; |
| 3953 | } // (assocCnf.statusCode == eSIR_SME_SUCCESS) |
| 3954 | else |
| 3955 | { |
| 3956 | // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated |
| 3957 | /*Since the HAL sta entry is created for denied STA we need to remove this HAL entry.So to do that set updateContext to 1*/ |
| 3958 | if(!pStaDs->mlmStaContext.updateContext) |
| 3959 | pStaDs->mlmStaContext.updateContext = 1; |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 3960 | limLog(pMac, LOG1, FL("Receive Assoc Cnf with status Code : %d(assoc id=%d) "), |
| 3961 | assocCnf.statusCode, pStaDs->assocId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3962 | limRejectAssociation(pMac, pStaDs->staAddr, |
| 3963 | pStaDs->mlmStaContext.subType, |
| 3964 | true, pStaDs->mlmStaContext.authType, |
| 3965 | pStaDs->assocId, true, |
| 3966 | eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3967 | } |
| 3968 | |
| 3969 | end: |
| 3970 | if((psessionEntry != NULL) && (pStaDs != NULL)) |
| 3971 | { |
| 3972 | if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL ) |
| 3973 | { |
| 3974 | if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame) |
| 3975 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3976 | vos_mem_free(((tpSirAssocReq) |
| 3977 | (psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3978 | ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL; |
| 3979 | } |
| 3980 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3981 | vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3982 | psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL; |
| 3983 | } |
| 3984 | } |
| 3985 | |
| 3986 | } /*** end __limProcessSmeAssocCnfNew() ***/ |
| 3987 | |
| 3988 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3989 | |
| 3990 | |
| 3991 | static void |
| 3992 | __limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 3993 | { |
| 3994 | tpDphHashNode pStaDs; |
| 3995 | tSirMacAddr peerMac; |
| 3996 | tpSirAddtsReq pSirAddts; |
| 3997 | tANI_U32 timeout; |
| 3998 | tpPESession psessionEntry; |
| 3999 | tANI_U8 sessionId; //PE sessionId |
| 4000 | tANI_U8 smesessionId; |
| 4001 | tANI_U16 smetransactionId; |
| 4002 | |
| 4003 | |
| 4004 | if(pMsgBuf == NULL) |
| 4005 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4006 | limLog(pMac, LOGE,FL("Buffer is Pointing to NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4007 | return; |
| 4008 | } |
| 4009 | |
| 4010 | limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId); |
| 4011 | |
| 4012 | pSirAddts = (tpSirAddtsReq) pMsgBuf; |
| 4013 | |
| 4014 | if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL) |
| 4015 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4016 | limLog(pMac, LOGE, "Session Does not exist for given bssId"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4017 | return; |
| 4018 | } |
| 4019 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 4020 | limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0); |
| 4021 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 4022 | |
| 4023 | |
| 4024 | |
| 4025 | /* if sta |
| 4026 | * - verify assoc state |
| 4027 | * - send addts request to ap |
| 4028 | * - wait for addts response from ap |
| 4029 | * if ap, just ignore with error log |
| 4030 | */ |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 4031 | limLog(pMac, LOG1, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4032 | FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4033 | pSirAddts->req.tspec.tsinfo.traffic.tsid, |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 4034 | pSirAddts->req.tspec.tsinfo.traffic.userPrio); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4035 | |
| 4036 | if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE)) |
| 4037 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4038 | PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring");) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4039 | limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec, |
| 4040 | smesessionId,smetransactionId); |
| 4041 | return; |
| 4042 | } |
| 4043 | |
| 4044 | //Ignore the request if STA is in 11B mode. |
| 4045 | if(psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B) |
| 4046 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4047 | PELOGE(limLog(pMac, LOGE, "AddTS received while Dot11Mode is 11B - ignoring");) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4048 | limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec, |
| 4049 | smesessionId,smetransactionId); |
| 4050 | return; |
| 4051 | } |
| 4052 | |
| 4053 | |
| 4054 | pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable); |
| 4055 | |
| 4056 | if(pStaDs == NULL) |
| 4057 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4058 | PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req");) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4059 | limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec, |
| 4060 | smesessionId,smetransactionId); |
| 4061 | return; |
| 4062 | } |
| 4063 | |
| 4064 | if ((! pStaDs->valid) || |
| 4065 | (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)) |
| 4066 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4067 | PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state");) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4068 | limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec, |
| 4069 | smesessionId,smetransactionId); |
| 4070 | return; |
| 4071 | } |
| 4072 | |
| 4073 | pSirAddts->req.wsmTspecPresent = 0; |
| 4074 | pSirAddts->req.wmeTspecPresent = 0; |
| 4075 | pSirAddts->req.lleTspecPresent = 0; |
| 4076 | |
| 4077 | if ((pStaDs->wsmEnabled) && |
| 4078 | (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA)) |
| 4079 | pSirAddts->req.wsmTspecPresent = 1; |
| 4080 | else if (pStaDs->wmeEnabled) |
| 4081 | pSirAddts->req.wmeTspecPresent = 1; |
| 4082 | else if (pStaDs->lleEnabled) |
| 4083 | pSirAddts->req.lleTspecPresent = 1; |
| 4084 | else |
| 4085 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4086 | PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4087 | limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec, |
| 4088 | smesessionId,smetransactionId); |
| 4089 | return; |
| 4090 | } |
| 4091 | |
| 4092 | if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) && |
| 4093 | (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)) |
| 4094 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4095 | limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4096 | psessionEntry->limSmeState); |
| 4097 | limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec, |
| 4098 | smesessionId,smetransactionId); |
| 4099 | return; |
| 4100 | } |
| 4101 | |
| 4102 | if (pMac->lim.gLimAddtsSent) |
| 4103 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4104 | limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4105 | pMac->lim.gLimAddtsReq.req.dialogToken, |
| 4106 | pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid, |
| 4107 | pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio); |
| 4108 | limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec, |
| 4109 | smesessionId,smetransactionId); |
| 4110 | return; |
| 4111 | } |
| 4112 | |
| 4113 | #if 0 |
| 4114 | val = sizeof(tSirMacAddr); |
| 4115 | if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS) |
| 4116 | { |
| 4117 | /// Could not get BSSID from CFG. Log error. |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4118 | limLog(pMac, LOGP, FL("could not retrieve BSSID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4119 | return; |
| 4120 | } |
| 4121 | #endif |
| 4122 | sirCopyMacAddr(peerMac,psessionEntry->bssId); |
| 4123 | |
| 4124 | // save the addts request |
| 4125 | pMac->lim.gLimAddtsSent = true; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 4126 | vos_mem_copy( (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4127 | |
| 4128 | // ship out the message now |
| 4129 | limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req, |
| 4130 | psessionEntry); |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 4131 | limLog(pMac, LOG1, FL("Sent ADDTS request")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4132 | |
| 4133 | // start a timer to wait for the response |
| 4134 | if (pSirAddts->timeout) |
| 4135 | timeout = pSirAddts->timeout; |
| 4136 | else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS) |
| 4137 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4138 | limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4139 | WNI_CFG_ADDTS_RSP_TIMEOUT); |
| 4140 | return; |
| 4141 | } |
| 4142 | |
| 4143 | timeout = SYS_MS_TO_TICKS(timeout); |
| 4144 | if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS) |
| 4145 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4146 | limLog(pMac, LOGP, FL("AddtsRsp timer change failed!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4147 | return; |
| 4148 | } |
| 4149 | pMac->lim.gLimAddtsRspTimerCount++; |
| 4150 | if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer, |
| 4151 | pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS) |
| 4152 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4153 | limLog(pMac, LOGP, FL("AddtsRsp timer change failed!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4154 | return; |
| 4155 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4156 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4157 | |
| 4158 | //add the sessionId to the timer object |
| 4159 | pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId; |
| 4160 | if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS) |
| 4161 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4162 | limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4163 | return; |
| 4164 | } |
| 4165 | return; |
| 4166 | } |
| 4167 | |
| 4168 | |
| 4169 | static void |
| 4170 | __limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 4171 | { |
| 4172 | tSirMacAddr peerMacAddr; |
| 4173 | tANI_U8 ac; |
| 4174 | tSirMacTSInfo *pTsinfo; |
| 4175 | tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf; |
| 4176 | tpDphHashNode pStaDs = NULL; |
| 4177 | tpPESession psessionEntry; |
| 4178 | tANI_U8 sessionId; |
| 4179 | tANI_U32 status = eSIR_SUCCESS; |
| 4180 | tANI_U8 smesessionId; |
| 4181 | tANI_U16 smetransactionId; |
| 4182 | |
| 4183 | limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId); |
| 4184 | |
| 4185 | if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL) |
| 4186 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4187 | limLog(pMac, LOGE, "Session Does not exist for given bssId"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4188 | status = eSIR_FAILURE; |
| 4189 | goto end; |
| 4190 | } |
| 4191 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 4192 | limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0); |
| 4193 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 4194 | |
| 4195 | |
| 4196 | if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry)) |
| 4197 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4198 | PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4199 | status = eSIR_FAILURE; |
| 4200 | limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId); |
| 4201 | return; |
| 4202 | } |
| 4203 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 4204 | limLog(pMac, LOG1, FL("Sent DELTS request to station with " |
| 4205 | "assocId = %d MacAddr = "MAC_ADDRESS_STR), |
| 4206 | pDeltsReq->aid, MAC_ADDR_ARRAY(peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4207 | |
| 4208 | limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec, |
| 4209 | psessionEntry); |
| 4210 | |
| 4211 | pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo; |
| 4212 | |
| 4213 | /* We've successfully send DELTS frame to AP. Update the |
| 4214 | * dynamic UAPSD mask. The AC for this TSPEC to be deleted |
| 4215 | * is no longer trigger enabled or delivery enabled |
| 4216 | */ |
| 4217 | limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK); |
| 4218 | |
| 4219 | /* We're deleting the TSPEC, so this particular AC is no longer |
| 4220 | * admitted. PE needs to downgrade the EDCA |
| 4221 | * parameters(for the AC for which TS is being deleted) to the |
| 4222 | * next best AC for which ACM is not enabled, and send the |
| 4223 | * updated values to HAL. |
| 4224 | */ |
| 4225 | ac = upToAc(pTsinfo->traffic.userPrio); |
| 4226 | |
| 4227 | if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK) |
| 4228 | { |
| 4229 | pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac); |
| 4230 | } |
| 4231 | else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK) |
| 4232 | { |
| 4233 | pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac); |
| 4234 | } |
| 4235 | else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR) |
| 4236 | { |
| 4237 | pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac); |
| 4238 | pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac); |
| 4239 | } |
| 4240 | |
| 4241 | limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry); |
| 4242 | |
| 4243 | pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable); |
| 4244 | if (pStaDs != NULL) |
| 4245 | { |
| 4246 | if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) |
| 4247 | limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE); |
| 4248 | else |
| 4249 | limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE); |
| 4250 | status = eSIR_SUCCESS; |
| 4251 | } |
| 4252 | else |
| 4253 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4254 | limLog(pMac, LOGE, FL("Self entry missing in Hash Table ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4255 | status = eSIR_FAILURE; |
| 4256 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4257 | #ifdef FEATURE_WLAN_ESE |
| 4258 | #ifdef FEATURE_WLAN_ESE_UPLOAD |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4259 | limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0); |
| 4260 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4261 | limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4262 | #endif /* FEATURE_WLAN_ESE_UPLOAD */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4263 | #endif |
| 4264 | |
| 4265 | // send an sme response back |
| 4266 | end: |
| 4267 | limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId); |
| 4268 | } |
| 4269 | |
| 4270 | |
| 4271 | void |
| 4272 | limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param) |
| 4273 | { |
| 4274 | //fetch the sessionEntry based on the sessionId |
| 4275 | tpPESession psessionEntry; |
| 4276 | if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL) |
| 4277 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4278 | limLog(pMac, LOGP,FL("Session Does not exist for given sessionID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4279 | return; |
| 4280 | } |
| 4281 | |
| 4282 | if ( (psessionEntry->limSystemRole != eLIM_STA_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE) ) |
| 4283 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4284 | limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)", psessionEntry->limSystemRole); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4285 | pMac->lim.gLimAddtsSent = false; |
| 4286 | return; |
| 4287 | } |
| 4288 | |
| 4289 | if (! pMac->lim.gLimAddtsSent) |
| 4290 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4291 | PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent");) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4292 | return; |
| 4293 | } |
| 4294 | |
| 4295 | if (param != pMac->lim.gLimAddtsRspTimerCount) |
| 4296 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4297 | limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4298 | param, pMac->lim.gLimAddtsRspTimerCount); |
| 4299 | return; |
| 4300 | } |
| 4301 | |
| 4302 | // this a real response timeout |
| 4303 | pMac->lim.gLimAddtsSent = false; |
| 4304 | pMac->lim.gLimAddtsRspTimerCount++; |
| 4305 | |
| 4306 | limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec, |
| 4307 | psessionEntry->smeSessionId, psessionEntry->transactionId); |
| 4308 | } |
| 4309 | |
| 4310 | |
| 4311 | /** |
| 4312 | * __limProcessSmeStatsRequest() |
| 4313 | * |
| 4314 | *FUNCTION: |
| 4315 | * |
| 4316 | * |
| 4317 | *NOTE: |
| 4318 | * |
| 4319 | * @param pMac Pointer to Global MAC structure |
| 4320 | * @param *pMsgBuf A pointer to the SME message buffer |
| 4321 | * @return None |
| 4322 | */ |
| 4323 | static void |
| 4324 | __limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 4325 | { |
| 4326 | tpAniGetStatsReq pStatsReq; |
| 4327 | tSirMsgQ msgQ; |
| 4328 | tpPESession psessionEntry; |
| 4329 | tANI_U8 sessionId; |
| 4330 | |
| 4331 | |
| 4332 | if(pMsgBuf == NULL) |
| 4333 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4334 | limLog(pMac, LOGE,FL("Buffer is Pointing to NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4335 | return; |
| 4336 | } |
| 4337 | |
| 4338 | pStatsReq = (tpAniGetStatsReq) pMsgBuf; |
| 4339 | |
| 4340 | if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL) |
| 4341 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4342 | limLog(pMac, LOGE, FL("session does not exist for given bssId")); |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 4343 | vos_mem_free( pMsgBuf ); |
Leela Venkata Kiran Kumar Reddy Chirala | d6c0fe2 | 2013-12-11 19:10:50 -0800 | [diff] [blame] | 4344 | pMsgBuf = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4345 | return; |
| 4346 | } |
| 4347 | |
| 4348 | |
| 4349 | |
| 4350 | switch(pStatsReq->msgType) |
| 4351 | { |
| 4352 | //Add Lim stats here. and send reqsponse. |
| 4353 | |
| 4354 | //HAL maintained Stats. |
| 4355 | case eWNI_SME_STA_STAT_REQ: |
| 4356 | msgQ.type = WDA_STA_STAT_REQ; |
| 4357 | break; |
| 4358 | case eWNI_SME_AGGR_STAT_REQ: |
| 4359 | msgQ.type = WDA_AGGR_STAT_REQ; |
| 4360 | break; |
| 4361 | case eWNI_SME_GLOBAL_STAT_REQ: |
| 4362 | msgQ.type = WDA_GLOBAL_STAT_REQ; |
| 4363 | break; |
| 4364 | case eWNI_SME_STAT_SUMM_REQ: |
| 4365 | msgQ.type = WDA_STAT_SUMM_REQ; |
| 4366 | break; |
| 4367 | default: //Unknown request. |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4368 | PELOGE(limLog(pMac, LOGE, "Unknown Statistics request");) |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 4369 | vos_mem_free( pMsgBuf ); |
Leela Venkata Kiran Kumar Reddy Chirala | d6c0fe2 | 2013-12-11 19:10:50 -0800 | [diff] [blame] | 4370 | pMsgBuf = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4371 | return; |
| 4372 | } |
| 4373 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4374 | msgQ.reserved = 0; |
| 4375 | msgQ.bodyptr = pMsgBuf; |
| 4376 | msgQ.bodyval = 0; |
Leela Venkata Kiran Kumar Reddy Chirala | 68a6abe | 2013-02-28 07:43:16 -0800 | [diff] [blame] | 4377 | if(NULL == psessionEntry) |
| 4378 | { |
| 4379 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
| 4380 | } |
| 4381 | else |
| 4382 | { |
| 4383 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
| 4384 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4385 | if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){ |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4386 | limLog(pMac, LOGP, "Unable to forward request"); |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 4387 | vos_mem_free( pMsgBuf ); |
Leela Venkata Kiran Kumar Reddy Chirala | d6c0fe2 | 2013-12-11 19:10:50 -0800 | [diff] [blame] | 4388 | pMsgBuf = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4389 | return; |
| 4390 | } |
| 4391 | |
| 4392 | return; |
| 4393 | } |
| 4394 | |
| 4395 | |
| 4396 | /** |
| 4397 | * __limProcessSmeGetStatisticsRequest() |
| 4398 | * |
| 4399 | *FUNCTION: |
| 4400 | * |
| 4401 | * |
| 4402 | *NOTE: |
| 4403 | * |
| 4404 | * @param pMac Pointer to Global MAC structure |
| 4405 | * @param *pMsgBuf A pointer to the SME message buffer |
| 4406 | * @return None |
| 4407 | */ |
| 4408 | static void |
| 4409 | __limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 4410 | { |
| 4411 | tpAniGetPEStatsReq pPEStatsReq; |
| 4412 | tSirMsgQ msgQ; |
| 4413 | |
| 4414 | pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf; |
| 4415 | |
| 4416 | //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ |
| 4417 | |
| 4418 | msgQ.type = WDA_GET_STATISTICS_REQ; |
| 4419 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4420 | msgQ.reserved = 0; |
| 4421 | msgQ.bodyptr = pMsgBuf; |
| 4422 | msgQ.bodyval = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4423 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4424 | |
| 4425 | if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 4426 | vos_mem_free( pMsgBuf ); |
Leela Venkata Kiran Kumar Reddy Chirala | d6c0fe2 | 2013-12-11 19:10:50 -0800 | [diff] [blame] | 4427 | pMsgBuf = NULL; |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4428 | limLog(pMac, LOGP, "Unable to forward request"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4429 | return; |
| 4430 | } |
| 4431 | |
| 4432 | return; |
| 4433 | } |
| 4434 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4435 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4436 | /** |
| 4437 | *FUNCTION: __limProcessSmeGetTsmStatsRequest() |
| 4438 | * |
| 4439 | *NOTE: |
| 4440 | * |
| 4441 | * @param pMac Pointer to Global MAC structure |
| 4442 | * @param *pMsgBuf A pointer to the SME message buffer |
| 4443 | * @return None |
| 4444 | */ |
| 4445 | static void |
| 4446 | __limProcessSmeGetTsmStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 4447 | { |
| 4448 | tSirMsgQ msgQ; |
| 4449 | |
| 4450 | msgQ.type = WDA_TSM_STATS_REQ; |
| 4451 | msgQ.reserved = 0; |
| 4452 | msgQ.bodyptr = pMsgBuf; |
| 4453 | msgQ.bodyval = 0; |
| 4454 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
| 4455 | |
| 4456 | if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){ |
| 4457 | vos_mem_free( pMsgBuf ); |
Leela Venkata Kiran Kumar Reddy Chirala | d6c0fe2 | 2013-12-11 19:10:50 -0800 | [diff] [blame] | 4458 | pMsgBuf = NULL; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4459 | limLog(pMac, LOGP, "Unable to forward request"); |
| 4460 | return; |
| 4461 | } |
| 4462 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4463 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4464 | |
| 4465 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4466 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4467 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 4468 | /** |
| 4469 | * __limProcessSmeGetRoamRssiRequest() |
| 4470 | * |
| 4471 | *FUNCTION: |
| 4472 | * |
| 4473 | * |
| 4474 | *NOTE: |
| 4475 | * |
| 4476 | * @param pMac Pointer to Global MAC structure |
| 4477 | * @param *pMsgBuf A pointer to the SME message buffer |
| 4478 | * @return None |
| 4479 | */ |
| 4480 | static void |
| 4481 | __limProcessSmeGetRoamRssiRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 4482 | { |
| 4483 | tpAniGetRssiReq pPEGetRoamRssiReq = NULL; |
| 4484 | tSirMsgQ msgQ; |
| 4485 | |
| 4486 | pPEGetRoamRssiReq = (tpAniGetRssiReq) pMsgBuf; |
| 4487 | msgQ.type = WDA_GET_ROAM_RSSI_REQ; |
| 4488 | |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 4489 | msgQ.reserved = 0; |
| 4490 | msgQ.bodyptr = pMsgBuf; |
| 4491 | msgQ.bodyval = 0; |
| 4492 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
| 4493 | |
| 4494 | if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 4495 | vos_mem_free( pMsgBuf ); |
Leela Venkata Kiran Kumar Reddy Chirala | d6c0fe2 | 2013-12-11 19:10:50 -0800 | [diff] [blame] | 4496 | pMsgBuf = NULL; |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4497 | limLog(pMac, LOGP, "Unable to forward request"); |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 4498 | return; |
| 4499 | } |
| 4500 | |
| 4501 | return; |
| 4502 | } |
| 4503 | #endif |
| 4504 | |
| 4505 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4506 | static void |
| 4507 | __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 4508 | { |
| 4509 | tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq; |
| 4510 | tpPESession psessionEntry; |
| 4511 | tANI_U8 sessionId; //PE sessionID |
| 4512 | |
| 4513 | PELOG1(limLog(pMac, LOG1, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4514 | FL("received UPDATE_APWPSIEs_REQ message"));); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4515 | |
| 4516 | if(pMsgBuf == NULL) |
| 4517 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4518 | limLog(pMac, LOGE,FL("Buffer is Pointing to NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4519 | return; |
| 4520 | } |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 4521 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 4522 | pUpdateAPWPSIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq)); |
| 4523 | if ( NULL == pUpdateAPWPSIEsReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4524 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 4525 | limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPSIEsReq")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4526 | return; |
| 4527 | } |
| 4528 | |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 4529 | if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4530 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4531 | limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4532 | goto end; |
| 4533 | } |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 4534 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4535 | if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL) |
| 4536 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4537 | limLog(pMac, LOGW, FL("Session does not exist for given BSSID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4538 | goto end; |
| 4539 | } |
| 4540 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 4541 | vos_mem_copy( &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs)); |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 4542 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4543 | schSetFixedBeaconFields(pMac, psessionEntry); |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 4544 | limSendBeaconInd(pMac, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4545 | |
| 4546 | end: |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 4547 | vos_mem_free( pUpdateAPWPSIEsReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4548 | return; |
| 4549 | } /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/ |
| 4550 | |
| 4551 | static void |
| 4552 | __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 4553 | { |
| 4554 | tpSirUpdateParams pUpdateParams; |
| 4555 | tpPESession psessionEntry; |
| 4556 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 4557 | limLog(pMac, LOG1, |
| 4558 | FL("received SME_HIDE_SSID message")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4559 | |
| 4560 | if(pMsgBuf == NULL) |
| 4561 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4562 | limLog(pMac, LOGE,FL("Buffer is Pointing to NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4563 | return; |
| 4564 | } |
| 4565 | |
| 4566 | pUpdateParams = (tpSirUpdateParams)pMsgBuf; |
| 4567 | |
| 4568 | if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL) |
| 4569 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4570 | limLog(pMac, LOGW, "Session does not exist for given sessionId %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4571 | pUpdateParams->sessionId); |
| 4572 | return; |
| 4573 | } |
| 4574 | |
| 4575 | /* Update the session entry */ |
| 4576 | psessionEntry->ssidHidden = pUpdateParams->ssidHidden; |
| 4577 | |
| 4578 | /* Update beacon */ |
| 4579 | schSetFixedBeaconFields(pMac, psessionEntry); |
| 4580 | limSendBeaconInd(pMac, psessionEntry); |
| 4581 | |
| 4582 | return; |
| 4583 | } /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/ |
| 4584 | |
| 4585 | static void |
| 4586 | __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 4587 | { |
| 4588 | tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq; |
| 4589 | tpPESession psessionEntry; |
| 4590 | tANI_U8 sessionId; //PE sessionID |
| 4591 | |
| 4592 | if(pMsgBuf == NULL) |
| 4593 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4594 | limLog(pMac, LOGE,FL("Buffer is Pointing to NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4595 | return; |
| 4596 | } |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 4597 | |
| 4598 | pUpdateAPWPARSNIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq)); |
| 4599 | if ( NULL == pUpdateAPWPARSNIEsReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4600 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 4601 | limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPARSNIEsReq")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4602 | return; |
| 4603 | } |
| 4604 | |
| 4605 | if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE)) |
| 4606 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4607 | limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4608 | goto end; |
| 4609 | } |
| 4610 | |
| 4611 | if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL) |
| 4612 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4613 | limLog(pMac, LOGW, FL("Session does not exist for given BSSID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4614 | goto end; |
| 4615 | } |
| 4616 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 4617 | vos_mem_copy(&psessionEntry->pLimStartBssReq->rsnIE, |
| 4618 | &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4619 | |
| 4620 | limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry); |
| 4621 | |
| 4622 | psessionEntry->pLimStartBssReq->privacy = 1; |
| 4623 | psessionEntry->privacy = 1; |
| 4624 | |
| 4625 | schSetFixedBeaconFields(pMac, psessionEntry); |
| 4626 | limSendBeaconInd(pMac, psessionEntry); |
| 4627 | |
| 4628 | end: |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 4629 | vos_mem_free(pUpdateAPWPARSNIEsReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4630 | return; |
| 4631 | } /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/ |
| 4632 | |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 4633 | /* |
| 4634 | Update the beacon Interval dynamically if beaconInterval is different in MCC |
| 4635 | */ |
| 4636 | static void |
| 4637 | __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 4638 | { |
| 4639 | tpSirChangeBIParams pChangeBIParams; |
| 4640 | tpPESession psessionEntry; |
| 4641 | tANI_U8 sessionId = 0; |
| 4642 | tUpdateBeaconParams beaconParams; |
| 4643 | |
| 4644 | PELOG1(limLog(pMac, LOG1, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4645 | FL("received Update Beacon Interval message"));); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 4646 | |
| 4647 | if(pMsgBuf == NULL) |
| 4648 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4649 | limLog(pMac, LOGE,FL("Buffer is Pointing to NULL")); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 4650 | return; |
| 4651 | } |
| 4652 | |
Kaushik, Sushant | fb15673 | 2014-01-07 15:36:03 +0530 | [diff] [blame] | 4653 | vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams)); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 4654 | pChangeBIParams = (tpSirChangeBIParams)pMsgBuf; |
| 4655 | |
| 4656 | if((psessionEntry = peFindSessionByBssid(pMac, pChangeBIParams->bssId, &sessionId)) == NULL) |
| 4657 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4658 | limLog(pMac, LOGE, FL("Session does not exist for given BSSID")); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 4659 | return; |
| 4660 | } |
| 4661 | |
| 4662 | /*Update sessionEntry Beacon Interval*/ |
| 4663 | if(psessionEntry->beaconParams.beaconInterval != |
| 4664 | pChangeBIParams->beaconInterval ) |
| 4665 | { |
| 4666 | psessionEntry->beaconParams.beaconInterval = pChangeBIParams->beaconInterval; |
| 4667 | } |
| 4668 | |
| 4669 | /*Update sch beaconInterval*/ |
| 4670 | if(pMac->sch.schObject.gSchBeaconInterval != |
| 4671 | pChangeBIParams->beaconInterval ) |
| 4672 | { |
| 4673 | pMac->sch.schObject.gSchBeaconInterval = pChangeBIParams->beaconInterval; |
| 4674 | |
| 4675 | PELOG1(limLog(pMac, LOG1, |
| 4676 | FL("LIM send update BeaconInterval Indication : %d"),pChangeBIParams->beaconInterval);); |
| 4677 | |
| 4678 | /* Update beacon */ |
| 4679 | schSetFixedBeaconFields(pMac, psessionEntry); |
| 4680 | |
Sunil Ravi | b96f7b5 | 2013-05-22 21:40:05 -0700 | [diff] [blame] | 4681 | beaconParams.bssIdx = psessionEntry->bssIdx; |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 4682 | //Set change in beacon Interval |
| 4683 | beaconParams.beaconInterval = pChangeBIParams->beaconInterval; |
Jeff Johnson | 312557b | 2013-04-03 16:27:48 -0700 | [diff] [blame] | 4684 | beaconParams.paramChangeBitmap = PARAM_BCN_INTERVAL_CHANGED; |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 4685 | limSendBeaconParams(pMac, &beaconParams, psessionEntry); |
| 4686 | } |
| 4687 | |
| 4688 | return; |
| 4689 | } /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/ |
| 4690 | |
Hardik Kantilal Patel | 62a3a76 | 2014-11-21 12:55:57 +0530 | [diff] [blame] | 4691 | /** ------------------------------------------------------------- |
| 4692 | \fn |
| 4693 | \brief handles indication message from HDD to update HT mode |
| 4694 | \param tpAniSirGlobal pMac |
| 4695 | \param tANI_U32 pMsgBuf |
| 4696 | \return None |
| 4697 | -------------------------------------------------------------*/ |
| 4698 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 4699 | static void __limProcessSmeSetHT2040Mode(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 4700 | { |
| 4701 | tpSirSetHT2040Mode pSetHT2040Mode; |
| 4702 | tpPESession psessionEntry; |
| 4703 | tANI_U8 sessionId = 0; |
| 4704 | tUpdateVHTOpMode *pHtOpMode = NULL; |
| 4705 | vos_msg_t msg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4706 | |
Hardik Kantilal Patel | 62a3a76 | 2014-11-21 12:55:57 +0530 | [diff] [blame] | 4707 | PELOG1(limLog(pMac, LOGRW, |
| 4708 | FL("received Set HT 20/40 mode message"));); |
| 4709 | |
| 4710 | if(pMsgBuf == NULL) |
| 4711 | { |
| 4712 | limLog(pMac, LOGE,FL("Buffer is Pointing to NULL")); |
| 4713 | return; |
| 4714 | } |
| 4715 | |
| 4716 | pSetHT2040Mode = (tpSirSetHT2040Mode)pMsgBuf; |
| 4717 | |
| 4718 | if((psessionEntry = peFindSessionByBssid(pMac, pSetHT2040Mode->bssId, |
| 4719 | &sessionId)) == NULL) |
| 4720 | { |
| 4721 | limLog(pMac, LOGE, FL("Session does not exist for given BSSID ")); |
| 4722 | limPrintMacAddr(pMac, pSetHT2040Mode->bssId, LOGE); |
| 4723 | return; |
| 4724 | } |
| 4725 | |
| 4726 | limLog(pMac, LOGW, FL("Update session entry for cbMod=%d"), |
| 4727 | pSetHT2040Mode->cbMode); |
| 4728 | |
| 4729 | /*Update sessionEntry HT related fields*/ |
| 4730 | switch(pSetHT2040Mode->cbMode) |
| 4731 | { |
| 4732 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 4733 | psessionEntry->htSecondaryChannelOffset = PHY_SINGLE_CHANNEL_CENTERED; |
| 4734 | psessionEntry->htRecommendedTxWidthSet = 0; |
| 4735 | break; |
| 4736 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 4737 | psessionEntry->htSecondaryChannelOffset = |
| 4738 | PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 4739 | psessionEntry->htRecommendedTxWidthSet = 1; |
| 4740 | break; |
| 4741 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 4742 | psessionEntry->htSecondaryChannelOffset = |
| 4743 | PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 4744 | psessionEntry->htRecommendedTxWidthSet = 1; |
| 4745 | break; |
| 4746 | default: |
| 4747 | limLog(pMac, LOGE,FL("Invalid cbMode")); |
| 4748 | return; |
| 4749 | } |
| 4750 | |
| 4751 | limLog(pMac, LOGW, FL("Channel Bonding mode : %d" |
| 4752 | " htSecondaryChannelOffset: %d" |
| 4753 | " htRecommendedTxWidthSet :%d"), |
| 4754 | pSetHT2040Mode->cbMode, |
| 4755 | psessionEntry->htSecondaryChannelOffset, |
| 4756 | psessionEntry->htRecommendedTxWidthSet); |
| 4757 | |
| 4758 | limLog(pMac, LOGW, FL("Update Beacon IEs")); |
| 4759 | |
| 4760 | /* Update beacon */ |
| 4761 | schSetFixedBeaconFields(pMac, psessionEntry); |
| 4762 | limSendBeaconInd(pMac, psessionEntry); |
| 4763 | |
| 4764 | /* Update OP Mode */ |
| 4765 | pHtOpMode = vos_mem_malloc(sizeof(tUpdateVHTOpMode)); |
| 4766 | if ( NULL == pHtOpMode ) |
| 4767 | { |
| 4768 | limLog(pMac, LOGE, |
| 4769 | FL("Not able to allocate memory for setting OP mode")); |
| 4770 | return; |
| 4771 | } |
| 4772 | |
| 4773 | pHtOpMode->opMode = (psessionEntry->htSecondaryChannelOffset == |
| 4774 | PHY_SINGLE_CHANNEL_CENTERED)? |
| 4775 | eHT_CHANNEL_WIDTH_20MHZ:eHT_CHANNEL_WIDTH_40MHZ; |
| 4776 | |
| 4777 | /* Pass Self STA ID to FW. Based on Self STA ID FW will update the |
| 4778 | * operating mode for all connected STA. |
| 4779 | */ |
| 4780 | |
| 4781 | pHtOpMode->staId = psessionEntry->staId; |
| 4782 | |
| 4783 | msg.type = WDA_UPDATE_OP_MODE; |
| 4784 | msg.reserved = 0; |
| 4785 | msg.bodyptr = pHtOpMode; |
| 4786 | |
| 4787 | if (!VOS_IS_STATUS_SUCCESS( |
| 4788 | vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))) |
| 4789 | { |
| 4790 | limLog(pMac, LOGE, |
| 4791 | FL("Not able to post WDA_UPDATE_OP_MODE message to WDA")); |
| 4792 | vos_mem_free(pHtOpMode); |
| 4793 | return; |
| 4794 | } |
| 4795 | |
| 4796 | limLog(pMac, LOGW, |
| 4797 | FL("Notifed FW about OP mode: %d for staId=%d"), |
| 4798 | pHtOpMode->opMode, pHtOpMode->staId); |
| 4799 | |
| 4800 | return; |
| 4801 | } |
| 4802 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4803 | |
| 4804 | /** ------------------------------------------------------------- |
| 4805 | \fn limProcessSmeDelBaPeerInd |
| 4806 | \brief handles indication message from HDD to send delete BA request |
| 4807 | \param tpAniSirGlobal pMac |
| 4808 | \param tANI_U32 pMsgBuf |
| 4809 | \return None |
| 4810 | -------------------------------------------------------------*/ |
| 4811 | void |
| 4812 | limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 4813 | { |
| 4814 | tANI_U16 assocId =0; |
| 4815 | tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf; |
| 4816 | tpDphHashNode pSta; |
| 4817 | tpPESession psessionEntry; |
| 4818 | tANI_U8 sessionId; |
| 4819 | |
| 4820 | |
| 4821 | |
| 4822 | if(NULL == pSmeDelBAPeerInd) |
| 4823 | return; |
| 4824 | |
| 4825 | if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL) |
| 4826 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4827 | limLog(pMac, LOGE,FL("session does not exist for given bssId")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4828 | return; |
| 4829 | } |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4830 | limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4831 | pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection); |
| 4832 | |
| 4833 | pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable); |
| 4834 | if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac, |
| 4835 | pSta, |
| 4836 | pSmeDelBAPeerInd->baDirection, |
| 4837 | pSmeDelBAPeerInd->baTID, |
| 4838 | eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry)) |
| 4839 | { |
| 4840 | limLog( pMac, LOGW, |
| 4841 | FL( "Failed to post LIM_MLM_DELBA_REQ to " )); |
| 4842 | if (pSta) |
| 4843 | limPrintMacAddr(pMac, pSta->staAddr, LOGW); |
| 4844 | } |
| 4845 | } |
| 4846 | |
| 4847 | // -------------------------------------------------------------------- |
| 4848 | /** |
| 4849 | * __limProcessReportMessage |
| 4850 | * |
| 4851 | * FUNCTION: Processes the next received Radio Resource Management message |
| 4852 | * |
| 4853 | * LOGIC: |
| 4854 | * |
| 4855 | * ASSUMPTIONS: |
| 4856 | * |
| 4857 | * NOTE: |
| 4858 | * |
| 4859 | * @param None |
| 4860 | * @return None |
| 4861 | */ |
| 4862 | |
| 4863 | void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg) |
| 4864 | { |
| 4865 | #ifdef WLAN_FEATURE_VOWIFI |
| 4866 | switch (pMsg->type) |
| 4867 | { |
| 4868 | case eWNI_SME_NEIGHBOR_REPORT_REQ_IND: |
| 4869 | rrmProcessNeighborReportReq( pMac, pMsg->bodyptr ); |
| 4870 | break; |
| 4871 | case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND: |
| 4872 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4873 | #if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4874 | tpSirBeaconReportXmitInd pBcnReport=NULL; |
| 4875 | tpPESession psessionEntry=NULL; |
| 4876 | tANI_U8 sessionId; |
| 4877 | |
| 4878 | if(pMsg->bodyptr == NULL) |
| 4879 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4880 | limLog(pMac, LOGE,FL("Buffer is Pointing to NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4881 | return; |
| 4882 | } |
| 4883 | pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr; |
| 4884 | if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL) |
| 4885 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4886 | limLog(pMac, LOGE, "Session Does not exist for given bssId"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4887 | return; |
| 4888 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4889 | if (psessionEntry->isESEconnection) |
| 4890 | eseProcessBeaconReportXmit( pMac, pMsg->bodyptr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4891 | else |
| 4892 | #endif |
| 4893 | rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr ); |
| 4894 | } |
| 4895 | break; |
| 4896 | } |
| 4897 | #endif |
| 4898 | } |
| 4899 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4900 | #if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_VOWIFI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4901 | // -------------------------------------------------------------------- |
| 4902 | /** |
| 4903 | * limSendSetMaxTxPowerReq |
| 4904 | * |
| 4905 | * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power. |
| 4906 | * |
| 4907 | * LOGIC: |
| 4908 | * |
| 4909 | * ASSUMPTIONS: |
| 4910 | * |
| 4911 | * NOTE: |
| 4912 | * |
| 4913 | * @param txPower txPower to be set. |
| 4914 | * @param pSessionEntry session entry. |
| 4915 | * @return None |
| 4916 | */ |
| 4917 | tSirRetStatus |
| 4918 | limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry ) |
| 4919 | { |
| 4920 | tpMaxTxPowerParams pMaxTxParams = NULL; |
| 4921 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 4922 | tSirMsgQ msgQ; |
| 4923 | |
| 4924 | if( pSessionEntry == NULL ) |
| 4925 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4926 | PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters", __func__, __LINE__ );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4927 | return eSIR_FAILURE; |
| 4928 | } |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 4929 | |
| 4930 | pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams)); |
| 4931 | if ( NULL == pMaxTxParams ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4932 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4933 | limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams ", __func__, __LINE__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4934 | return eSIR_MEM_ALLOC_FAILED; |
| 4935 | |
| 4936 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4937 | #if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_ESE) |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 4938 | limLog( pMac, LOG1, |
| 4939 | FL(" Allocated memory for pMaxTxParams, which will be freed in other module")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4940 | #endif |
Kiran Kumar Lokere | a4db3dc | 2013-03-25 18:05:24 -0700 | [diff] [blame] | 4941 | if( pMaxTxParams == NULL ) |
| 4942 | { |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 4943 | limLog( pMac, LOGE, FL("pMaxTxParams is NULL")); |
Kiran Kumar Lokere | a4db3dc | 2013-03-25 18:05:24 -0700 | [diff] [blame] | 4944 | return eSIR_FAILURE; |
| 4945 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4946 | pMaxTxParams->power = txPower; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 4947 | vos_mem_copy( pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) ); |
| 4948 | vos_mem_copy( pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4949 | |
Jeff Johnson | 68ce9c4 | 2013-04-08 10:33:28 -0700 | [diff] [blame] | 4950 | msgQ.type = WDA_SET_MAX_TX_POWER_REQ; |
| 4951 | msgQ.bodyptr = pMaxTxParams; |
| 4952 | msgQ.bodyval = 0; |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 4953 | limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA")); |
Jeff Johnson | 68ce9c4 | 2013-04-08 10:33:28 -0700 | [diff] [blame] | 4954 | MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type)); |
| 4955 | retCode = wdaPostCtrlMsg(pMac, &msgQ); |
| 4956 | if (eSIR_SUCCESS != retCode) |
| 4957 | { |
| 4958 | PELOGE(limLog(pMac, LOGE, FL("wdaPostCtrlMsg() failed"));) |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 4959 | vos_mem_free(pMaxTxParams); |
Jeff Johnson | 68ce9c4 | 2013-04-08 10:33:28 -0700 | [diff] [blame] | 4960 | } |
| 4961 | return retCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4962 | } |
| 4963 | #endif |
| 4964 | |
| 4965 | /** |
| 4966 | * __limProcessSmeAddStaSelfReq() |
| 4967 | * |
| 4968 | *FUNCTION: |
| 4969 | * This function is called to process SME_ADD_STA_SELF_REQ message |
| 4970 | * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL. |
| 4971 | * |
| 4972 | *LOGIC: |
| 4973 | * |
| 4974 | *ASSUMPTIONS: |
| 4975 | * |
| 4976 | *NOTE: |
| 4977 | * |
| 4978 | * @param pMac Pointer to Global MAC structure |
| 4979 | * @param *pMsgBuf A pointer to the SME message buffer |
| 4980 | * @return None |
| 4981 | */ |
| 4982 | |
| 4983 | static void |
| 4984 | __limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 4985 | { |
| 4986 | tSirMsgQ msg; |
| 4987 | tpAddStaSelfParams pAddStaSelfParams; |
| 4988 | tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf; |
| 4989 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 4990 | pAddStaSelfParams = vos_mem_malloc(sizeof(tAddStaSelfParams)); |
| 4991 | if ( NULL == pAddStaSelfParams ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4992 | { |
| 4993 | limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") ); |
| 4994 | return; |
| 4995 | } |
| 4996 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 4997 | vos_mem_copy( pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) ); |
Kiran Kumar Lokere | ad7dbc8 | 2013-10-07 20:12:50 -0700 | [diff] [blame] | 4998 | pAddStaSelfParams->currDeviceMode = pSmeReq->currDeviceMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4999 | msg.type = SIR_HAL_ADD_STA_SELF_REQ; |
| 5000 | msg.reserved = 0; |
| 5001 | msg.bodyptr = pAddStaSelfParams; |
| 5002 | msg.bodyval = 0; |
| 5003 | |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5004 | PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5005 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5006 | |
| 5007 | if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg)) |
| 5008 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5009 | limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5010 | } |
| 5011 | return; |
| 5012 | } /*** end __limProcessAddStaSelfReq() ***/ |
| 5013 | |
| 5014 | |
| 5015 | /** |
| 5016 | * __limProcessSmeDelStaSelfReq() |
| 5017 | * |
| 5018 | *FUNCTION: |
| 5019 | * This function is called to process SME_DEL_STA_SELF_REQ message |
| 5020 | * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL. |
| 5021 | * |
| 5022 | *LOGIC: |
| 5023 | * |
| 5024 | *ASSUMPTIONS: |
| 5025 | * |
| 5026 | *NOTE: |
| 5027 | * |
| 5028 | * @param pMac Pointer to Global MAC structure |
| 5029 | * @param *pMsgBuf A pointer to the SME message buffer |
| 5030 | * @return None |
| 5031 | */ |
| 5032 | |
| 5033 | static void |
| 5034 | __limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 5035 | { |
| 5036 | tSirMsgQ msg; |
| 5037 | tpDelStaSelfParams pDelStaSelfParams; |
| 5038 | tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf; |
| 5039 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 5040 | pDelStaSelfParams = vos_mem_malloc(sizeof( tDelStaSelfParams)); |
| 5041 | if ( NULL == pDelStaSelfParams ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5042 | { |
| 5043 | limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") ); |
| 5044 | return; |
| 5045 | } |
| 5046 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 5047 | vos_mem_copy( pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5048 | |
| 5049 | msg.type = SIR_HAL_DEL_STA_SELF_REQ; |
| 5050 | msg.reserved = 0; |
| 5051 | msg.bodyptr = pDelStaSelfParams; |
| 5052 | msg.bodyval = 0; |
| 5053 | |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5054 | PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5055 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5056 | |
| 5057 | if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg)) |
| 5058 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5059 | limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5060 | } |
| 5061 | return; |
| 5062 | } /*** end __limProcessSmeDelStaSelfReq() ***/ |
| 5063 | |
| 5064 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5065 | /** |
| 5066 | * __limProcessSmeRegisterMgmtFrameReq() |
| 5067 | * |
| 5068 | *FUNCTION: |
| 5069 | * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message |
| 5070 | * from SME. It Register this information within PE. |
| 5071 | * |
| 5072 | *LOGIC: |
| 5073 | * |
| 5074 | *ASSUMPTIONS: |
| 5075 | * |
| 5076 | *NOTE: |
| 5077 | * |
| 5078 | * @param pMac Pointer to Global MAC structure |
| 5079 | * @param *pMsgBuf A pointer to the SME message buffer |
| 5080 | * @return None |
| 5081 | */ |
| 5082 | static void |
| 5083 | __limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 5084 | { |
| 5085 | VOS_STATUS vosStatus; |
| 5086 | tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf; |
| 5087 | tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL; |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 5088 | tANI_BOOLEAN match = VOS_FALSE; |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 5089 | limLog(pMac, LOG1, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5090 | FL("registerFrame %d, frameType %d, matchLen %d"), |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 5091 | pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5092 | |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 5093 | /* First check whether entry exists already*/ |
| 5094 | |
| 5095 | vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue, |
| 5096 | (vos_list_node_t**)&pLimMgmtRegistration); |
| 5097 | |
| 5098 | while(pLimMgmtRegistration != NULL) |
| 5099 | { |
| 5100 | if (pLimMgmtRegistration->frameType == pSmeReq->frameType) |
| 5101 | { |
| 5102 | if(pSmeReq->matchLen) |
| 5103 | { |
| 5104 | if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen) |
| 5105 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 5106 | if (vos_mem_compare( pLimMgmtRegistration->matchData, |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 5107 | pSmeReq->matchData, pLimMgmtRegistration->matchLen)) |
| 5108 | { |
Madan Mohan Koyyalamudi | c537df2 | 2012-10-22 15:07:08 -0700 | [diff] [blame] | 5109 | /* found match! */ |
| 5110 | match = VOS_TRUE; |
| 5111 | break; |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 5112 | } |
| 5113 | } |
| 5114 | } |
| 5115 | else |
| 5116 | { |
Madan Mohan Koyyalamudi | c537df2 | 2012-10-22 15:07:08 -0700 | [diff] [blame] | 5117 | /* found match! */ |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 5118 | match = VOS_TRUE; |
| 5119 | break; |
| 5120 | } |
| 5121 | } |
| 5122 | vosStatus = vos_list_peek_next ( |
| 5123 | &pMac->lim.gLimMgmtFrameRegistratinQueue, |
| 5124 | (vos_list_node_t*) pLimMgmtRegistration, |
| 5125 | (vos_list_node_t**) &pNext ); |
| 5126 | |
| 5127 | pLimMgmtRegistration = pNext; |
| 5128 | pNext = NULL; |
| 5129 | |
| 5130 | } |
| 5131 | |
| 5132 | if (match) |
| 5133 | { |
| 5134 | vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue, |
| 5135 | (vos_list_node_t*)pLimMgmtRegistration); |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 5136 | vos_mem_free(pLimMgmtRegistration); |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 5137 | } |
| 5138 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5139 | if(pSmeReq->registerFrame) |
| 5140 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 5141 | pLimMgmtRegistration = vos_mem_malloc(sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen); |
| 5142 | if ( pLimMgmtRegistration != NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5143 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 5144 | vos_mem_set((void*)pLimMgmtRegistration, |
| 5145 | sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5146 | pLimMgmtRegistration->frameType = pSmeReq->frameType; |
| 5147 | pLimMgmtRegistration->matchLen = pSmeReq->matchLen; |
| 5148 | pLimMgmtRegistration->sessionId = pSmeReq->sessionId; |
| 5149 | if(pSmeReq->matchLen) |
| 5150 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 5151 | vos_mem_copy(pLimMgmtRegistration->matchData, |
| 5152 | pSmeReq->matchData, pSmeReq->matchLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5153 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5154 | vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue, |
| 5155 | &pLimMgmtRegistration->node); |
| 5156 | } |
| 5157 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5158 | |
| 5159 | return; |
| 5160 | } /*** end __limProcessSmeRegisterMgmtFrameReq() ***/ |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 5161 | |
| 5162 | static tANI_BOOLEAN |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5163 | __limInsertSingleShotNOAForScan(tpAniSirGlobal pMac, tANI_U32 noaDuration) |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 5164 | { |
| 5165 | tpP2pPsParams pMsgNoA; |
| 5166 | tSirMsgQ msg; |
Vinay Malekal | 6275736 | 2012-12-17 12:15:51 -0800 | [diff] [blame] | 5167 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 5168 | pMsgNoA = vos_mem_malloc(sizeof( tP2pPsConfig )); |
| 5169 | if ( NULL == pMsgNoA ) |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 5170 | { |
| 5171 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5172 | FL( "Unable to allocate memory during NoA Update" )); |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5173 | goto error; |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 5174 | } |
| 5175 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 5176 | vos_mem_set((tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig), 0); |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 5177 | /* Below params used for opp PS/periodic NOA and are don't care in this case - so initialized to 0 */ |
| 5178 | pMsgNoA->opp_ps = 0; |
| 5179 | pMsgNoA->ctWindow = 0; |
| 5180 | pMsgNoA->duration = 0; |
| 5181 | pMsgNoA->interval = 0; |
| 5182 | pMsgNoA->count = 0; |
Vinay Malekal | 6275736 | 2012-12-17 12:15:51 -0800 | [diff] [blame] | 5183 | |
Vinay Malekal | 6275736 | 2012-12-17 12:15:51 -0800 | [diff] [blame] | 5184 | /* Below params used for Single Shot NOA - so assign proper values */ |
| 5185 | pMsgNoA->psSelection = P2P_SINGLE_NOA; |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5186 | pMsgNoA->single_noa_duration = noaDuration; |
Gopichand Nakkala | 096a105 | 2012-12-21 07:05:34 -0800 | [diff] [blame] | 5187 | |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 5188 | /* Start Insert NOA timer |
| 5189 | * If insert NOA req fails or NOA rsp fails or start NOA indication doesn't come from FW due to GO session deletion |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5190 | * or any other failure or reason, we still need to process the deferred SME req. The insert NOA |
| 5191 | * timer of 500 ms will ensure the stored SME req always gets processed |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 5192 | */ |
| 5193 | if (tx_timer_activate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer) |
| 5194 | == TX_TIMER_ERROR) |
| 5195 | { |
| 5196 | /// Could not activate Insert NOA timer. |
| 5197 | // Log error |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5198 | limLog(pMac, LOGP, FL("could not activate Insert Single Shot NOA during scan timer")); |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 5199 | |
| 5200 | // send the scan response back with status failure and do not even call insert NOA |
| 5201 | limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId); |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 5202 | vos_mem_free(pMsgNoA); |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5203 | goto error; |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 5204 | } |
| 5205 | |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5206 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_INSERT_SINGLESHOT_NOA_TIMER)); |
| 5207 | |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 5208 | msg.type = WDA_SET_P2P_GO_NOA_REQ; |
| 5209 | msg.reserved = 0; |
| 5210 | msg.bodyptr = pMsgNoA; |
| 5211 | msg.bodyval = 0; |
| 5212 | |
| 5213 | if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg)) |
| 5214 | { |
| 5215 | /* In this failure case, timer is already started, so its expiration will take care of sending scan response */ |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5216 | limLog(pMac, LOGP, FL("wdaPost Msg failed")); |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5217 | /* Deactivate the NOA timer in failure case */ |
| 5218 | limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER); |
| 5219 | goto error; |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 5220 | } |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5221 | return FALSE; |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 5222 | |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5223 | error: |
| 5224 | /* In any of the failure cases, just go ahead with the processing of registered deferred SME request without |
| 5225 | * worrying about the NOA |
| 5226 | */ |
| 5227 | limProcessRegdDefdSmeReqAfterNOAStart(pMac); |
| 5228 | // msg buffer is consumed and freed in above function so return FALSE |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 5229 | return FALSE; |
| 5230 | |
| 5231 | } |
| 5232 | |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5233 | static void __limRegisterDeferredSmeReqForNOAStart(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf) |
| 5234 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5235 | limLog(pMac, LOG1, FL("Reg msgType %d"), msgType) ; |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5236 | pMac->lim.gDeferMsgTypeForNOA = msgType; |
| 5237 | pMac->lim.gpDefdSmeMsgForNOA = pMsgBuf; |
| 5238 | } |
| 5239 | |
| 5240 | static void __limDeregisterDeferredSmeReqAfterNOAStart(tpAniSirGlobal pMac) |
| 5241 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5242 | limLog(pMac, LOG1, FL("Dereg msgType %d"), pMac->lim.gDeferMsgTypeForNOA) ; |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5243 | pMac->lim.gDeferMsgTypeForNOA = 0; |
| 5244 | if (pMac->lim.gpDefdSmeMsgForNOA != NULL) |
| 5245 | { |
| 5246 | /* __limProcessSmeScanReq consumed the buffer. We can free it. */ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 5247 | vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA); |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5248 | pMac->lim.gpDefdSmeMsgForNOA = NULL; |
| 5249 | } |
| 5250 | } |
| 5251 | |
| 5252 | static |
Ganesh Kondabattini | 1693007 | 2014-08-22 16:02:34 +0530 | [diff] [blame] | 5253 | tANI_U32 limCalculateNOADuration(tpAniSirGlobal pMac, tANI_U16 msgType, |
| 5254 | tANI_U32 *pMsgBuf, tANI_BOOLEAN isPassiveScan) |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5255 | { |
| 5256 | tANI_U32 noaDuration = 0; |
| 5257 | |
| 5258 | switch (msgType) |
| 5259 | { |
| 5260 | case eWNI_SME_SCAN_REQ: |
| 5261 | { |
| 5262 | tANI_U32 val; |
| 5263 | tANI_U8 i; |
| 5264 | tpSirSmeScanReq pScanReq = (tpSirSmeScanReq) pMsgBuf; |
| 5265 | if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS) |
| 5266 | { |
| 5267 | /* |
| 5268 | * Could not get max channel value |
| 5269 | * from CFG. Log error. |
| 5270 | */ |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5271 | limLog(pMac, LOGP, FL("could not retrieve passive max channel value")); |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5272 | |
| 5273 | /* use a default value of 110ms */ |
| 5274 | val = DEFAULT_PASSIVE_MAX_CHANNEL_TIME; |
| 5275 | } |
| 5276 | |
| 5277 | for (i = 0; i < pScanReq->channelList.numChannels; i++) { |
| 5278 | tANI_U8 channelNum = pScanReq->channelList.channelNumber[i]; |
| 5279 | |
Ganesh Kondabattini | 8f6e3b3 | 2014-08-25 16:07:54 +0530 | [diff] [blame] | 5280 | if (pMac->miracast_mode) { |
| 5281 | noaDuration += DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST + |
| 5282 | DEFAULT_MAX_CHAN_TIME_DURING_MIRACAST; |
| 5283 | } else if (isPassiveScan || !limActiveScanAllowed(pMac, channelNum)) { |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5284 | /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in |
| 5285 | * void limContinuePostChannelScan(tpAniSirGlobal pMac) |
| 5286 | */ |
| 5287 | noaDuration += val; |
Ganesh Kondabattini | 1693007 | 2014-08-22 16:02:34 +0530 | [diff] [blame] | 5288 | } else { |
| 5289 | /* Use min + max channel time to calculate the total duration of scan */ |
| 5290 | noaDuration += pScanReq->minChannelTime + pScanReq->maxChannelTime; |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5291 | } |
| 5292 | } |
| 5293 | |
| 5294 | /* Adding an overhead of 20ms to account for the scan messaging delays */ |
| 5295 | noaDuration += SCAN_MESSAGING_OVERHEAD; |
| 5296 | noaDuration *= CONV_MS_TO_US; |
| 5297 | |
| 5298 | break; |
| 5299 | } |
| 5300 | |
| 5301 | case eWNI_SME_OEM_DATA_REQ: |
| 5302 | noaDuration = OEM_DATA_NOA_DURATION*CONV_MS_TO_US; // use 60 msec as default |
| 5303 | break; |
| 5304 | |
| 5305 | case eWNI_SME_REMAIN_ON_CHANNEL_REQ: |
| 5306 | { |
| 5307 | tSirRemainOnChnReq *pRemainOnChnReq = (tSirRemainOnChnReq *) pMsgBuf; |
| 5308 | noaDuration = (pRemainOnChnReq->duration)*CONV_MS_TO_US; |
| 5309 | break; |
| 5310 | } |
| 5311 | |
| 5312 | case eWNI_SME_JOIN_REQ: |
| 5313 | noaDuration = JOIN_NOA_DURATION*CONV_MS_TO_US; |
| 5314 | break; |
| 5315 | |
| 5316 | default: |
| 5317 | noaDuration = 0; |
| 5318 | break; |
| 5319 | |
| 5320 | } |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5321 | limLog(pMac, LOGW, FL("msgType %d noa %d"), msgType, noaDuration); |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5322 | return noaDuration; |
| 5323 | } |
| 5324 | |
| 5325 | void limProcessRegdDefdSmeReqAfterNOAStart(tpAniSirGlobal pMac) |
| 5326 | { |
Gopichand Nakkala | 7c4c3b9 | 2013-03-25 18:08:31 +0530 | [diff] [blame] | 5327 | tANI_BOOLEAN bufConsumed = TRUE; |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5328 | |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5329 | limLog(pMac, LOG1, FL("Process defd sme req %d"), pMac->lim.gDeferMsgTypeForNOA); |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5330 | if ( (pMac->lim.gDeferMsgTypeForNOA != 0) && |
| 5331 | (pMac->lim.gpDefdSmeMsgForNOA != NULL) ) |
| 5332 | { |
| 5333 | switch (pMac->lim.gDeferMsgTypeForNOA) |
| 5334 | { |
| 5335 | case eWNI_SME_SCAN_REQ: |
| 5336 | __limProcessSmeScanReq(pMac, pMac->lim.gpDefdSmeMsgForNOA); |
| 5337 | break; |
| 5338 | case eWNI_SME_OEM_DATA_REQ: |
| 5339 | __limProcessSmeOemDataReq(pMac, pMac->lim.gpDefdSmeMsgForNOA); |
| 5340 | break; |
| 5341 | case eWNI_SME_REMAIN_ON_CHANNEL_REQ: |
Gopichand Nakkala | 7c4c3b9 | 2013-03-25 18:08:31 +0530 | [diff] [blame] | 5342 | bufConsumed = limProcessRemainOnChnlReq(pMac, pMac->lim.gpDefdSmeMsgForNOA); |
| 5343 | /* limProcessRemainOnChnlReq doesnt want us to free the buffer since |
| 5344 | * it is freed in limRemainOnChnRsp. this change is to avoid "double free" |
| 5345 | */ |
| 5346 | if (FALSE == bufConsumed) |
| 5347 | { |
| 5348 | pMac->lim.gpDefdSmeMsgForNOA = NULL; |
| 5349 | } |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5350 | break; |
| 5351 | case eWNI_SME_JOIN_REQ: |
| 5352 | __limProcessSmeJoinReq(pMac, pMac->lim.gpDefdSmeMsgForNOA); |
| 5353 | break; |
| 5354 | default: |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5355 | limLog(pMac, LOGE, FL("Unknown deferred msg type %d"), pMac->lim.gDeferMsgTypeForNOA); |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5356 | break; |
| 5357 | } |
| 5358 | __limDeregisterDeferredSmeReqAfterNOAStart(pMac); |
| 5359 | } |
| 5360 | else |
| 5361 | { |
| 5362 | limLog( pMac, LOGW, FL("start received from FW when no sme deferred msg pending. Do nothing." |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5363 | "It might happen sometime when NOA start ind and timeout happen at the same time")); |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5364 | } |
| 5365 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5366 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5367 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 5368 | /* |
| 5369 | * Process Discovery request recieved from SME and transmit to AP. |
| 5370 | */ |
| 5371 | static tSirRetStatus limProcessSmeDisStartReq(tpAniSirGlobal pMac, |
| 5372 | tANI_U32 *pMsgBuf) |
| 5373 | { |
| 5374 | /* get all discovery request parameters */ |
| 5375 | tSirTdlsDisReq *disReq = (tSirTdlsDisReq *) pMsgBuf ; |
| 5376 | tpPESession psessionEntry; |
| 5377 | tANI_U8 sessionId; |
| 5378 | |
| 5379 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5380 | ("Discovery Req Recieved")) ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5381 | |
| 5382 | if((psessionEntry = peFindSessionByBssid(pMac, disReq->bssid, &sessionId)) |
| 5383 | == NULL) |
| 5384 | { |
| 5385 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5386 | "PE Session does not exist for given sme sessionId %d", |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5387 | disReq->sessionId); |
| 5388 | goto lim_tdls_dis_start_error; |
| 5389 | } |
| 5390 | |
| 5391 | /* check if we are in proper state to work as TDLS client */ |
| 5392 | if (psessionEntry->limSystemRole != eLIM_STA_ROLE) |
| 5393 | { |
| 5394 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5395 | "dis req received in wrong system Role %d", |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5396 | psessionEntry->limSystemRole); |
| 5397 | goto lim_tdls_dis_start_error; |
| 5398 | } |
| 5399 | |
| 5400 | /* |
| 5401 | * if we are still good, go ahead and check if we are in proper state to |
| 5402 | * do TDLS discovery procedure. |
| 5403 | */ |
| 5404 | if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) && |
| 5405 | (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)) |
| 5406 | { |
| 5407 | |
| 5408 | limLog(pMac, LOGE, "dis req received in invalid LIMsme \ |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5409 | state (%d)", psessionEntry->limSmeState); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5410 | goto lim_tdls_dis_start_error; |
| 5411 | } |
| 5412 | |
| 5413 | /* |
| 5414 | * if we are still good, go ahead and transmit TDLS discovery request, |
| 5415 | * and save Dis Req info for future reference. |
| 5416 | */ |
| 5417 | |
| 5418 | #if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet |
| 5419 | /* |
| 5420 | * send message to HAL to set RXP filters to receieve frame on |
| 5421 | * direct link.. |
| 5422 | */ |
| 5423 | //limSetLinkState(pMac, eSIR_LINK_TDLS_DISCOVERY_STATE, |
| 5424 | // psessionEntry->bssId) ; |
| 5425 | #endif |
| 5426 | |
| 5427 | /* save dis request message for matching dialog token */ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 5428 | vos_mem_copy((tANI_U8 *) &pMac->lim.gLimTdlsDisReq, |
| 5429 | (tANI_U8 *) disReq, sizeof(tSirTdlsDisReq)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5430 | |
| 5431 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5432 | "Transmit Discovery Request Frame") ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5433 | /* format TDLS discovery request frame and transmit it */ |
| 5434 | limSendTdlsDisReqFrame(pMac, disReq->peerMac, disReq->dialog, |
| 5435 | psessionEntry) ; |
| 5436 | |
| 5437 | /* prepare for response */ |
| 5438 | pMac->lim.gLimTdlsDisStaCount = 0 ; |
| 5439 | pMac->lim.gLimTdlsDisResultList = NULL ; |
| 5440 | |
| 5441 | /* |
| 5442 | * start TDLS discovery request timer to wait for discovery responses |
| 5443 | * from all TDLS enabled clients in BSS. |
| 5444 | */ |
| 5445 | |
| 5446 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5447 | ("Start Discovery request Timeout Timer")) ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5448 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, |
| 5449 | eLIM_TDLS_DISCOVERY_RSP_WAIT)); |
| 5450 | |
| 5451 | /* assign appropriate sessionId to the timer object */ |
| 5452 | pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId = |
| 5453 | psessionEntry->peSessionId; |
| 5454 | |
| 5455 | if (tx_timer_activate(&pMac->lim.limTimers.gLimTdlsDisRspWaitTimer) |
| 5456 | != TX_SUCCESS) |
| 5457 | { |
| 5458 | limLog(pMac, LOGP, FL("TDLS discovery response timer \ |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5459 | activation failed!")); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5460 | goto lim_tdls_dis_start_error; |
| 5461 | } |
| 5462 | /* |
| 5463 | * when timer expired, eWNI_SME_TDLS_DISCOVERY_START_RSP is sent |
| 5464 | * back to SME |
| 5465 | */ |
| 5466 | return (eSIR_SUCCESS) ; |
| 5467 | lim_tdls_dis_start_error: |
| 5468 | /* in error case, PE has to sent the response SME immediately with error code */ |
| 5469 | limSendSmeTdlsDisRsp(pMac, eSIR_FAILURE, |
| 5470 | eWNI_SME_TDLS_DISCOVERY_START_RSP); |
| 5471 | return eSIR_FAILURE; |
| 5472 | } |
| 5473 | /* |
| 5474 | * Process link start request recieved from SME and transmit to AP. |
| 5475 | */ |
| 5476 | eHalStatus limProcessSmeLinkStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 5477 | { |
| 5478 | /* get all discovery request parameters */ |
| 5479 | tSirTdlsSetupReq *setupReq = (tSirTdlsSetupReq *) pMsgBuf ; |
| 5480 | tLimTdlsLinkSetupInfo *linkSetupInfo; |
| 5481 | //tLimTdlsLinkSetupPeer *setupPeer; |
| 5482 | tpPESession psessionEntry; |
| 5483 | tANI_U8 sessionId; |
| 5484 | eHalStatus status; |
| 5485 | |
| 5486 | if((psessionEntry = peFindSessionByBssid(pMac, |
| 5487 | setupReq->bssid, &sessionId)) == NULL) |
| 5488 | { |
| 5489 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5490 | "PE Session does not exist for given sme sessionId %d", |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5491 | setupReq->sessionId); |
| 5492 | goto lim_tdls_link_start_error; |
| 5493 | } |
| 5494 | |
| 5495 | /* check if we are in proper state to work as TDLS client */ |
| 5496 | if (psessionEntry->limSystemRole != eLIM_STA_ROLE) |
| 5497 | { |
| 5498 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5499 | "TDLS link setup req received in wrong system Role %d", |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5500 | psessionEntry->limSystemRole); |
| 5501 | goto lim_tdls_link_start_error; |
| 5502 | } |
| 5503 | |
| 5504 | /* |
| 5505 | * if we are still good, go ahead and check if we are in proper state to |
| 5506 | * do TDLS setup procedure. |
| 5507 | */ |
| 5508 | if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) && |
| 5509 | (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)) |
| 5510 | { |
| 5511 | limLog(pMac, LOGE, "Setup request in invalid LIMsme \ |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5512 | state (%d)", pMac->lim.gLimSmeState); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5513 | goto lim_tdls_link_start_error; |
| 5514 | } |
| 5515 | |
| 5516 | /* |
| 5517 | * Now, go ahead and transmit TDLS discovery request, and save setup Req |
| 5518 | * info for future reference. |
| 5519 | */ |
| 5520 | /* create node for Link setup */ |
| 5521 | linkSetupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ; |
| 5522 | //setupPeer = NULL ; |
| 5523 | |
| 5524 | status = limTdlsPrepareSetupReqFrame(pMac, linkSetupInfo, setupReq->dialog, |
| 5525 | setupReq->peerMac, psessionEntry) ; |
| 5526 | if(eHAL_STATUS_SUCCESS == status) |
| 5527 | /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when |
| 5528 | TDLS setup cnf TX complete is successful. */ |
| 5529 | return eSIR_SUCCESS; |
| 5530 | #if 0 |
| 5531 | |
| 5532 | /* |
| 5533 | * we allocate the TDLS setup Peer Memory here, we will free'd this |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 5534 | * memory after teardown, if the link is successfully setup or |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5535 | * free this memory if any timeout is happen in link setup procedure |
| 5536 | */ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 5537 | setupPeer = vos_mem_malloc(sizeof( tLimTdlsLinkSetupPeer )); |
| 5538 | if ( NULL == setupPeer ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5539 | { |
| 5540 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5541 | FL( "Unable to allocate memory during ADD_STA" )); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5542 | VOS_ASSERT(0) ; |
| 5543 | return eSIR_MEM_ALLOC_FAILED; |
| 5544 | } |
| 5545 | setupPeer->dialog = setupReq->dialog ; |
| 5546 | setupPeer->tdls_prev_link_state = setupPeer->tdls_link_state ; |
| 5547 | setupPeer->tdls_link_state = TDLS_LINK_SETUP_START_STATE ; |
| 5548 | /* TDLS_sessionize: remember sessionId for future */ |
| 5549 | setupPeer->tdls_sessionId = psessionEntry->peSessionId; |
| 5550 | setupPeer->tdls_bIsResponder = 1; |
| 5551 | |
| 5552 | /* |
| 5553 | * we only populate peer MAC, so it can assit us to find the |
| 5554 | * TDLS peer after response/or after response timeout |
| 5555 | */ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 5556 | vos_mem_copy(setupPeer->peerMac, setupReq->peerMac, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5557 | sizeof(tSirMacAddr)) ; |
| 5558 | /* format TDLS discovery request frame and transmit it */ |
| 5559 | limSendTdlsLinkSetupReqFrame(pMac, setupReq->peerMac, |
| 5560 | setupReq->dialog, psessionEntry, NULL, 0) ; |
| 5561 | |
| 5562 | limStartTdlsTimer(pMac, psessionEntry->peSessionId, |
| 5563 | &setupPeer->gLimTdlsLinkSetupRspTimeoutTimer, |
| 5564 | (tANI_U32)setupPeer->peerMac, WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT, |
| 5565 | SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT) ; |
| 5566 | /* update setup peer list */ |
| 5567 | setupPeer->next = linkSetupInfo->tdlsLinkSetupList ; |
| 5568 | linkSetupInfo->tdlsLinkSetupList = setupPeer ; |
| 5569 | /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when |
| 5570 | TDLS setup cnf TX complete is successful. --> see limTdlsSetupCnfTxComplete() */ |
| 5571 | return eSIR_SUCCESS ; |
| 5572 | #endif |
| 5573 | lim_tdls_link_start_error: |
| 5574 | /* in case of error, return immediately to SME */ |
| 5575 | limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, setupReq->peerMac, |
| 5576 | eWNI_SME_TDLS_LINK_START_RSP); |
| 5577 | return eSIR_FAILURE ; |
| 5578 | } |
| 5579 | |
| 5580 | /* |
| 5581 | * Process link teardown request recieved from SME and transmit to AP. |
| 5582 | */ |
| 5583 | eHalStatus limProcessSmeTeardownReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 5584 | { |
| 5585 | /* get all discovery request parameters */ |
| 5586 | tSirTdlsTeardownReq *teardownReq = (tSirTdlsTeardownReq *) pMsgBuf ; |
| 5587 | tLimTdlsLinkSetupPeer *setupPeer; |
| 5588 | tpPESession psessionEntry; |
| 5589 | tANI_U8 sessionId; |
| 5590 | |
| 5591 | if((psessionEntry = peFindSessionByBssid(pMac, teardownReq->bssid, &sessionId)) == NULL) |
| 5592 | { |
| 5593 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5594 | "PE Session does not exist for given sme sessionId %d", teardownReq->sessionId); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5595 | goto lim_tdls_teardown_req_error; |
| 5596 | } |
| 5597 | |
| 5598 | /* check if we are in proper state to work as TDLS client */ |
| 5599 | if (psessionEntry->limSystemRole != eLIM_STA_ROLE) |
| 5600 | { |
| 5601 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5602 | "TDLS teardown req received in wrong system Role %d", psessionEntry->limSystemRole); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5603 | goto lim_tdls_teardown_req_error; |
| 5604 | } |
| 5605 | |
| 5606 | /* |
| 5607 | * if we are still good, go ahead and check if we are in proper state to |
| 5608 | * do TDLS setup procedure. |
| 5609 | */ |
| 5610 | if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) && |
| 5611 | (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)) |
| 5612 | { |
| 5613 | limLog(pMac, LOGE, "TDLS teardwon req received in invalid LIMsme \ |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5614 | state (%d)", psessionEntry->limSmeState); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5615 | goto lim_tdls_teardown_req_error; |
| 5616 | } |
| 5617 | |
| 5618 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 5619 | "Teardown for peer = " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(teardownReq->peerMac)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5620 | /* |
| 5621 | * Now, go ahead and transmit TDLS teardown request, and save teardown info |
| 5622 | * info for future reference. |
| 5623 | */ |
| 5624 | /* Verify if this link is setup */ |
| 5625 | setupPeer = NULL ; |
| 5626 | limTdlsFindLinkPeer(pMac, teardownReq->peerMac, &setupPeer); |
| 5627 | if(NULL == setupPeer) |
| 5628 | { |
| 5629 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5630 | ("invalid Peer on teardown ")) ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5631 | goto lim_tdls_teardown_req_error; |
| 5632 | } |
| 5633 | |
| 5634 | |
| 5635 | (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ; |
| 5636 | (setupPeer)->tdls_link_state = TDLS_LINK_TEARDOWN_START_STATE ; |
| 5637 | /* TDLS_sessionize: check sessionId in case */ |
| 5638 | if((setupPeer)->tdls_sessionId != psessionEntry->peSessionId) |
| 5639 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5640 | limLog(pMac, LOGE, "TDLS teardown req; stored sessionId (%d) not matched from peSessionId (%d)", \ |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5641 | (setupPeer)->tdls_sessionId, psessionEntry->limSmeState); |
| 5642 | (setupPeer)->tdls_sessionId = psessionEntry->peSessionId; |
| 5643 | } |
| 5644 | |
| 5645 | /* format TDLS teardown request frame and transmit it */ |
| 5646 | if(eSIR_SUCCESS != limSendTdlsTeardownFrame(pMac, teardownReq->peerMac, |
| 5647 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON, psessionEntry, NULL, 0 )) |
| 5648 | { |
| 5649 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5650 | ("couldn't send teardown frame ")) ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5651 | goto lim_tdls_teardown_req_error; |
| 5652 | } |
| 5653 | /* in case of success, eWNI_SME_TDLS_TEARDOWN_RSP is sent back to SME later when |
| 5654 | TDLS teardown TX complete is successful. --> see limTdlsTeardownTxComplete() */ |
| 5655 | return eSIR_SUCCESS; |
| 5656 | lim_tdls_teardown_req_error: |
| 5657 | /* in case of error, return immediately to SME */ |
| 5658 | limSendSmeTdlsTeardownRsp(pMac, eSIR_FAILURE, teardownReq->peerMac, |
| 5659 | eWNI_SME_TDLS_TEARDOWN_RSP); |
| 5660 | return eSIR_FAILURE; |
| 5661 | } |
| 5662 | |
| 5663 | |
| 5664 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5665 | |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 5666 | static void |
| 5667 | __limProcessSmeResetApCapsChange(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 5668 | { |
| 5669 | tpSirResetAPCapsChange pResetCapsChange; |
| 5670 | tpPESession psessionEntry; |
| 5671 | tANI_U8 sessionId = 0; |
| 5672 | if (pMsgBuf == NULL) |
| 5673 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5674 | limLog(pMac, LOGE,FL("Buffer is Pointing to NULL")); |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 5675 | return; |
| 5676 | } |
| 5677 | |
| 5678 | pResetCapsChange = (tpSirResetAPCapsChange)pMsgBuf; |
| 5679 | psessionEntry = peFindSessionByBssid(pMac, pResetCapsChange->bssId, &sessionId); |
| 5680 | if (psessionEntry == NULL) |
| 5681 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5682 | limLog(pMac, LOGE, FL("Session does not exist for given BSSID")); |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 5683 | return; |
| 5684 | } |
| 5685 | |
| 5686 | psessionEntry->limSentCapsChangeNtf = false; |
| 5687 | return; |
| 5688 | } |
| 5689 | |
Siddharth Bhal | 6af5d4e | 2014-09-29 21:11:16 +0530 | [diff] [blame] | 5690 | static void |
| 5691 | __limProcessSmeSpoofMacAddrRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 5692 | { |
| 5693 | tSirMsgQ msg; |
| 5694 | tpSpoofMacAddrReqParams pSpoofMacAddrParams; |
| 5695 | tpSirSpoofMacAddrReq pSmeReq = (tpSirSpoofMacAddrReq) pMsgBuf; |
| 5696 | |
| 5697 | pSpoofMacAddrParams = vos_mem_malloc(sizeof( tSpoofMacAddrReqParams)); |
| 5698 | if ( NULL == pSpoofMacAddrParams ) |
| 5699 | { |
Siddharth Bhal | 4f3187c | 2014-10-09 21:38:08 +0530 | [diff] [blame] | 5700 | limLog( pMac, LOGE, FL("Unable to allocate memory for tDelStaSelfParams") ); |
Siddharth Bhal | 6af5d4e | 2014-09-29 21:11:16 +0530 | [diff] [blame] | 5701 | return; |
| 5702 | } |
| 5703 | |
| 5704 | vos_mem_copy( pSpoofMacAddrParams->macAddr, pSmeReq->macAddr, sizeof(tSirMacAddr) ); |
| 5705 | |
Siddharth Bhal | 4f3187c | 2014-10-09 21:38:08 +0530 | [diff] [blame] | 5706 | vos_mem_copy(pMac->lim.spoofMacAddr, pSmeReq->macAddr, VOS_MAC_ADDRESS_LEN); |
| 5707 | |
| 5708 | limLog( pMac, LOG1, FL("Recieved Spoofed Mac Addr request with Addr:" |
| 5709 | MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pMac->lim.spoofMacAddr) ); |
| 5710 | |
Siddharth Bhal | 6af5d4e | 2014-09-29 21:11:16 +0530 | [diff] [blame] | 5711 | msg.type = WDA_SPOOF_MAC_ADDR_REQ; |
| 5712 | msg.reserved = 0; |
| 5713 | msg.bodyptr = pSpoofMacAddrParams; |
| 5714 | msg.bodyval = 0; |
| 5715 | |
| 5716 | limLog(pMac, LOG1, FL("sending SIR_HAL_SPOOF_MAC_ADDR_REQ msg to HAL")); |
| 5717 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type)); |
| 5718 | |
| 5719 | if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg)) |
| 5720 | { |
Siddharth Bhal | 4f3187c | 2014-10-09 21:38:08 +0530 | [diff] [blame] | 5721 | limLog(pMac, LOGE, FL("wdaPostCtrlMsg failed for SIR_HAL_SPOOF_MAC_ADDR_REQ")); |
Siddharth Bhal | 6af5d4e | 2014-09-29 21:11:16 +0530 | [diff] [blame] | 5722 | vos_mem_free(pSpoofMacAddrParams); |
| 5723 | } |
| 5724 | return; |
| 5725 | } |
| 5726 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5727 | /** |
| 5728 | * limProcessSmeReqMessages() |
| 5729 | * |
| 5730 | *FUNCTION: |
| 5731 | * This function is called by limProcessMessageQueue(). This |
| 5732 | * function processes SME request messages from HDD or upper layer |
| 5733 | * application. |
| 5734 | * |
| 5735 | *LOGIC: |
| 5736 | * |
| 5737 | *ASSUMPTIONS: |
| 5738 | * |
| 5739 | *NOTE: |
| 5740 | * |
| 5741 | * @param pMac Pointer to Global MAC structure |
| 5742 | * @param msgType Indicates the SME message type |
| 5743 | * @param *pMsgBuf A pointer to the SME message buffer |
| 5744 | * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed. |
| 5745 | * FALSE - if pMsgBuf is not to be freed. |
| 5746 | */ |
| 5747 | |
| 5748 | tANI_BOOLEAN |
| 5749 | limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg) |
| 5750 | { |
| 5751 | tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed. |
| 5752 | tANI_U32 *pMsgBuf = pMsg->bodyptr; |
Sudhir Sattayappa Kohalli | abf751c | 2013-06-30 15:37:18 -0700 | [diff] [blame] | 5753 | tpSirSmeScanReq pScanReq; |
Ganesh Kondabattini | 1693007 | 2014-08-22 16:02:34 +0530 | [diff] [blame] | 5754 | tANI_BOOLEAN isPassiveScan = FALSE; |
| 5755 | |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5756 | PELOG1(limLog(pMac, LOG1, FL("LIM Received SME Message %s(%d) Global LimSmeState:%s(%d) Global LimMlmState: %s(%d)"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5757 | limMsgStr(pMsg->type), pMsg->type, |
| 5758 | limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState, |
| 5759 | limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );) |
| 5760 | |
Sudhir Sattayappa Kohalli | abf751c | 2013-06-30 15:37:18 -0700 | [diff] [blame] | 5761 | pScanReq = (tpSirSmeScanReq) pMsgBuf; |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5762 | /* Special handling of some SME Req msgs where we have an existing GO session and |
| 5763 | * want to insert NOA before processing those msgs. These msgs will be processed later when |
| 5764 | * start event happens |
| 5765 | */ |
Sachin Ahuja | 4235414 | 2015-01-06 19:48:35 +0530 | [diff] [blame] | 5766 | MTRACE(macTraceMsgRx(pMac, NO_SESSION, pMsg->type)); |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5767 | switch (pMsg->type) |
| 5768 | { |
| 5769 | case eWNI_SME_SCAN_REQ: |
Ganesh Kondabattini | 1693007 | 2014-08-22 16:02:34 +0530 | [diff] [blame] | 5770 | pScanReq = (tpSirSmeScanReq) pMsgBuf; |
| 5771 | isPassiveScan = (pScanReq->scanType == eSIR_PASSIVE_SCAN) ? TRUE : FALSE; |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5772 | case eWNI_SME_REMAIN_ON_CHANNEL_REQ: |
Sudhir Sattayappa Kohalli | abf751c | 2013-06-30 15:37:18 -0700 | [diff] [blame] | 5773 | |
| 5774 | /* If scan is disabled return from here |
| 5775 | */ |
| 5776 | if (pMac->lim.fScanDisabled) |
| 5777 | { |
Sudhir Sattayappa Kohalli | abf751c | 2013-06-30 15:37:18 -0700 | [diff] [blame] | 5778 | if (pMsg->type == eWNI_SME_SCAN_REQ) |
| 5779 | { |
| 5780 | limSendSmeScanRsp(pMac, |
| 5781 | offsetof(tSirSmeScanRsp,bssDescription[0]), |
| 5782 | eSIR_SME_INVALID_PARAMETERS, |
| 5783 | pScanReq->sessionId, |
| 5784 | pScanReq->transactionId); |
| 5785 | |
| 5786 | bufConsumed = TRUE; |
| 5787 | } |
| 5788 | else if (pMsg->type == eWNI_SME_REMAIN_ON_CHANNEL_REQ) |
| 5789 | { |
| 5790 | pMac->lim.gpDefdSmeMsgForNOA = NULL; |
| 5791 | pMac->lim.gpLimRemainOnChanReq = (tpSirRemainOnChnReq )pMsgBuf; |
| 5792 | limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL); |
| 5793 | |
| 5794 | /* |
| 5795 | * limRemainOnChnRsp will free the buffer this change is to |
| 5796 | * avoid "double free" |
| 5797 | */ |
| 5798 | bufConsumed = FALSE; |
| 5799 | } |
| 5800 | |
Rashmi Ramanna | 6c13a34 | 2014-01-07 11:44:07 +0530 | [diff] [blame] | 5801 | limLog(pMac, LOGE, |
| 5802 | FL("Error: Scan Disabled." |
| 5803 | " Return with error status for SME Message %s(%d)"), |
| 5804 | limMsgStr(pMsg->type), pMsg->type); |
| 5805 | |
Sudhir Sattayappa Kohalli | abf751c | 2013-06-30 15:37:18 -0700 | [diff] [blame] | 5806 | return bufConsumed; |
| 5807 | } |
| 5808 | /* |
| 5809 | * Do not add BREAK here |
| 5810 | */ |
| 5811 | case eWNI_SME_OEM_DATA_REQ: |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5812 | case eWNI_SME_JOIN_REQ: |
| 5813 | /* If we have an existing P2P GO session we need to insert NOA before actually process this SME Req */ |
| 5814 | if ((limIsNOAInsertReqd(pMac) == TRUE) && IS_FEATURE_SUPPORTED_BY_FW(P2P_GO_NOA_DECOUPLE_INIT_SCAN)) |
| 5815 | { |
| 5816 | tANI_U32 noaDuration; |
| 5817 | __limRegisterDeferredSmeReqForNOAStart(pMac, pMsg->type, pMsgBuf); |
Ganesh Kondabattini | 1693007 | 2014-08-22 16:02:34 +0530 | [diff] [blame] | 5818 | noaDuration = limCalculateNOADuration(pMac, pMsg->type, pMsgBuf, isPassiveScan); |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5819 | bufConsumed = __limInsertSingleShotNOAForScan(pMac, noaDuration); |
| 5820 | return bufConsumed; |
| 5821 | } |
| 5822 | } |
| 5823 | /* If no insert NOA required then execute the code below */ |
| 5824 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5825 | switch (pMsg->type) |
| 5826 | { |
| 5827 | case eWNI_SME_START_REQ: |
| 5828 | __limProcessSmeStartReq(pMac, pMsgBuf); |
| 5829 | break; |
| 5830 | |
| 5831 | case eWNI_SME_SYS_READY_IND: |
| 5832 | bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf); |
| 5833 | break; |
| 5834 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5835 | case eWNI_SME_START_BSS_REQ: |
| 5836 | bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg); |
| 5837 | break; |
| 5838 | |
| 5839 | case eWNI_SME_SCAN_REQ: |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 5840 | __limProcessSmeScanReq(pMac, pMsgBuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5841 | break; |
| 5842 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5843 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 5844 | case eWNI_SME_OEM_DATA_REQ: |
| 5845 | __limProcessSmeOemDataReq(pMac, pMsgBuf); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5846 | break; |
| 5847 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5848 | case eWNI_SME_REMAIN_ON_CHANNEL_REQ: |
| 5849 | bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf); |
| 5850 | break; |
| 5851 | |
| 5852 | case eWNI_SME_UPDATE_NOA: |
| 5853 | __limProcessSmeNoAUpdate(pMac, pMsgBuf); |
| 5854 | break; |
Gopichand Nakkala | c178ac8 | 2013-05-30 19:53:39 +0530 | [diff] [blame] | 5855 | case eWNI_SME_CLEAR_DFS_CHANNEL_LIST: |
| 5856 | __limProcessClearDfsChannelList(pMac, pMsg); |
| 5857 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5858 | case eWNI_SME_JOIN_REQ: |
| 5859 | __limProcessSmeJoinReq(pMac, pMsgBuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5860 | break; |
| 5861 | |
| 5862 | case eWNI_SME_AUTH_REQ: |
| 5863 | // __limProcessSmeAuthReq(pMac, pMsgBuf); |
| 5864 | |
| 5865 | break; |
| 5866 | |
| 5867 | case eWNI_SME_REASSOC_REQ: |
| 5868 | __limProcessSmeReassocReq(pMac, pMsgBuf); |
| 5869 | |
| 5870 | break; |
| 5871 | |
| 5872 | case eWNI_SME_PROMISCUOUS_MODE_REQ: |
| 5873 | //__limProcessSmePromiscuousReq(pMac, pMsgBuf); |
| 5874 | |
| 5875 | break; |
| 5876 | |
| 5877 | case eWNI_SME_DISASSOC_REQ: |
| 5878 | __limProcessSmeDisassocReq(pMac, pMsgBuf); |
| 5879 | |
| 5880 | break; |
| 5881 | |
| 5882 | case eWNI_SME_DISASSOC_CNF: |
| 5883 | case eWNI_SME_DEAUTH_CNF: |
| 5884 | __limProcessSmeDisassocCnf(pMac, pMsgBuf); |
| 5885 | |
| 5886 | break; |
| 5887 | |
| 5888 | case eWNI_SME_DEAUTH_REQ: |
| 5889 | __limProcessSmeDeauthReq(pMac, pMsgBuf); |
| 5890 | |
| 5891 | break; |
| 5892 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5893 | |
| 5894 | |
| 5895 | case eWNI_SME_SETCONTEXT_REQ: |
| 5896 | __limProcessSmeSetContextReq(pMac, pMsgBuf); |
| 5897 | |
| 5898 | break; |
| 5899 | |
| 5900 | case eWNI_SME_REMOVEKEY_REQ: |
| 5901 | __limProcessSmeRemoveKeyReq(pMac, pMsgBuf); |
| 5902 | |
| 5903 | break; |
| 5904 | |
| 5905 | case eWNI_SME_STOP_BSS_REQ: |
| 5906 | bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg); |
| 5907 | break; |
| 5908 | |
| 5909 | case eWNI_SME_ASSOC_CNF: |
| 5910 | case eWNI_SME_REASSOC_CNF: |
| 5911 | if (pMsg->type == eWNI_SME_ASSOC_CNF) |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 5912 | limLog(pMac, LOG1, FL("Received ASSOC_CNF message")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5913 | else |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 5914 | limLog(pMac, LOG1, FL("Received REASSOC_CNF message")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5915 | __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf); |
| 5916 | break; |
| 5917 | |
| 5918 | case eWNI_SME_ADDTS_REQ: |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 5919 | limLog(pMac, LOG1, FL("Received ADDTS_REQ message")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5920 | __limProcessSmeAddtsReq(pMac, pMsgBuf); |
| 5921 | break; |
| 5922 | |
| 5923 | case eWNI_SME_DELTS_REQ: |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 5924 | limLog(pMac, LOG1, FL("Received DELTS_REQ message")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5925 | __limProcessSmeDeltsReq(pMac, pMsgBuf); |
| 5926 | break; |
| 5927 | |
| 5928 | case SIR_LIM_ADDTS_RSP_TIMEOUT: |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 5929 | limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5930 | limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval); |
| 5931 | break; |
| 5932 | |
| 5933 | case eWNI_SME_STA_STAT_REQ: |
| 5934 | case eWNI_SME_AGGR_STAT_REQ: |
| 5935 | case eWNI_SME_GLOBAL_STAT_REQ: |
| 5936 | case eWNI_SME_STAT_SUMM_REQ: |
| 5937 | __limProcessSmeStatsRequest( pMac, pMsgBuf); |
| 5938 | //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false. |
| 5939 | bufConsumed = FALSE; |
| 5940 | break; |
| 5941 | case eWNI_SME_GET_STATISTICS_REQ: |
| 5942 | __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf); |
| 5943 | //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false. |
| 5944 | bufConsumed = FALSE; |
| 5945 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5946 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 5947 | case eWNI_SME_GET_ROAM_RSSI_REQ: |
| 5948 | __limProcessSmeGetRoamRssiRequest( pMac, pMsgBuf); |
| 5949 | //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false. |
| 5950 | bufConsumed = FALSE; |
| 5951 | break; |
| 5952 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5953 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5954 | case eWNI_SME_GET_TSM_STATS_REQ: |
| 5955 | __limProcessSmeGetTsmStatsRequest( pMac, pMsgBuf); |
| 5956 | bufConsumed = FALSE; |
| 5957 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5958 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5959 | case eWNI_SME_DEL_BA_PEER_IND: |
| 5960 | limProcessSmeDelBaPeerInd(pMac, pMsgBuf); |
| 5961 | break; |
| 5962 | case eWNI_SME_GET_SCANNED_CHANNEL_REQ: |
| 5963 | limProcessSmeGetScanChannelInfo(pMac, pMsgBuf); |
| 5964 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5965 | case eWNI_SME_GET_ASSOC_STAS_REQ: |
| 5966 | limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf); |
| 5967 | break; |
| 5968 | case eWNI_SME_TKIP_CNTR_MEAS_REQ: |
| 5969 | limProcessTkipCounterMeasures(pMac, pMsgBuf); |
| 5970 | break; |
| 5971 | |
| 5972 | case eWNI_SME_HIDE_SSID_REQ: |
| 5973 | __limProcessSmeHideSSID(pMac, pMsgBuf); |
| 5974 | break; |
| 5975 | case eWNI_SME_UPDATE_APWPSIE_REQ: |
| 5976 | __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf); |
| 5977 | break; |
| 5978 | case eWNI_SME_GET_WPSPBC_SESSION_REQ: |
| 5979 | limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf); |
| 5980 | break; |
| 5981 | |
| 5982 | case eWNI_SME_SET_APWPARSNIEs_REQ: |
| 5983 | __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf); |
| 5984 | break; |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 5985 | |
| 5986 | case eWNI_SME_CHNG_MCC_BEACON_INTERVAL: |
| 5987 | //Update the beaconInterval |
| 5988 | __limProcessSmeChangeBI(pMac, pMsgBuf ); |
| 5989 | break; |
Hardik Kantilal Patel | 62a3a76 | 2014-11-21 12:55:57 +0530 | [diff] [blame] | 5990 | |
| 5991 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 5992 | case eWNI_SME_SET_HT_2040_MODE: |
| 5993 | __limProcessSmeSetHT2040Mode(pMac, pMsgBuf); |
| 5994 | break; |
| 5995 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5996 | |
| 5997 | #if defined WLAN_FEATURE_VOWIFI |
| 5998 | case eWNI_SME_NEIGHBOR_REPORT_REQ_IND: |
| 5999 | case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND: |
| 6000 | __limProcessReportMessage(pMac, pMsg); |
| 6001 | break; |
| 6002 | #endif |
| 6003 | |
| 6004 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 6005 | case eWNI_SME_FT_PRE_AUTH_REQ: |
| 6006 | bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg); |
| 6007 | break; |
| 6008 | case eWNI_SME_FT_UPDATE_KEY: |
| 6009 | limProcessFTUpdateKey(pMac, pMsgBuf); |
| 6010 | break; |
| 6011 | |
| 6012 | case eWNI_SME_FT_AGGR_QOS_REQ: |
| 6013 | limProcessFTAggrQosReq(pMac, pMsgBuf); |
| 6014 | break; |
| 6015 | #endif |
| 6016 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6017 | #if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD) |
| 6018 | case eWNI_SME_ESE_ADJACENT_AP_REPORT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6019 | limProcessAdjacentAPRepMsg ( pMac, pMsgBuf ); |
| 6020 | break; |
| 6021 | #endif |
| 6022 | case eWNI_SME_ADD_STA_SELF_REQ: |
| 6023 | __limProcessSmeAddStaSelfReq( pMac, pMsgBuf ); |
| 6024 | break; |
| 6025 | case eWNI_SME_DEL_STA_SELF_REQ: |
| 6026 | __limProcessSmeDelStaSelfReq( pMac, pMsgBuf ); |
| 6027 | break; |
| 6028 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6029 | case eWNI_SME_REGISTER_MGMT_FRAME_REQ: |
| 6030 | __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf ); |
| 6031 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 6032 | #ifdef FEATURE_WLAN_TDLS |
| 6033 | case eWNI_SME_TDLS_SEND_MGMT_REQ: |
| 6034 | limProcessSmeTdlsMgmtSendReq(pMac, pMsgBuf); |
| 6035 | break; |
| 6036 | case eWNI_SME_TDLS_ADD_STA_REQ: |
| 6037 | limProcessSmeTdlsAddStaReq(pMac, pMsgBuf); |
| 6038 | break; |
| 6039 | case eWNI_SME_TDLS_DEL_STA_REQ: |
| 6040 | limProcessSmeTdlsDelStaReq(pMac, pMsgBuf); |
| 6041 | break; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 6042 | case eWNI_SME_TDLS_LINK_ESTABLISH_REQ: |
| 6043 | limProcesSmeTdlsLinkEstablishReq(pMac, pMsgBuf); |
| 6044 | break; |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 6045 | // tdlsoffchan |
| 6046 | case eWNI_SME_TDLS_CHANNEL_SWITCH_REQ: |
| 6047 | limProcesSmeTdlsChanSwitchReq(pMac, pMsgBuf); |
| 6048 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 6049 | #endif |
| 6050 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 6051 | case eWNI_SME_TDLS_DISCOVERY_START_REQ: |
| 6052 | limProcessSmeDisStartReq(pMac, pMsgBuf); |
| 6053 | break ; |
| 6054 | case eWNI_SME_TDLS_LINK_START_REQ: |
| 6055 | limProcessSmeLinkStartReq(pMac, pMsgBuf); |
| 6056 | break ; |
| 6057 | case eWNI_SME_TDLS_TEARDOWN_REQ: |
| 6058 | limProcessSmeTeardownReq(pMac, pMsgBuf); |
| 6059 | break ; |
| 6060 | #endif |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 6061 | case eWNI_SME_RESET_AP_CAPS_CHANGED: |
| 6062 | __limProcessSmeResetApCapsChange(pMac, pMsgBuf); |
| 6063 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6064 | |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 6065 | case eWNI_SME_SET_TX_POWER_REQ: |
| 6066 | limSendSetTxPowerReq(pMac, pMsgBuf); |
| 6067 | break ; |
| 6068 | |
Siddharth Bhal | 6af5d4e | 2014-09-29 21:11:16 +0530 | [diff] [blame] | 6069 | case eWNI_SME_MAC_SPOOF_ADDR_IND: |
| 6070 | __limProcessSmeSpoofMacAddrRequest(pMac, pMsgBuf); |
| 6071 | break ; |
| 6072 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6073 | default: |
| 6074 | vos_mem_free((v_VOID_t*)pMsg->bodyptr); |
| 6075 | pMsg->bodyptr = NULL; |
| 6076 | break; |
| 6077 | } // switch (msgType) |
| 6078 | |
| 6079 | return bufConsumed; |
| 6080 | } /*** end limProcessSmeReqMessages() ***/ |