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